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.
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.