ADC Problem

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

Moderators: Benj, Mods

Post Reply
Andi
Posts: 19
Joined: Thu Nov 29, 2007 12:08 pm
Contact:

ADC Problem

Post by Andi »

Hi,I have a problem with ADC!
Here is a picture from my flowchart

Image

I devined Variable ADC_Value as Byte and Input is on A0
After sample (Makro=Sample ADC), i store the high-byte and return ADC_Value (Makro= Read as Byte)

Then i check if ADC_Value is lower than 185
if yes, it puts out "high" on output A6
if no, it puts out "low" on output A6

(input in Vref+ =2V)

I set clock of the pic intern (18F1320)
and all the needed stuff is enabled ... as far as i think :)

The simulation works, but in "the real world" nothing works...

what did i do wrong?

User avatar
Steve
Matrix Staff
Posts: 3426
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

Your first step in solving problems like this is to make sure your configuration settings are correct and that the hardware is working ok. To do this, I suggest you create and download a simple LED flasher.

Once you have this working, you will be sure that the problem is with the ADC part of your program.

One thing to note is that the ADC component of Flowcode is designed to use the Vdd line of the PICmicro as the Vref+ setting (and the Vref+ pin is used as a normal i/o or analogue input line). It is possible to modify the code behind the component so it allows the use of the Vref+ signal. There is another post somewhere on this forum about it.

Also, is A6 definitely connected to an LED in your hardware and are your config settings set to allow it to be used as a digital i/o line. This pin is shared with the OSC2/CLKO and so you need to be using the "Internal RC oscillator, port function on RA6 and port function on RA7" settings of the FOSCx bits in the config words.

Note that if you are using E-Blocks, pins A6 and A7 are not connected to the E-Block port because these are typically used for the clock.

Post Reply