PIC18F47Q10 ADC not working

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

Moderator: Benj

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Contact:

PIC18F47Q10 ADC not working

Post by seokgi »

Hi. All
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 33 times

User avatar
Jay Dee
Posts: 397
Joined: Tue Aug 18, 2009 6:42 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post 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.

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Contact:

Re: PIC18F47Q10 ADC not working

Post by seokgi »

Connection is sure. The LED works well.
Thank you for your interest.

User avatar
Benj
Matrix Staff
Posts: 15014
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PIC18F47Q10 ADC not working

Post 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?

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Contact:

Re: PIC18F47Q10 ADC not working

Post 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.
Attachments
IMG_3387.jpg
IMG_3387.jpg (149.54 KiB) Viewed 1812 times
K-001.jpg
K-001.jpg (60.31 KiB) Viewed 1812 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9100
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: PIC18F47Q10 ADC not working

Post 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.
Martin

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Contact:

Re: PIC18F47Q10 ADC not working

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15014
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PIC18F47Q10 ADC not working

Post 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.
Shoes_Case-test2.fcfx
(11.03 KiB) Downloaded 47 times

seokgi
Posts: 164
Joined: Fri Jan 13, 2012 4:21 am
Location: South KOREA
Contact:

Re: PIC18F47Q10 ADC not working

Post 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?

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post 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:1198:1: error: (192) undefined identifier "CCPR4L"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_PWM.c:1200:17: error: (192) undefined identifier "CCP4CON"

User avatar
Steve
Matrix Staff
Posts: 3229
Joined: Tue Jan 03, 2006 3:59 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post by Steve »

Thanks. We have been able to replicate your error and should be able to provide a fix soon.

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post by Lord Grezington »

Thanks Steve

User avatar
Benj
Matrix Staff
Posts: 15014
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PIC18F47Q10 ADC not working

Post 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.

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post by Lord Grezington »

Thanks Ben, I will update and give it a go

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post 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

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post 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

User avatar
Benj
Matrix Staff
Posts: 15014
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PIC18F47Q10 ADC not working

Post 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.

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post 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

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post 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
Attachments
PWM & Analogue Test V1.3.fcfx
(20.38 KiB) Downloaded 26 times

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post 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

User avatar
Benj
Matrix Staff
Posts: 15014
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PIC18F47Q10 ADC not working

Post 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.

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post 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

User avatar
Benj
Matrix Staff
Posts: 15014
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PIC18F47Q10 ADC not working

Post 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

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Contact:

Re: PIC18F47Q10 ADC not working

Post by Lord Grezington »

Thanks Ben

User avatar
Benj
Matrix Staff
Posts: 15014
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: PIC18F47Q10 ADC not working

Post 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"

18F47Q10.fcdx
(46.12 KiB) Downloaded 28 times

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.

Post Reply