need help in handling ADC in PIC using ASM

Status
Not open for further replies.

bhaskaran

Newbie level 6
Joined
Nov 27, 2004
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
91
pic adc code in asm

i have tried to capture the data from the ADRESL and ADRESH , when ever iam moving this data to any buffer my system get hang.

kindly help me in solving this problem.(using assembly language )
 

adc pic hangs

if we are currently in bank 0

movf ADRESH,w
movwf adch
banksel ADRESL
movf ADRESL,w
banksel ADRESH
movwf adcl

now you have the information in adc registers in adch and adcl
 

adc asm pic

i have changed the bank accordingly. the actual status of my project is, when i moved the data of ADRESL directly to the port it is showing some reading but when ever i moved to any buffer, no value is displayed.
 

pic adc code in asm

hi. i could't understant the problem exactly but the code i sent should work...
perhaps you could't load correct values to ancon0 and adcon1...
don't forget: to load adresl register to any port, after taking asresl value to w, you have to pass bank0...otherwise you will change the tris register....
perhaps you should send your code.....
and i recomment that document:
https://ww1.microchip.com/downloads/en/DeviceDoc/adc.pdf
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…