Page 1 of 2
PIC18F47Q10 ADC not working
Posted: Tue May 19, 2020 8:23 am
by seokgi
Hi. All
I am working with PIC18F47Q10.
However, the ADC does not work.
Did I make the wrong settings?
Thank you.
Re: PIC18F47Q10 ADC not working
Posted: Tue May 19, 2020 10:00 am
by Jay Dee
Hi,
I'm no expert but check for me would be..
Have you confirmed the PIC programs, responds and is at the correct clock rate by just running the flash test, I assume you have an LED on ouput D0?
Confirm you have your input signal connected to PIN 2 (AN0) of the PIC
Note, the UART is sending out a the value as a string of characters, rather than a single value. worth checking this is the output type you wanted.
J.
Re: PIC18F47Q10 ADC not working
Posted: Tue May 19, 2020 11:24 am
by seokgi
Connection is sure. The LED works well.
Thank you for your interest.
Re: PIC18F47Q10 ADC not working
Posted: Tue May 19, 2020 12:55 pm
by Benj
Hello,
Please can you provide more information on what is happening on the hardware. Is it locking up the processor when you call the sample routine or is it returning a static value?
Re: PIC18F47Q10 ADC not working
Posted: Wed May 20, 2020 12:49 am
by seokgi
I tested Microchip's 02-01924's MCU with 18F47Q10 and then tested it for sure. But it doesn't work.
Thank you.
Re: PIC18F47Q10 ADC not working
Posted: Wed May 20, 2020 1:43 am
by medelec35
seokgi wrote:then tested it for sure. But it doesn't work.
Ben is after more information than that.
For example if you apply full voltage on the ADC pin, what results do you get?
A value that stays fixed e.g 0 or a value that's drifting all over the place.
You need to be more specific of expected results verses actual results.
Re: PIC18F47Q10 ADC not working
Posted: Wed May 20, 2020 10:14 am
by seokgi
Thank you for your interest.
I tried applying the power voltage.
And I tried changing the value through resistor.
However, the result is always "0".
Of course, the FC8 simulation works fine.
Re: PIC18F47Q10 ADC not working
Posted: Thu May 21, 2020 3:02 pm
by Benj
Many thanks,
I've put together this test based on code from the device datasheet. Worryingly the provided code didn't initially compile but with a few tweaks it's now compiling ok.
Please can you have a go and let me know how you get on.
Re: PIC18F47Q10 ADC not working
Posted: Fri May 22, 2020 1:33 am
by seokgi
ADC works normally. Thank you.
Can I turn this into an icon?
But the reason I tested the ADC is that the touch sensor doesn't work.
Does the touch sensor work?
Re: PIC18F47Q10 ADC not working
Posted: Thu May 28, 2020 2:10 pm
by Lord Grezington
Hi Ben
I have the same problem with the 18F24Q10. I have got 5 ADC's (AN0,4,5,7 & 18) that dont seem to be working (but work fine in simulation). Is it possible for you to send an update for the Q10 parts so all the additional C-code is not needed?
Thanks
EDIT - additional note. When testing the PWM's on the 24Q10 Channel 1 and 2 dont work (but compiles fine). When I try channel 3 or 4 I get the compiller errors below: (Datasheet only says there are two CCP Channels)
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_PWM.c:180:1: error: (192) undefined identifier "CCP4CON"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_PWM.c:378:1: error: (192) undefined identifier "CCP4CON"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_PWM.c:509:1: error: (192) undefined identifier "CCPR4L"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_PWM.c

1: error: (192) undefined identifier "CCPR4L"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_PWM.c

17: error: (192) undefined identifier "CCP4CON"
Re: PIC18F47Q10 ADC not working
Posted: Tue Jun 02, 2020 9:49 am
by Steve
Thanks. We have been able to replicate your error and should be able to provide a fix soon.
Re: PIC18F47Q10 ADC not working
Posted: Tue Jun 02, 2020 10:13 am
by Lord Grezington
Thanks Steve
Re: PIC18F47Q10 ADC not working
Posted: Tue Jun 02, 2020 10:32 am
by Benj
Sorry it looks like the definition file may be wrong, there are only 2 CCP based PWM channels on this device. There are another 2 dedicated PWM channels so I'll see if I can get these working. Edit - this has now been done.
Regarding channels 1 and 2 not working. Please can you try enabling a timer interrupt on the same timer as the PWM is using and see if this gets the PWM started. If it does then this narrows down where I have to look.
I'll have another crack at the ADC component too now I know we have working code to play with.
Re: PIC18F47Q10 ADC not working
Posted: Tue Jun 02, 2020 11:19 am
by Lord Grezington
Thanks Ben, I will update and give it a go
Re: PIC18F47Q10 ADC not working
Posted: Tue Jun 02, 2020 5:04 pm
by Lord Grezington
Hi Ben
OK, so if I have a basic program and test with a blinker program (just for sanity check):
If I had a PWM macro on channel 1, enable it then add a loop with setting the duty cycle to 100 - Nothing happens
If I add a timer interrupt on timer 2 with the HFINTOSC source, 1/128 prescaler, 1-16 post scaler calling a blank maco, PWM does not work.
EDIT - When I disable the PWM and toggle an output using Timer2 interrupt it works fine
Have you had a chance to look at the ADC's?
Thanks
Re: PIC18F47Q10 ADC not working
Posted: Mon Jun 08, 2020 2:27 pm
by Lord Grezington
Hi ben
Sorry to bump, but I have new hardware coming in this week for this and I really need the PWM and ADC's working. Have you managed to find time to make any progress?
Thanks
Graham
Re: PIC18F47Q10 ADC not working
Posted: Tue Jun 09, 2020 12:33 pm
by Benj
Investigating for you now to see if I can get anywhere.
Edit - hopefully PWM issue is now resolved. I'll move onto the ADC now and see if I can get anywhere with this.
Re: PIC18F47Q10 ADC not working
Posted: Tue Jun 09, 2020 4:20 pm
by Lord Grezington
Hi Ben
I have just ran this on hardware, I have tried using multiple PWM channels and timers. Unfortunatly it still does not seem to work.
I ran the updates and restarted.
The PWM works in simulation
Thanks
Re: PIC18F47Q10 ADC not working
Posted: Wed Jun 10, 2020 8:55 am
by Lord Grezington
Hi Ben
If you send a program I will be happy to test and report my results.
The program I am using to test is attached.
Graham
Re: PIC18F47Q10 ADC not working
Posted: Thu Jun 11, 2020 10:25 am
by Lord Grezington
Morning Ben
Do you think you might have a chance to take a look at this today? The new assembled PCB's should be arriving any minute now and it would be good if I can complete the project this week.
Thanks
Re: PIC18F47Q10 ADC not working
Posted: Mon Jun 15, 2020 4:21 pm
by Benj
Hello,
Sorry been very busy with other things. I'll have another go at this for you today and post here if the update system is still having problems.
edit. please can you try adding this to the defines section of the supplementary code window via the project options.
#define MX_TIMERSELECT0
I just want to see if that helps at all with the PWM problem.
Re: PIC18F47Q10 ADC not working
Posted: Tue Jun 16, 2020 9:12 am
by Lord Grezington
Hi Ben
I have tested the "#define MX_TIMERSELECT0"
Unfortuntalty I still dont get anything when compiling on any of the PWM channels.
I measured all the pins just to be sure
UART still works fine
Thanks
Re: PIC18F47Q10 ADC not working
Posted: Wed Jun 17, 2020 2:15 pm
by Benj
Ok thanks,
I think I'll try and get a chip to play with. I'll have another go through the PWM code this afternoon to see if I can spot anything else. It's bound to be something really simple causing the problems.
Edit, just bought one of these hopefully it will be here tomorrow.
https://uk.farnell.com/microchip/dm1820 ... IC18F47Q10
Re: PIC18F47Q10 ADC not working
Posted: Wed Jun 17, 2020 4:56 pm
by Lord Grezington
Thanks Ben
Re: PIC18F47Q10 ADC not working
Posted: Thu Jun 18, 2020 4:00 pm
by Benj
Hello,
PWM now working just trying to push the latest fix to the update system and there's still a few kinks were working on here.
So for now you can use this file by copying it to this folder location "C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\PIC"
Copy the file and restart Flowcode and you should be good to go, I've tested both PWM types and this should fix all channels so they work. Let us know how you get on.
I'll look into the ADC issues next.