ADC problems with 18F87K22

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

Moderator: Benj

Post Reply
dannyvanneijenhoff
Posts: 65
Joined: Thu Feb 07, 2008 7:59 am
Has thanked: 17 times
Been thanked: 10 times
Contact:

ADC problems with 18F87K22

Post by dannyvanneijenhoff »

Hello

Can someone please look at the setting's, and the configure options. :)
Everything is working with FC8, except i cann't get the ADC's working with FC7 and FC8. :?
The hardware works fine with the old FC4 programm.

We did not upgrade the software from FC4 to FC6 in the past, because of the same problems.

I have made an test programm with FC8 with one ADC and the pic18F87K22 with an23 on pin79


In advance many thanks, Danny
Attachments
18F87K22 ADC test NEW.fcfx
(13.78 KiB) Downloaded 173 times
FC8 18f87k22 conf.png
(64.25 KiB) Downloaded 850 times
Last edited by dannyvanneijenhoff on Sun Feb 23, 2020 10:50 pm, edited 2 times in total.

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 problems with 18F87K22

Post by medelec35 »

You are using RawSampleByte.
If you hover over the macro it shows:
RawSampleByte.png
(56.86 KiB) Downloaded 844 times
I could not see where you have enabled that function?
Martin

dannyvanneijenhoff
Posts: 65
Joined: Thu Feb 07, 2008 7:59 am
Has thanked: 17 times
Been thanked: 10 times
Contact:

Re: ADC problems with 18F87K22

Post by dannyvanneijenhoff »

Thanks for your reply :-)

I see, but i also tested it with "GetByte"
I forget to put it back from rawsample to "GetByte" :oops:
Should i also start with an fresh and clean programm ? It looks like, i removed all the old data from this one.
Last edited by dannyvanneijenhoff on Sun Feb 23, 2020 8:45 pm, edited 1 time in total.

dannyvanneijenhoff
Posts: 65
Joined: Thu Feb 07, 2008 7:59 am
Has thanked: 17 times
Been thanked: 10 times
Contact:

Re: ADC problems with 18F87K22

Post by dannyvanneijenhoff »

I did make an new programm with 2x ADC and new settings's. And upoaded the new FCFX

Unfortonaly, still not working :cry:

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 problems with 18F87K22

Post by medelec35 »

Have you measured the duty and its staying the same?
What about using UART or LCD to send the exact ADC value read?
The other thing to try is send different fixed values to PWM to make sure that is working as expected
Martin

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 problems with 18F87K22

Post by medelec35 »

The other thing to try is the 1 second flash test.
Martin

dannyvanneijenhoff
Posts: 65
Joined: Thu Feb 07, 2008 7:59 am
Has thanked: 17 times
Been thanked: 10 times
Contact:

Re: ADC problems with 18F87K22

Post by dannyvanneijenhoff »

Thanks, i will have added an 1 second flash/beep test at c2 (piezo on the pcb)


PWM and B output is send as an output on the pcb, and working. I can read there any 8-bit ADC value. :D

Now PortB and PWM flash random from 0 to 255 :?:


Green led and lightbulb is the PWM, red led's are output B on the pcb.
PCB is an working pcb with 7x ADC inputs working with FC4

I will try to generate tomorrow an new HEX from FC4.
Attachments
18F87K22 ADC test NEW.fcfx
(13.78 KiB) Downloaded 156 times
WhatsApp Image 2020-02-23 at 22.20.04.jpeg
WhatsApp Image 2020-02-23 at 22.20.04.jpeg (182.89 KiB) Viewed 3864 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 problems with 18F87K22

Post by Benj »

Hello,

I've investigated the ADC C code for the 18F87K22 device and can't see any specific problems with this, however as a test I've changed a few things around and hopefully it will improve things for you. I've pushed the latest change to the update system now. Help -> Check for updates.

If there is no improvement then maybe try a conversion speed other then the FRC in the ADC component properties?

Let us know how you get on.

dannyvanneijenhoff
Posts: 65
Joined: Thu Feb 07, 2008 7:59 am
Has thanked: 17 times
Been thanked: 10 times
Contact:

Re: ADC problems with 18F87K22

Post by dannyvanneijenhoff »

Thanks :-)

It works now the same as in FC4, after i have updated the ADC in FC.


It starts at at 255 (0V on the adc input), than from zero (+/- 0,2V) to + 230 (4,6V). And that on 5 x ADC input.
I have that also seen that in FC4 and made an work around in the hard an software.
Not sure of that is an setting of the micro, in FC or in the hardware.
It bothers me, that i can not found that issue. But on the orher hand, it works :mrgreen:

Post Reply