ADC component Porblem??? Not sure or is it me

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

Moderators: Benj, Mods

Post Reply
Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times

ADC component Porblem??? Not sure or is it me

Post by Ron »

Hi,

I am still testing a bootloader I am paying someone to write for me. I am trying to fill the memory of the 16F886, not easy to do. I want to see if the program will crash.

I wrote a program that reads an ADC channel and blinks 1 LED ON/OFF based on the value read from RA0. In this small size, simple program it works fine.

To fill the memory I simply did hundreds of cut & paste of the Sample ADC then ReadAsIt, all consecutively. Do you know if this would cause a problem with the program?

Port RA0-2 are tied to pots for the analog sampling.

Port RB0-7 are wired to 2 (two) LEDs each. They are wired to show me if the pins are High.Low or Tri-state. The first thing my program does is turn all pins OFF in RB and my LEDs confirm that these pins are not in tri-state anymore. This is done one time only, above the WHile block.

Port RC0-3 are switches.

If RC0 is high then I let my regular code which worked before this test, and it still runs fine.

If RC3 is high then I let the Sample, ReadAsInt & repeat (Analog wired to RA0) my port RBx were all Output LOW and they change to Tri-state.

Should they all go tri-state on RBx, I do not know how the ADC component macro is handling this.

Is this my bootloader messing up, again, or is this the component macro?


Any ideas????

Thanks

Ron

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:

Post by Benj »

Hello Ron

Not sure I can spot what problem you are having.
To fill the memory I simply did hundreds of cut & paste of the Sample ADC then ReadAsIt, all consecutively. Do you know if this would cause a problem with the program?
No this should not cause a problem.

ADC inputs are set to tri state so they do not affect the input analogue voltage. Look for the ADC part of your datasheet particularily at the part that changes the states of the I/O Pins.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

Re: ADC component Porblem??? Not sure or is it me

Post by jadiflow »

Ben,

Is there anything special I need to do in Flowcode to enable the A/D inputs on an ECIO28? I do a Sample, then ReadAs, which works fine in the sim. In hardware, the port always reads 255 when connected to an input, and that input (current limited) never gets above one diode voltage (0.64 or something), as if the input port has a diode to gnd.
It *may* be that the ECIO is damaged because I used it earlier in a circuit that had the 2455 pinout rather than the ECIO pinout, and I have ordered a new ECIO to close that end.
But just to be sure, can I assume that the analog input is automagically configured correctly when I attach & use the ADC?

Jan Didden

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 component Porblem??? Not sure or is it me

Post by Benj »

Hello Jan

Yes all you should have to do it include the ADC component and perform the sample and read.

Maybe it would be worth trying a potential divider on the analogue input pin to make sure your diode circuitry is correct and working as expected. Eg connect a resistor between 5V and the analogue pin and connect a resistor of the same value between the analogue pin and ground. You should then get a analogue reading representing approx 2.5V.

I have not come across any ADC pins failing but if you wired the chip up in the incorrect polarity etc then this could be a posibility.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

Re: ADC component Porblem??? Not sure or is it me

Post by jadiflow »

Ben, thanks for the confirmation.

BTW There is no external diode on that port, but the analog input is limited to a diode drop, *as if* there is a diode to gnd. I tried another ADC input, same thing.
I think I will wait for the replacement ECIO, however the LCD attached to it works fine....

Have a good weekend,

Jan Didden

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

Re: ADC component Porblem??? Not sure or is it me

Post by jadiflow »

I still have this problem with reading the ADC on the ECIO-28.I ordered a new module but it acts the same.
I'm measuring the actual voltage on pin 7 of the ECIO, which AFAIK is AN3. This pin 7 voltage comes from a regulated supply through a 10:1 attenuator. The pin 7 voltage doesn't go beyond 0.7 V or so, it 'looks' as if there is a diode to gnd. Would this point to a pin that is configured as output?
I reconfigured pin 7 as input, same thing.
With pin 7 configured either as ADC input or digital input, it always shows a '1' (digital) or 255 (ADC).
Is there any restriction in using AN3 as ADC input on the ECIO?
If necessary I can mail the little test program, it really is trivial. It writes the value to an LCD and that part works as advertised.

Jan Didden

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

Re: ADC component Porblem??? Not sure or is it me

Post by jadiflow »

Solved. Don't ask, please.
I've had enough embarrassement in this project :-(

Jan Didden

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 component Porblem??? Not sure or is it me

Post by Benj »

Hi Jan

No problems, I wont ask ;) Glad its working for you now though.

Also no need to be embarrassed this kind of thing is hardly trivial and it generally only takes the smallest of errors to cause a big problem in a system.

Post Reply