ADC Issues

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
hjue
Posts: 3
Joined: Thu Feb 19, 2009 3:42 am
Contact:

ADC Issues

Post 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.
Attachments
Incubator Alarm3.fcf
(7 KiB) Downloaded 243 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ADC Issues

Post 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.

hjue
Posts: 3
Joined: Thu Feb 19, 2009 3:42 am
Contact:

Re: ADC Issues

Post by hjue »

Thanks for the help. =D

Post Reply