suwaii
Member level 4
i try to to use PIC18f452 as ADC so when i programme it i get error
verify failed at address 0004h and some times at address 0007h
the problem from code and this is the code to convert analog signal to digital
signal...... can any one help me where is the mistake in the code here:
List p=18f452,f=inhx32
#include <p18f452.inc>
;Start at the reset vector
org 0x000
goto Start
org 0x004
Interrupt
retfie
Start
movlw H'00'
movwf TRISC ;portc [7-0] outputs
movlw B'01000000'
movwf ADCON1
movlw B'11000000' ;Fosc/8 [7-6], A/D ch0 [5-3], a/d on [0]
movwf ADCON0
Main
call ad_portc
goto Main
ad_portc
;wait for acquision time (20uS)
;(non-critical for this test)
bsf ADCON0,GO ;Start A/D conversion
Wait
btfsc ADCON0,GO ;Wait for conversion to complete
goto Wait
movf ADRESH,W ;Write A/D result to PORTC
movwf PORTC ;LEDs
return
end
verify failed at address 0004h and some times at address 0007h
the problem from code and this is the code to convert analog signal to digital
signal...... can any one help me where is the mistake in the code here:
List p=18f452,f=inhx32
#include <p18f452.inc>
;Start at the reset vector
org 0x000
goto Start
org 0x004
Interrupt
retfie
Start
movlw H'00'
movwf TRISC ;portc [7-0] outputs
movlw B'01000000'
movwf ADCON1
movlw B'11000000' ;Fosc/8 [7-6], A/D ch0 [5-3], a/d on [0]
movwf ADCON0
Main
call ad_portc
goto Main
ad_portc
;wait for acquision time (20uS)
;(non-critical for this test)
bsf ADCON0,GO ;Start A/D conversion
Wait
btfsc ADCON0,GO ;Wait for conversion to complete
goto Wait
movf ADRESH,W ;Write A/D result to PORTC
movwf PORTC ;LEDs
return
end