unable to compile

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

siliconchip
Posts: 248
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 74 times
Been thanked: 22 times
Contact:

unable to compile

Postby siliconchip » Thu Feb 13, 2020 6:16 pm

hi all,
im a flowcode 7 user am i right that when you press build in the toolbar then compiler options then the linker/assembler tab there should be something in my parameters box this is empty and im having trouble compiling known good programs

cheers bob

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8626
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2483 times
Been thanked: 3572 times
Contact:

Re: unable to compile

Postby medelec35 » Thu Feb 13, 2020 6:30 pm

Hi Bob,
Have you checked on Wiki page?
The images look wrong, but main writing looks correct.
Make sure you have the Default for PIC selected.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

siliconchip
Posts: 248
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 74 times
Been thanked: 22 times
Contact:

Re: unable to compile

Postby siliconchip » Thu Feb 13, 2020 6:36 pm

hi martin
in the supplementary code box im using #include <rand.h> i seem to recal ages ago i had to put something like srand in the linker/assembler as well ??

siliconchip
Posts: 248
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 74 times
Been thanked: 22 times
Contact:

Re: unable to compile

Postby siliconchip » Thu Feb 13, 2020 6:47 pm

also the default is empty for the linker/assembler parameter on the wiki, when checking my flowcode 6 the linker/assembler has writing in it and seems to work fine

cheers bob

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8626
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2483 times
Been thanked: 3572 times
Contact:

Re: unable to compile

Postby medelec35 » Thu Feb 13, 2020 7:42 pm

Hi Bob,
siliconchip wrote:when checking my flowcode 6 the linker/assembler has writing in it and seems to work fine

That correct.
Linker has got parameters for v6 and earlier, because the compiler was BoostC.
In v7 and later the compiler was changed to XC8, which does not use any linker parameters.
Try stating a new project with v7 , and compiling to hex without any code in supplementary code window.
Can you post uisng the forum Code icon compiler message of V7 flowchart that failed.
For example I have just done that:

Code: Select all

Target folder: D:\FC Testing
Source name:   D:\FC Testing\v7 blank.fcfx
Title:         
Description:   
Device:        PIC.16F.16F1828
Generated by:  Flowcode v7.2.1.4
Date:          Thursday, February 13, 2020 18:40:11
Users:         1
Registered to: Martin
Licence key:   BA48R5
http://www.matrixtsl.com
Launching the compiler...
D:\Flowcode 7\compilers\pic\bin\xc8.exe  --chip=16F1828 "v7 blank.c" --MSGDISABLE=359,1273,1388
Microchip MPLAB XC8 C Compiler (Free Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration

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


Memory Summary:
    Program space        used    28h (    40) of  1000h words   (  1.0%)
    Data space           used    1Bh (    27) of   100h bytes   ( 10.5%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    Data stack space     used     0h (     0) of    DCh bytes   (  0.0%)
    Configuration bits   used     2h (     2) of     2h words   (100.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)


You have compiled in FREE mode.
Using Omniscient Code Generation that is available in PRO mode,
you could have produced up to 60% smaller and 400% faster code.
See http://www.microchip.com/MPLABXCcompilers for more information.


Launching the linker/assembler...
D:\Flowcode 7\tools\DoNothing\DoNothing.exe 


FINISHED


If that works, retry the flowchart causing issues, without #include <rand.h> etc.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

siliconchip
Posts: 248
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 74 times
Been thanked: 22 times
Contact:

Re: unable to compile

Postby siliconchip » Thu Feb 13, 2020 8:41 pm

hi martin
not sure how to do what you asked but ive copied the text below,

Title:
Description:
Device: PIC.16F.16F1825
Generated by: Flowcode v7.3.0.5
Date: Thursday, February 13, 2020 19:33:25
Users: 1
Registered to: siliconchip
Licence key: X4H0GQ
http://www.matrixtsl.com
Launching the compiler...
D:\flowcode 7\compilers\pic\bin\xc8.exe --chip=16F1825 "16F1825 LOTTO REVAMP NO BATTS_v6 IS THIS IT.c" --MSGDISABLE=359,1273,1388
Microchip MPLAB XC8 C Compiler (Free Mode) V1.41
Build date: Jan 24 2017
Part Support Version: 1.41
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration

. .

16F1825 LOTTO REVAMP NO BATTS_v6 IS THIS IT.c:
229: #include <rand.h>
^ (141) can't open include file "rand.h": No such file or directory
(908) exit status = 1
(908) exit status = 1

D:\flowcode 7\compilers\pic\bin\xc8.exe reported error code 1



FINISHED


as for the supplementary code i was told to add this way back when i did this project as its a random number picker it worked fine a couple of years back now ive revisited i get the above message,if i remove the supplementary code will this stop the random element

cheers bob

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8626
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2483 times
Been thanked: 3572 times
Contact:

Re: unable to compile

Postby medelec35 » Thu Feb 13, 2020 9:28 pm

Hi Bob,
Reason for error is because rand.h is required for boostC (Flowcode V6 and below).
Should not be required for Flowcode V7 and above.
Remove from supplementary code then Should compile OK, assuming no more BoostC only coding?
These users thanked the author medelec35 for the post:
siliconchip (Thu Feb 13, 2020 9:34 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

siliconchip
Posts: 248
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 74 times
Been thanked: 22 times
Contact:

Re: unable to compile

Postby siliconchip » Thu Feb 13, 2020 9:34 pm

hi martin
i guess i will need to do as you say and remove the supplementary code but im sure ive compiled on flowcode 7 in the past and it worked and for some reason doesnt now when i get 5 mins i will check in hardware and let you know

cheers bob

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8626
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2483 times
Been thanked: 3572 times
Contact:

Re: unable to compile

Postby medelec35 » Thu Feb 13, 2020 9:57 pm

Hi Bob,
I have V6 and V7.
It won't compile to either because the Ccode

Code: Select all

srand(tmr01);
is wrong.
For V6 it should be

Code: Select all

srand(tmr0);

For V7 it should be

Code: Select all

srand(TMR0);

For future reverence.
To enable to work with V7 you need to use Ctrl + F (or Edit, Find/Replace)
In the Find enter tmr01, in the Replace with: enter TMR0
Then select replace all.
I will sort your flowchart out, and PM it back to you.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8626
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2483 times
Been thanked: 3572 times
Contact:

Re: unable to compile

Postby medelec35 » Thu Feb 13, 2020 10:18 pm

Hi Bob, I have sorted all the Ccode errors out.
You now have one serious issue.
There are several recursive function calls which are definitely not allowed by several compilers, one of which is XC8.
I would strongly recommend a state machine type flowchart.
The state will change for each required function call.
You can then use the Switch component (Icon just below decision branch) to call each function call depending on the state value.
I did that with a very complex touch screen heating controller with great success.
I will pm your flowchart back for you to look into state machine programming.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

siliconchip
Posts: 248
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 74 times
Been thanked: 22 times
Contact:

Re: unable to compile

Postby siliconchip » Thu Feb 13, 2020 10:27 pm

Hi Martin,
Thanks I messed with the tmr0 changing to tmr01 that was my fault originally it did work in flowcode 6 but I couldn't get it to work in 7 so started fiddling and forgot to revert back

Bob