Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Plz Help me sooooon!!!!!!

Status
Not open for further replies.

Anurag_Singh

New Member
I have made two programmers(JDM and P16PRO40) but both gave the same problem while programming pic 16F628A...
I also bought a ICSP programmer given in following link:
**broken link removed**

All the 3 programmers give the same error while programming
VERIFY FAILED AT ADDRESS 0000h

I have used ic-prog and winpic800. But since all 3 are giving the same error, there might be some software error.

By the way, I start MPLAB IDE ->and open the source file-> then click on quick built option...Is anything wrong in it??

I used the following code given by NIGEL:
LIST p=16F628A ;tell assembler what chip we are using
include "P16F628A.inc" ;include the defaults for the chip
__config 0x3D18 ;sets the configuration settings (oscillator type etc.)

cblock 0x20 ;start of general purpose registers
count ;used in table read routine
count1 ;used in delay routine
count2 ;used in delay routine
counta ;used in delay routine
countb
countc
countd
speed
endc

LEDPORT Equ PORTB ;set constant LEDPORT = 'PORTB'
LEDTRIS Equ TRISB ;set constant for TRIS register
SWPORT Equ PORTA
SWTRIS Equ TRISA
SW1 Equ 7 ;set constants for the switches
SW2 Equ 6
SW3 Equ 5
SW4 Equ 4
LED1 Equ 3 ;and for the LED's
LED2 Equ 2
LED3 Equ 1
LED4 Equ 0


SWDel Set Del50

org 0x0000 ;org sets the origin, 0x0000 for the 16F628,
;this is where the program starts running
movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)

bsf STATUS, RP0 ;select bank 1
movlw b'00000000' ;set PortB all outputs
movwf LEDTRIS
movlw b'11110000' ;set PortA 4 inputs, 4 outputs
movwf SWTRIS
bcf STATUS, RP0 ;select bank 0
clrf LEDPORT ;set all outputs low
clrf SWPORT ;make sure all LED's are off
bsf SWPORT, LED1 ;and turn initial LED on
movlw d'250'
movwf speed ;set initial speed



Start clrf count ;set counter register to zero
Read movf count, w ;put counter value in W
btfsc SWPORT, LED1 ;check which LED is on
call Table1 ;and call the associated table
btfsc SWPORT, LED2
call Table2
btfsc SWPORT, LED3
call Table3
movwf LEDPORT
call DelVar
incf count, w
xorlw d'14' ;check for last (14th) entry
btfsc STATUS, Z
goto Start ;if start from beginning
incf count, f ;else do next
goto Read

Table1 ADDWF PCL, f ;data table for bit pattern
retlw b'10000000'
retlw b'01000000'
retlw b'00100000'
retlw b'00010000'
retlw b'00001000'
retlw b'00000100'
retlw b'00000010'
retlw b'00000001'
retlw b'00000010'
retlw b'00000100'
retlw b'00001000'
retlw b'00010000'
retlw b'00100000'
retlw b'01000000'

Table2 ADDWF PCL, f ;data table for bit pattern
retlw b'11000000'
retlw b'01100000'
retlw b'00110000'
retlw b'00011000'
retlw b'00001100'
retlw b'00000110'
retlw b'00000011'
retlw b'00000011'
retlw b'00000110'
retlw b'00001100'
retlw b'00011000'
retlw b'00110000'
retlw b'01100000'
retlw b'11000000'

Table3 ADDWF PCL, f ;data table for bit pattern
retlw b'01111111'
retlw b'10111111'
retlw b'11011111'
retlw b'11101111'
retlw b'11110111'
retlw b'11111011'
retlw b'11111101'
retlw b'11111110'
retlw b'11111101'
retlw b'11111011'
retlw b'11110111'
retlw b'11101111'
retlw b'11011111'
retlw b'10111111'

ChkKeys btfss SWPORT, SW1
call Switch1
btfss SWPORT, SW2
call Switch2
btfss SWPORT, SW3
call Switch3
btfss SWPORT, SW4
call Switch4
retlw 0x00

Switch1 bcf SWPORT, LED2 ;turn unselected LED's off
bcf SWPORT, LED3 ;turn unselected LED's off
bsf SWPORT, LED1 ;turn LED1 on
retlw 0x00

Switch2 bcf SWPORT, LED1 ;turn unselected LED's off
bcf SWPORT, LED3 ;turn unselected LED's off
bsf SWPORT, LED2 ;turn LED2 on
retlw 0x00

Switch3 bcf SWPORT, LED1 ;turn unselected LED's off
bcf SWPORT, LED2 ;turn unselected LED's off
bsf SWPORT, LED3 ;turn LED3 on
retlw 0x00

Switch4 call SWDel ;give switch time to stop bouncing
btfsc SWPORT, SW4 ;check it's still pressed
retlw 0x00 ;return is not
btfss SWPORT, LED4 ;see if LED4 is already lit
goto FASTON
goto FASTOFF

FASTON bsf SWPORT, LED4 ;turn LED4 on
movlw d'80'
movwf speed ;set fast speed
call SWDel
btfsc SWPORT, SW4 ;wait until button is released
retlw 0x00
goto FASTON

FASTOFF bcf SWPORT, LED4 ;turn LED4 on
movlw d'250'
movwf speed ;set slow speed
call SWDel
btfsc SWPORT, SW4 ;wait until button is released
retlw 0x00
goto FASTOFF

DelVar movfw speed ;delay set by Speed
movwf count1
d1 call ChkKeys ;check the keys
movlw 0xC7 ;delay 1mS
movwf counta
movlw 0x01
movwf countb
Delay_0
decfsz counta, f
goto $+2
decfsz countb, f
goto Delay_0

decfsz count1 ,f
goto d1
retlw 0x00

;use separate delay routines, as Del50 is called from ChkKeys
;which is called from within DelVar

Del50 movlw d'50' ;delay 50mS
movwf count2
d3 movlw 0xC7 ;delay 1mS
movwf countc
movlw 0x01
movwf countd
Delay_1
decfsz countc, f
goto $+2
decfsz countd, f
goto Delay_1

decfsz count2 ,f
goto d3
retlw 0x00


end

Th hex code generated by me:
:020000040000FA
:1000000007309F00831600308600F0308500831291
:10001000860185018515FA30A700A0012008851901
:100020001D2005192C2085183B2086007320200AEE
:100030000E3A03190D28A00A0E2882078034403496
:1000400020341034083404340234013402340434CB
:1000500008341034203440348207C03460343034E3
:1000600018340C3406340334033406340C34183496
:1000700030346034C03482077F34BF34DF34EF342F
:10008000F734FB34FD34FE34FD34FB34F734EF3405
:10009000DF34BF34851F5320051F5720851E5B208A
:1000A000051E5F200034051185108515003485116B
:1000B0008510051500348511051185140034812043
:1000C000051A0034051C65286C2805145030A7005B
:1000D0008120051A003465280510FA30A700812018
:1000E000051A00346C282708A1004A20C730A30055
:1000F0000130A400A30B7D28A40B7A28A10B75283E
:1001000000343230A200C730A5000130A600A50B94
:0C0110008A28A60B8728A20B8328003445
:02400E00183D5B
:00000001FF


Plz anyone try using the code & hex code to program the pic16F628A and tell me the error as I must program my pic within 1 week...

Pleaeez reply soon.
 
hi,
Please repost your program listing, this time use the # option in the reply window menu, select all your code and 'Wrap
Code:
  around selected text'
This will retain the formatting of your list.

Problem is your original post has no formatting..:) 

I cannot just copy/paste to MPALB as it not formatted.
 
Code:
LIST	p=16F628A		;tell assembler what chip we are using
	include "P16F628A.inc"		;include the defaults for the chip
	__config 0x3D18			;sets the configuration settings (oscillator type etc.)

	cblock 	0x20 			;start of general purpose registers
		count			;used in table read routine
		count1 			;used in delay routine
		count2 			;used in delay routine
		counta 			;used in delay routine 
		countb
		countc
		countd
		speed
	endc

LEDPORT	Equ	PORTB			;set constant LEDPORT = 'PORTB'
LEDTRIS	Equ	TRISB			;set constant for TRIS register
SWPORT	Equ	PORTA
SWTRIS	Equ	TRISA
SW1	Equ	7			;set constants for the switches
SW2	Equ	6
SW3	Equ	5
SW4	Equ	4
LED1	Equ	3			;and for the LED's
LED2	Equ	2
LED3	Equ	1
LED4	Equ	0


SWDel	Set	Del50
	
	org	0x0000			;org sets the origin, 0x0000 for the 16F628,
					;this is where the program starts running	
	movlw	0x07
	movwf	CMCON			;turn comparators off (make it like a 16F84)

   	bsf 	STATUS,		RP0	;select bank 1
   	movlw 	b'00000000'		;set PortB all outputs
   	movwf 	LEDTRIS
	movlw 	b'11110000'		;set PortA 4 inputs, 4 outputs
   	movwf 	SWTRIS
	bcf	STATUS,		RP0	;select bank 0
	clrf	LEDPORT			;set all outputs low
	clrf	SWPORT			;make sure all LED's are off
	bsf	SWPORT,	LED1		;and turn initial LED on
	movlw	d'250'
	movwf	speed			;set initial speed



Start	clrf	count			;set counter register to zero
Read	movf	count, w		;put counter value in W
	btfsc	SWPORT,	LED1		;check which LED is on
	call	Table1			;and call the associated table
	btfsc	SWPORT,	LED2
	call	Table2
	btfsc	SWPORT,	LED3
	call	Table3
	movwf	LEDPORT
	call	DelVar
	incf	count,	w
	xorlw	d'14'			;check for last (14th) entry
	btfsc	STATUS,	Z
	goto	Start			;if start from beginning
	incf	count,	f		;else do next
	goto	Read

Table1	ADDWF   PCL, f			;data table for bit pattern
	retlw	b'10000000'
        retlw   b'01000000'
        retlw   b'00100000'
        retlw   b'00010000'
        retlw   b'00001000'
        retlw   b'00000100'
        retlw   b'00000010'
        retlw   b'00000001'
        retlw   b'00000010'
        retlw   b'00000100'
        retlw   b'00001000'
        retlw   b'00010000'
        retlw   b'00100000'
        retlw   b'01000000'

Table2	ADDWF   PCL, f			;data table for bit pattern
	retlw	b'11000000'
        retlw   b'01100000'
        retlw   b'00110000'
        retlw   b'00011000'
        retlw   b'00001100'
        retlw   b'00000110'
        retlw   b'00000011'
        retlw   b'00000011'
        retlw   b'00000110'
        retlw   b'00001100'
        retlw   b'00011000'
        retlw   b'00110000'
        retlw   b'01100000'
        retlw   b'11000000'

Table3	ADDWF   PCL, f			;data table for bit pattern
	retlw	b'01111111'
        retlw   b'10111111'
        retlw   b'11011111'
        retlw   b'11101111'
        retlw   b'11110111'
        retlw   b'11111011'
        retlw   b'11111101'
        retlw   b'11111110'
        retlw   b'11111101'
        retlw   b'11111011'
        retlw   b'11110111'
        retlw   b'11101111'
        retlw   b'11011111'
        retlw   b'10111111'

ChkKeys	btfss	SWPORT,	SW1
	call	Switch1
	btfss	SWPORT,	SW2
	call	Switch2
	btfss	SWPORT,	SW3
	call	Switch3
	btfss	SWPORT,	SW4
	call	Switch4
	retlw	0x00

Switch1	bcf	SWPORT,	LED2		;turn unselected LED's off
	bcf	SWPORT,	LED3		;turn unselected LED's off
	bsf	SWPORT,	LED1		;turn LED1 on
	retlw	0x00

Switch2	bcf	SWPORT,	LED1		;turn unselected LED's off
	bcf	SWPORT,	LED3		;turn unselected LED's off
	bsf	SWPORT,	LED2		;turn LED2 on
	retlw	0x00

Switch3	bcf	SWPORT,	LED1		;turn unselected LED's off
	bcf	SWPORT,	LED2		;turn unselected LED's off
	bsf	SWPORT,	LED3		;turn LED3 on
	retlw	0x00

Switch4	call	SWDel			;give switch time to stop bouncing
	btfsc	SWPORT,	SW4		;check it's still pressed
	retlw	0x00			;return is not
	btfss	SWPORT,	LED4		;see if LED4 is already lit
	goto	FASTON
	goto	FASTOFF

FASTON	bsf	SWPORT,	LED4		;turn LED4 on
	movlw	d'80'
	movwf	speed			;set fast speed
	call	SWDel
	btfsc	SWPORT,	SW4		;wait until button is released
	retlw	0x00
	goto	FASTON	

FASTOFF	bcf	SWPORT,	LED4		;turn LED4 on
	movlw	d'250'
	movwf	speed			;set slow speed
	call	SWDel
	btfsc	SWPORT,	SW4		;wait until button is released
	retlw	0x00
	goto	FASTOFF

DelVar	movfw	speed			;delay set by Speed
	movwf	count1
d1	call 	ChkKeys 		;check the keys
	movlw	0xC7			;delay 1mS
	movwf	counta
	movlw	0x01
	movwf	countb
Delay_0
	decfsz	counta, f
	goto	$+2
	decfsz	countb, f
	goto	Delay_0

	decfsz	count1	,f
	goto	d1
	retlw	0x00

;use separate delay routines, as Del50 is called from ChkKeys
;which is called from within DelVar

Del50	movlw	d'50'			;delay 50mS
 	movwf	count2
d3	movlw	0xC7			;delay 1mS
	movwf	countc
	movlw	0x01
	movwf	countd
Delay_1
	decfsz	countc, f
	goto	$+2
	decfsz	countd, f
	goto	Delay_1

	decfsz	count2	,f
	goto	d3
	retlw	0x00


	end

Here's the code.
Plz help me out
 
A problem in the source code wouldn't give that error anyway, it's a programmer error - most probably that the PIC isn't getting switched to program mode. It might even be something as simple as not connecting to the correct port?, it needs basic fault finding applying.
 
hi,
Pasted your program into the Oshonsoft simulator, it runs ok, cycles thru the LED's OK.

Used MPLAB V7.60, Project wizard, 16F628A, assembles OK, checked the program file looks OK.

Programmed a PIC 16F628A using PIC Start+, programs and verifies OK.

As stated, your problem lies elsewhere..;)

MPLAB View:
:020000040000FA
:1000000007309F00831600308600F0308500831291
:100010008601850185150130A700A00120088519FA
:100020001D2005192C2085183B2086007320200AEE
:100030000E3A03190D28A00A0E2882078034403496
:1000400020341034083404340234013402340434CB
:1000500008341034203440348207C03460343034E3
:1000600018340C3406340334033406340C34183496
:1000700030346034C03482077F34BF34DF34EF342F
:10008000F734FB34FD34FE34FD34FB34F734EF3405
:10009000DF34BF34851F5320051F5720851E5B208A
:1000A000051E5F200034051185108515003485116B
:1000B0008510051500348511051185140034812043
:1000C000051A0034051C65286C2805145030A7005B
:1000D0008120051A003465280510FA30A700812018
:1000E000051A00346C280800A1004A20C730A3007C
:1000F0000130A400A30B7D28A40B7A28A10B75283E
:1001000000343230A200C730A5000130A600A50B94
:0C0110008A28A60B8728A20B8328003445
:02400E00183D5B
:00000001FF
 
Last edited:
Anurag_Singh said:
Code:
LIST	p=16F628A		;tell assembler what chip we are using
	include "P16F628A.inc"		;include the defaults for the chip
	__config 0x3D18			;sets the configuration settings (oscillator type etc.)

.............
	retlw	0x00


	end

Here's the code.
Plz help me out

The code is also certified by eric. Now you can't see it performing, until you load this hex file in the PIC16F628A, by one of your programmers. While you may start debugging your programmer, you may have to wire the necessary hardware for the software, as per Nigel's schematic. Only then you can check it in reality.
 
As stated, sound like the programmer(s) and software. Do you have extra PIC chips, maybe the PIC chip is bad?
 
Can new pic chip be faulty?

By the way, the pic reads 0000h at all place when read using ic-prog whereas it reads 3FFF when read using winpicpro.
That could be the reason to say that the pic chip is faulty.

@mvs_sarma
I have made p16pro40 programmer as per nigel's schematic. But the same error. And it also used LPT port, so the port connection could not be wrong as I tried both serial & parallel port programmers.
 
Last edited:
It's more likely a faulty programmer, the JDM designs can be very unreliable on modern computers.
PICs on the otherhand tend to be very robust.
 
Anurag_Singh said:
By the way, the pic reads 0000h at all place when read using ic-prog whereas it reads 3FFF when read using winpicpro.
That could be the reason to say that the pic chip is faulty.

@mvs_sarma
I have made p16pro40 programmer as per nigel's schematic. But the same error. And it also used LPT port, so the port connection could not be wrong as I tried both serial & parallel port programmers.

Try WinPicProg, this has auto-detect of the (minimally) working hardware, and also manual toggle buttons so you can fault find.
 
Hai, Anurag,
Three programmers and same result: Once you have selected, internal oscillator, you may not be able to stop it if powered, unless you have Vpp before Vdd.

How many more you could manufacture? At least the PIC16PR40 is acclaimed. You first take it up and try to debug by testing various measurements on it and make it work, there after you can proceed further.
Mean time, if you have the schematic of the TRI programmer in the manual you may send a copy so that I could analyse it. I feel, it is similar to Ashonsoft PIC programmer, by initial looks at the board photograph.
 
Is chip faulty??

Hello everyone
I got a new clue about my failure. All the 3 programmers read 0000h when the pic is inserted as well as when the pic chip is removed.
That means the programmers are unable to find the presence of the pic chip. This might be the probable reason of programming error...

Can anyone tell me what it is all about?? How is it possible that the existence of chip is not recognised by the programmer???

By the way, I think the programmer works well as all leds lit as per scheme.

Plz tell me the probable reason of my prob and its solution.
 
Anurag_Singh said:
Hello everyone
I got a new clue about my failure. All the 3 programmers read 0000h when the pic is inserted as well as when the pic chip is removed.
That means the programmers are unable to find the presence of the pic chip. This might be the probable reason of programming error...

Can anyone tell me what it is all about?? How is it possible that the existence of chip is not recognised by the programmer???

By the way, I think the programmer works well as all leds lit as per scheme.

Plz tell me the probable reason of my prob and its solution.

hi,
Is it possible to try your programmers on a different PC.?

Also what is the PC's operating program/system. eg: Win XP Win98se etc.?
 
Last edited:
ericgibbs said:
hi,
Is it possible to try your programmers on a different PC.?

I have tried using it on a latest PC...but same result.
By the way, my PC is an older one Intel Celeron processor 531MHz
 
ericgibbs said:
hi,
Is it possible to try your programmers on a different PC.?

Also what is the PC's operating program/system. eg: Win XP Win98se etc.?
I tried it on different pC ..but same result.
The OS is WinXP
 
Anurag_Singh said:
I tried it on different pC ..but same result.
The OS is WinXP

hi,
I expect you have checked the 9W serial and 25W parallel port connectors you have wired up.?
A common mistake is to count the 9/25W pins from the wrong end of the connector.?

Have you any voltage measurements from the PIC16PRO that you could post.?


I have just downloaded from Nigels site the PIC16PRO zip, I'll look over it and try to suggest some ideas.

Have you been able to check/test the parallel port without the programmer plugged in. Can you read and write from it with a test program.?
 
hi,
Another question.
Have you manufactured a pcb for the PIC16PRO using the artwork in the zip or have you hand wired a pcb.?

Any photographs you can post.?
 
I have handwired P16PRO40 ...but it is not with me...it is with one of my friend.
Now I am trying to program using JDM programmer made by me as well as that I bought from
**broken link removed**
 
Status
Not open for further replies.

Latest threads

Back
Top