Page 1 of 1

ADC Issues

Posted: Tue Mar 17, 2009 1:29 am
by hjue
I'm trying to turn on just port AN0 as an analog input. I've inserted C-blocks right before and after where I take my input into pin 1 (RA0/AN0). I'm using a PIC18F1320, and my sensor is a temperature sensor (LM34)

First block:

adcon0 = 0xc3;
adcon1 = 0xFE;


Second Block:

adcon0 = 0xc1;

I'm currently trying to simply output the value to an lcd screen. The display shows 0, and when I use a DMM to check the voltage into the port, it reads 0. Connections are all complete and correct, so I think the error might be in how I am calling on the input.

I've attached the flowcode as well. Thank you in advance.

Re: ADC Issues

Posted: Tue Mar 17, 2009 10:08 am
by Benj
Hello

The icon you have inserted between the C code blocks is a digital input. You do not require the C code blocks or the input icon to use the analogue channels. Instead click to add a ADC component into your program and then use hardware macros to call the Sample and Read value functions.

Re: ADC Issues

Posted: Tue Mar 17, 2009 4:31 pm
by hjue
Thanks for the help. =D