can anyone help me with this code...?

Thread Starter

cyril666

Joined Feb 7, 2009
12
' Define ADCIN parameters

Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
adval var word ' Create adval to store result

TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and right justify result
Low PORTE.2 ' LCD R/W line low (W)
Pause 500 ' Wait .5 second

loop:
ADCIN 0, adval ' Read channel 0 to adval

' Adval contains your analog reading you decide in which way use it with your code here

Pause 100 ' Wait .1 second

Goto loop ' Do it forever
End


can anyone tell me all the pins that used for this code....this code is for PIC18F4550

what is 3=rc means?? can PIC operates correctly just using these codes??
 

thatoneguy

Joined Feb 19, 2009
6,359
Clock source for the ADC is an external RC network, see your other thread for bit options in comments.

To know fully how to change the ADC parameters, get both the Datasheet for the 18F4550 and the ADC app notes/tips and tricks, all from http://www.microchip.com
 
Top