XC8 1.45 syntax error programming PIC18F47K40

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

Moderator: Benj

Post Reply
Vor503
Posts: 7
Joined: Tue Dec 08, 2020 9:58 am
Contact:

XC8 1.45 syntax error programming PIC18F47K40

Post by Vor503 »

Hello.
I hope someone could please help me.
Launching the Compiler / Linker, I'm experiencing the following error from the XC8 Compiler (version 1.45, free mode):


Target folder: C:\Users\ORS\Desktop\FLOWCODE
Source name: C:\Users\ORS\Desktop\FLOWCODE\CABLE_TESTER.fcfx
Title:
Description:
Device: PIC.18F.18F47K40
Generated by: Flowcode v8.2.2.15
Date: Monday, November 30, 2020 21:29:18
Users: 1
Registered to:
License key: *****
https://www.matrixtsl.com
Launching the compiler...
C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat 18F47K40 "C:\Users\ORS\Desktop\FLOWCODE\" "CABLE_TESTER"

C:\Users\ORS\Desktop\FLOWCODE>C:\PROGRA~4\Flowcode\Common\COMPIL~1\pic\batch\..\bin\xc8.exe --chip=18F47K40 "CABLE_TESTER.c" --MSGDISABLE=359,1273,1388 --FLOAT=32 --DOUBLE=32
Microchip MPLAB XC8 C Compiler (Free Mode) V1.45
Build date: Nov 15 2017
Part Support Version: 1.45
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration

. . . . . . . . . . . . . . . . . . . . . . . . .

using updated 32-bit floating-point libraries; improved accuracy might increase code size
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

CABLE_TESTER.as: 11546: (876) syntax error
CABLE_TESTER.as: 11550: (876) syntax error
CABLE_TESTER.as: 11554: (876) syntax error
(908) exit status = 1
(908) exit status = 1

Error returned from [xc8.exe]

C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat reported error code 1

Autoclose turned off


FINISHED



The C-Code lines the errors are related to, apparently do not have syntax error problem.

Trying compiling with 2.30 version of XC8, I got a different type of error:
error: (296) out of memory

The project should tests the continuity or the isolation between several Input / Output pins over a total of 24 different electrical cables, in order to confirm that the cable under test is correctly assembled and welded. The PIC commands some Multiplexers/Demultiplexers (CD4067) which feeds a positive +5 Volt to one Pin on the Input connector and connect the PIC ADC to one Pin on the Output connector of the electrical cable.

Since the program will be quite long, after adding a small amount of code, I try to compile the program in order to see if I've made some mistakes on the last code added.

If I delete any cable's macro (and the related "marco call"), it correctly get compiled so the issue would seem to be related to memory usage ..

But those errors came out after adding only a small amount of code and the used Program space in the previously correctly compiled program was only 38.6% so the issue shouldn't be related to the PIC's used memory.



Am I doing something wrong?
Many thanks in advance and best regards
Rov
Attachments
CABLE_TESTER.fcfx
(1.29 MiB) Downloaded 149 times

User avatar
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: XC8 1.45 syntax error programming PIC18F47K40

Post by Benj »

Hi Roy,

This takes a while to compile and then looking at the .as file some of the goto's are negative numbers which is very odd.

Code: Select all

l3165:
	line	-32434
	goto	l37554
	
l3166:
	line	-32365
	
l3167:
	goto	l3167
	line	-32364
It looks like there is a lot of similarity between all the CAVO macros. Maybe it would be better to have a single macro and then a switch statement based on a mode. This would be easier to maintain and hopefully should then compile correctly.

Your Test macro already does this to call all the individual macros but probably needs to do it a bit more like this to reuse code and save program memory space.
CABLE_TESTER_Simplified.fcfx
(79.38 KiB) Downloaded 137 times
I've converted the first two macros for you inside the Test macro. It might not be totally correct but hopefully it's a bit more managable this way. I also deleted the CAVA macros and confirmed that when they are gone the compilation error also goes away.

Vor503
Posts: 7
Joined: Tue Dec 08, 2020 9:58 am
Contact:

Re: XC8 1.45 syntax error programming PIC18F47K40

Post by Vor503 »

Hi Ben
many thanks for your time and effort.
It would be interesting to know why there are negative numbers in some goto instruction in the .as file since I don't think there was an error in my program

I'll try to follow what you suggested me but I don't understand the program's operation when there are lot of definition line related to the same variable inside the same calculation icon as you did (i.e. .NumTests = .NumTests + 1), so I have to find some informations.

Thanks again.
Rov

User avatar
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: XC8 1.45 syntax error programming PIC18F47K40

Post by Benj »

Hi Roy,

Rather then go off into a similar macro for each test I now do the test inside the test macro, the .NumTests = .NumTests + 1 command simply increments the value in the NumTests variable so we know how many steps are in the test.

Here is a snippet taken from one of your macros ported to the new script style

Code: Select all

.InputCon[.NumTests] = 2    //InputCon for Test1
.OutputCon[.NumTests] = 17    //OutputCon for Test1
.NumTests = .NumTests + 1
.InputCon[.NumTests] = 3    //InputCon for Test2
.OutputCon[.NumTests] = 3    //OutputCon for Test2
.NumTests = .NumTests + 1
.InputCon[.NumTests] = 3    //InputCon for Test3
.OutputCon[.NumTests] = 3    //OutputCon for Test3
.NumTests = .NumTests + 1
So test 1 would be
Test1.jpg
Test1.jpg (19.83 KiB) Viewed 2172 times
Test 2 would be
Test2.jpg
Test2.jpg (19.94 KiB) Viewed 2172 times
Etc.

Vor503
Posts: 7
Joined: Tue Dec 08, 2020 9:58 am
Contact:

Re: XC8 1.45 syntax error programming PIC18F47K40

Post by Vor503 »

Now is more clear.
In the next days, I'll try this method.
Many thanks

Rov

Post Reply