ADC input on 16F88 error?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Stanga
Posts: 35
Joined: Sat Aug 07, 2010 10:17 am
Been thanked: 2 times
Contact:

ADC input on 16F88 error?

Post by Stanga »

I am having problem with figuring out why I can't read an ADC value on AN4 of a PIC16F88. The program works as expected in simulation mode on AN4, but fails completely in hardware mode.
The program works perfect on ADC0 to ADC3 in both simulation mode and hardware mode. This is what has me snookered.
I have to use AN4 since AN0 to AN3 are already being used. The uploaded file is just a section of a far larger file, but I have broken it down into test sections just so that I could try to find out what the issue is, but so far even after long nights and kettles of tea I am no way closer to figuring out if it is a compiler bug or if it is just impossible to use AN4 for ADC measurement.
Anyone out there who might be able to advise?
I am using V4.5 out of interest.

Stan
Attachments
level_detect_ADC4.fcf
ADC input not being detected
(10.5 KiB) Downloaded 238 times
level_detect_ADC0.fcf
ADC input correctly detected
(10.5 KiB) Downloaded 247 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 input on 16F88 error?

Post by Benj »

Hello,

I've had a look at the component code and also the Flowcode program and the device datasheet but cannot find anything out of the ordinary for the AN4 pin.

The only thing I have noticed is that when you select AN4 in the component connections, then close the connections window and then go back in, the value has disappeared from the drop down menu. None of the other ADC channels seem to be doing this so I will see if there is anything specific causing this to happen.

Stanga
Posts: 35
Joined: Sat Aug 07, 2010 10:17 am
Been thanked: 2 times
Contact:

Re: ADC input on 16F88 error?

Post by Stanga »

Hi Ben,

thanks for looking at that for me.

Stan

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: ADC input on 16F88 error?

Post by medelec35 »

Hi Stan,
Just tested AN4 on my hardware using your Flowchart, and all is working as expected. How you measured the voltage at pin 3 to confirm it correct depending on pot setting? Has the pin been bent underneath, so it looks like it's connected? Are you using the EB006 V7 or above programmer?
If so have you tried using ICD to monitor value of variables?
Benj wrote:The only thing I have noticed is that when you select AN4 in the component connections, then close the connections window and then go back in, the value has disappeared from the drop down menu. None of the other ADC channels seem to be doing this so I will see if there is anything specific causing this to happen.
Hi Ben,
Could that be the same as what I reported here:
http://www.matrixmultimedia.com/mmforum ... 50&#p24038
Except for drop down is blank instead of showing unconnected?

Martin
Martin

Stanga
Posts: 35
Joined: Sat Aug 07, 2010 10:17 am
Been thanked: 2 times
Contact:

Re: ADC input on 16F88 error?

Post by Stanga »

Hi Martin, I don't have the V7 board. Mine is a bit older than that.
However I have tried the program out on the HP488, on the EB006 with EB003-00.2, and finally out of desperation I built a PCB with a 16F88 on it with related circuit and jumpers to swap between AN0 all the way up to AN4. Everything works fine up to AN3. But AN4 refuses to work as expected. I checked on my scope that a DC voltage was present on pin3 of the PIC, which there was, so the voltage is reaching the IC. I swapped the IC several times in order to discount a faulty IC.
Only after trying just about everything over the last couple of weeks have I finally had to throw my hands up and admit defeat.

What revision of FC are you using Martin? Can you check in the About box in Flowcode?

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: ADC input on 16F88 error?

Post by medelec35 »

Stanga wrote: What revision of FC are you using Martin? Can you check in the About box in Flowcode?
I have got Flowcode v4.5.18.74

We can eliminate software. If you compile to hex and post that.
I can then load your hex file and send to my hardware.
If my hardware works, then we can take it from there.

Martin.
Martin

Stanga
Posts: 35
Joined: Sat Aug 07, 2010 10:17 am
Been thanked: 2 times
Contact:

Re: ADC input on 16F88 error?

Post by Stanga »

Good idea. I shall get that organized. But first I have a friend coming over to my place to double check my work to make sure that I am not doing something wrong.

Stanga
Posts: 35
Joined: Sat Aug 07, 2010 10:17 am
Been thanked: 2 times
Contact:

Re: ADC input on 16F88 error?

Post by Stanga »

Just a quick update on this ADC problem.

I had several people double check my work and they too had problems with ADC4. So I had to redesign the PCB for the project and use ADC1 instead. Everything now works fine :D .

Post Reply