PIC18F47Q10 ADC not working
Moderator: Benj
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
PIC18F47Q10 ADC not working
Hi. All
I am working with PIC18F47Q10.
However, the ADC does not work.
Did I make the wrong settings?
Thank you.
I am working with PIC18F47Q10.
However, the ADC does not work.
Did I make the wrong settings?
Thank you.
- Attachments
-
- Shoes_Case-test2.fcfx
- (10.28 KiB) Downloaded 295 times
Re: PIC18F47Q10 ADC not working
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.
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.
- 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: PIC18F47Q10 ADC not working
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?
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?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Re: PIC18F47Q10 ADC not working
I tested Microchip's 02-01924's MCU with 18F47Q10 and then tested it for sure. But it doesn't work.
Thank you.
Thank you.
- Attachments
-
- IMG_3387.jpg (149.54 KiB) Viewed 21704 times
-
- K-001.jpg (60.31 KiB) Viewed 21704 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PIC18F47Q10 ADC not working
Ben is after more information than that.seokgi wrote:then tested it for sure. But it doesn't work.
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.
Martin
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Re: PIC18F47Q10 ADC not working
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.
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.
- 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: PIC18F47Q10 ADC not working
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
Re: PIC18F47Q10 ADC not working
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?
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?
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: PIC18F47Q10 ADC not working
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"
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
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_PWM.c
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
- 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: PIC18F47Q10 ADC not working
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: PIC18F47Q10 ADC not working
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
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
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: PIC18F47Q10 ADC not working
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
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
- 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: PIC18F47Q10 ADC not working
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.
Edit - hopefully PWM issue is now resolved. I'll move onto the ADC now and see if I can get anywhere with this.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: PIC18F47Q10 ADC not working
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
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
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: PIC18F47Q10 ADC not working
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
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
- Attachments
-
- PWM & Analogue Test V1.3.fcfx
- (20.38 KiB) Downloaded 297 times
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: PIC18F47Q10 ADC not working
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
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
- 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: PIC18F47Q10 ADC not working
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: PIC18F47Q10 ADC not working
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
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
- 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: PIC18F47Q10 ADC not working
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
- 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: PIC18F47Q10 ADC not working
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel