can anyone help me with this code...?

Discussion in 'Programmer's Corner' started by cyril666, Mar 7, 2009.

  1. cyril666

    Thread Starter Member

    Feb 7, 2009
    12
    0
    ' 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??
     
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    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
     
Loading...