AD on AN3 and AN4 not working PIC18F87J50

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

Moderator: Benj

Post Reply
User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

AD on AN3 and AN4 not working PIC18F87J50

Post by faveremario »

Hi all
I'm working on a home domotic system and as a part of this project, I'm measuring 5 analog values. Doing this with a voltage divider & a stabilizing capacitor on the ANx-input. Quit forward.

For testing purposes I attached 5x 1k-thermistors and used the thermistor component in FC8. Reading every input as real temperature & sending it over USB-port to the PC where I display the values in a terminal window.
All works fine, but readings on AN3 & 4 are not correct. AN4 is connected to a 1k-thermistor on the PCB (monitoring the temperature inside the case - just in case :wink: ).

I measured the voltage across the input pin and it's OK, so it has to be a software failure.
So I updated FC8 & used the AD-component in stead of the termistor-sensor, but without success.

Did anyone had the same issues ?


Capture.png = part of the schematic & terminal readings.
FC-program : reading T & sending over USB-serial. I'm using a bootloader.
Attachments
Capture.PNG
(153.51 KiB) Downloaded 562 times
T-Meting met console.fcfx
(24.49 KiB) Downloaded 160 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: AD on AN3 and AN4 not working PIC18F87J50

Post by LeighM »

Could you please try the attached, to go into
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC
Thanks
Attachments
PIC_CAL_ADC.c
(137.13 KiB) Downloaded 154 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: AD on AN3 and AN4 not working PIC18F87J50

Post by Benj »

Also available now via the v8 update system. :D

User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

Re: AD on AN3 and AN4 not working PIC18F87J50

Post by faveremario »

Hi Leigh
Thanks for the quick reply!

Sure something has changed. All temperature-readings show 125° so I guess the ADC reads 1024 for all channels.
Attachments
Capture.PNG
(13.31 KiB) Downloaded 531 times

User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

Re: AD on AN3 and AN4 not working PIC18F87J50

Post by faveremario »

I looked @the file you send me (thank you for that btw)

On line 3311, I see :
ANCON0 = ~0x01;
shouldn't is be
ANCON0 &= 0xFE;
to set PCFG0 to 0 ?
?

The image joined, shows the result. I try this out for the other channels & get back as soon as I can.
Thanks for the support.
Attachments
Capture.PNG
(13.68 KiB) Downloaded 530 times

User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

Re: AD on AN3 and AN4 not working PIC18F87J50

Post by faveremario »

With this file it works as a dream :) - I modified the channel-selector as described above.

@Ben, could you place this file for the FC8-update please ?

Thanks all !
Attachments
PIC_CAL_ADC.c
(137.2 KiB) Downloaded 159 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: AD on AN3 and AN4 not working PIC18F87J50

Post by LeighM »

Thanks for the contribution, I have pushed this into our repo, Ben will process this into the auto update system in due course

Post Reply