Compile error msg from PIC16F15354 ADC

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Compile error msg from PIC16F15354 ADC

Post by jadiflow »

Hello,

I am trying to build an app on the PIC16F15354 using the build-in ADC. I'm not doing any customization, just using the standard build in component.
But I get compile errors as shown in the attachment. Is there something I missed?
FC7.

Edit: added ADC properties screen shot

Thanks,

Jan Didden
Linear Audio
Attachments
adc props.PNG
adc props.PNG (20.03 KiB) Viewed 12124 times
test1.fcfx
(10.53 KiB) Downloaded 114 times
adc error log.PNG
adc error log.PNG (150.75 KiB) Viewed 12126 times

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Compile error msg from PIC16F15354 ADC

Post by jadiflow »

Something I just thought of: do I have to explicitly set all the ADC related registers?
I assumed that the act off attaching the ADC base template top the project and setting the items in the Panel would be sufficient?
But since the error is 'unidentified identifier' it looks like the problem is in the PIC_CAL_ADC_ functions.

Jan Didden
Linear Audio

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: Compile error msg from PIC16F15354 ADC

Post by medelec35 »

Hi Jan,
I have hopefully fixed the issue for you
The PIC_CAL_ADC.c replaces the file within the

Code: Select all

 \Flowcode 7\CAL\PIC
folder.
The 16F15354.fcdx replaces the file within the

Code: Select all

\Flowcode 7\FCD\PIC
folder.
A few observations on your flowchart.
you have

Code: Select all

fServo_1 < 2.5 AND fServo_1 > -2.5 AND fServo_2 > 2.5 AND fServo_2 > -2.5
It should be && instead of AND as the first is logical and the latter is bitwise.
I would also consider using brackets e.g

Code: Select all

(fServo_1 < 2.5 ) && (fServo_1 > -2.5) && (fServo_2 > 2.5) && (fServo_2 > -2.5)
The ADC value does not go negative.
Instead of ReadingAsString then converting to floats, what about ReadAsVoltage as that will directly convert the voltage on the ADC pin directly to a float voltage value.
If you wish to simulate, I would recommend using one of the potentiometers that are available, instead of the ADC base.
Attachments
16F15354.fcdx
(34.78 KiB) Downloaded 124 times
PIC_CAL_ADC.c
(138.6 KiB) Downloaded 126 times
Martin

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Compile error msg from PIC16F15354 ADC

Post by jadiflow »

Martin, thank you very much for taking the time to review and fix this!
I had identified another similar PIC that did not have the issue (16F1788) but that one didn't have the AN inputs I used and I was facing the prospect to scrap a batch of boards that are underway from Far East. So you saved me money!

I will check this out and report if necessary. Understand the point on the AND and &&.
In the latest version I had indeed changed the ADC read to fVoltage and convert that to string for displaying.
The negative voltage comes from a software offset I still need to implement.

Thanks again, have a nice day!

Jan Didden
Linear Audio

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Compile error msg from PIC16F15354 ADC

Post by jadiflow »

Martin, I just checked this out with the PIC16F15354 and it works flawlessly now.
We might need to migrate to the PIC16F15356 at a later stage if we need more program space, not sure yet.
The fixes you made were specific to the 16F15354; would it not be possible to do a fix for the whole 16F153xx family?
Sooner or later someone else will run into this too.

Jan Didden
Linear Audio

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: Compile error msg from PIC16F15354 ADC

Post by medelec35 »

Hi Jan.
Thanks for letting me know the fix works.
jadiflow wrote:
Thu Dec 09, 2021 9:59 am
would it not be possible to do a fix for the whole 16F153xx family?
Unfortunately, V7 is no longer officially supported.
Therefore the rest of the 16F15xxx series will not be automatically updated.
jadiflow wrote:
Thu Dec 09, 2021 9:32 am
and convert that to string for displaying.
In Flowcode v9, I added a print float function for some LCD's, so no conversion is required.
Something to bear in mind if thinking about upgrading?
Martin

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Compile error msg from PIC16F15354 ADC

Post by jadiflow »

Yes, I should take a look at upgrading. It's just to find the time to invest to get to grips with the changes ...

Jan

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Compile error msg from PIC16F15354 ADC

Post by jadiflow »

Sorry to bother you again, but there seems to be more issues with that 16F153xx family.
I have a project that compiles error free with the 16F1788 (similar to the 15354 family) but when porting to the 15354 gives an error from the FP library:

Code: Select all

using updated 32-bit floating-point libraries; improved accuracy might increase code size
0: (1347) can't find 0x1F words (0x1f withtotal) for psect "text25" in class "CODE" (largest unused contiguous range 0x16)
updated 32-bit floating-point routines might trigger "can't find space" messages appearing after updating to this release; consider using the smaller 24-bit floating-point types
0: (1347) can't find 0x1F words (0x1f withtotal) for psect "text28" in class "CODE" (largest unused contiguous range 0x16)
0: (1347) can't find 0x1D words (0x1d withtotal) for psect "text24" in class "CODE" (largest unused contiguous range 0x16)
0: (1347) can't find 0x1B words (0x1b withtotal) for psect "text1" in class "CODE" (largest unused contiguous range 0x16)
0: (1347) can't find 0x18 words (0x18 withtotal) for psect "idataBANK1" in class "CODE" (largest unused contiguous range 0x16)
0: (1347) can't find 0xE words (0xe withtotal) for psect "text21" in class "CODE" (largest unused contiguous range 0x4)
0: (1347) can't find 0xE words (0xe withtotal) for psect "text26" in class "CODE" (largest unused contiguous range 0x4)
0: (1347) can't find 0x9 words (0x9 withtotal) for psect "text10" in class "CODE" (largest unused contiguous range 0x4)
0: (1347) can't find 0x6 words (0x6 withtotal) for psect "inittext" in class "CODE" (largest unused contiguous range 0x4)
0: (1347) can't find 0x6 words (0x6 withtotal) for psect "clrtext" in class "CODE" (largest unused contiguous range 0x4)
(908) exit status = 1
(908) exit status = 1

C:\Program Files (x86)\Flowcode 7\compilers\pic\bin\xc8.exe reported error code 1
When I strip down the project to just a few routines, so it gets shorter, the error disappears. When I port to the 16F15356, which has double the mem size of the 15354, the error also disappears; but then I get the original error that prompted this report, with the ADC, that you fixed in the 15354.
Also, looking at the error report, it *seems* to me that the issue is not absolute mem space but rather the partitioning and allocation, as the 'can't find' numbers are quite small.

So it seems my options are:

- go back to 24 bit float operations, which seems like a step backwards;
- go back to the 16F1788 and scrap a batch PCBs;
- go with the 16F15356, but then that should be fixed for the ADC stuff just as was done for the 16F15354;
- or another I didn't think of.

Can you help please?

Jan

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: Compile error msg from PIC16F15354 ADC

Post by kersing »

Hi Jan,

You are running out of memory which is not uncommon when using floating point as those libraries are relatively large. If there isn’t any code you can remove the ADC fix for the larger (memory wise) device is probably the only real solution. Sounds like a job for @Benj if FC7 is still being maintained…
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

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: Compile error msg from PIC16F15354 ADC

Post by medelec35 »

Hi Jan.
jadiflow wrote:
Sun Dec 12, 2021 11:03 am
go with the 16F15356, but then that should be fixed for the ADC stuff just as was done for the 16F15354;
I have fixed the 16F15356.
I will send you a PM about it.
Attachments
16F15356.fcdx
(34.78 KiB) Downloaded 116 times
Martin

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: Compile error msg from PIC16F15354 ADC

Post by jadiflow »

Yes that fixed it, no more memory or ADC errors!

Muchas Gracias.

Jan

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: Compile error msg from PIC16F15354 ADC

Post by medelec35 »

You're welcome.
I'm glad you are now sorted.
Thanks for letting us know.
Martin

Post Reply