Electronics > Beginners

PIC18F46K42 xpress EVAL Board - ADC program

(1/1)

arul:
Hi,

  I have a PIC18F46K42 xpress evaluation board. Now I am developing one of the ADC program using MPLAB Xpress PIC18F46K42 evaluation board on MPLAB CLOUD IDE. I make one of the simple circuit for that program using variable power supply, resistor. I am varying the power source, but that ADC result register value does not change, only shown 0x00 (i got that value 0x00, in debug mode). I have attached my code and circuit.

Please let me know, what is going wrong.....


void main()
{
int RH, RL;

ADCON0bits.FM = 1;
ADCON0bits.CS = 1;
ADPCH = 0b00011100;   //RD4 is analog input
TRISDbits.TRISD4 = 1;
ANSELDbits.ADSELD4 = 1;
ADCON0bits.ON = 1;

   while(1)
   {
   ADCON0bits.GO = 1;
   while(ADCON0bits.GO);
   RH = ADRESH;
   RL = ADRESL;
   }
}

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod