Page 1 of 1

ADC problems with 18F87K22

Posted: Sat Feb 22, 2020 1:24 pm
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

Re: ADC problems with 18F87K22

Posted: Sat Feb 22, 2020 2:15 pm
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?

Re: ADC problems with 18F87K22

Posted: Sat Feb 22, 2020 7:42 pm
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.

Re: ADC problems with 18F87K22

Posted: Sun Feb 23, 2020 8:33 pm
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:

Re: ADC problems with 18F87K22

Posted: Sun Feb 23, 2020 8:59 pm
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

Re: ADC problems with 18F87K22

Posted: Sun Feb 23, 2020 9:15 pm
by medelec35
The other thing to try is the 1 second flash test.

Re: ADC problems with 18F87K22

Posted: Sun Feb 23, 2020 10:12 pm
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.

Re: ADC problems with 18F87K22

Posted: Mon Feb 24, 2020 12:26 pm
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.

Re: ADC problems with 18F87K22

Posted: Tue Feb 25, 2020 10:47 pm
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: