Problem with compilation

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Problem with compilation

Post by alexander70 »

Hello! I am doing now 3.2.6 Lab 3 "Higher Resolution Sensor Readings Using a Single
Comparator" http://ww1.microchip.com/downloads/en/D ... 41381A.pdf (page 79) replacing the controller PIC16F690 to PIC16F877. The project does not compile to HEX file in Flowcode 4. Where I made a mistake?
Attachments
3.fcf
flowcode project
(12 KiB) Downloaded 343 times
Respectfully, Alexander

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Problem with compilation

Post by Steve »

Flowcode v4 problems need to be posted on the V4 forum. Please repost this question there.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Problem with compilation

Post by alexander70 »

Thanks, but I do not see the button "new topic" in this forum. Do you think the problem is in the program Flowcode4? I thought that maybe I was wrong somewhere. On Monday, I'll do this algorithm in the program Flowcode3, will see how to compile it.
Respectfully, Alexander

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: Problem with compilation

Post by Benj »

Hello Alexander

The very first topic in the Flowcode V4 forum explains how you can sign up to create posts.
http://www.matrixmultimedia.com/mmforum ... =29&t=6524

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Problem with compilation

Post by alexander70 »

OK, thank you.
Respectfully, Alexander

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Problem with compilation

Post by alexander70 »

Now I attached two flowcode 3 projects.
The original project for the 16F690 is compiled without problems.
Another project is a conversion for the 16F887 does not compile, probably somewhere an error in C code:

F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:8): error: unknown identifier 'TRISA5'
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:8): error: unexpected '.' operator
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:2): error: failed to generate expression
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:2): error: invalid operand 'trisa.TRISA5'
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:15): error: failed to generate expression
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:8): error: unknown identifier 'TRISA4'
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:8): error: unexpected '.' operator
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:2): error: failed to generate expression
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:2): error: invalid operand 'trisa.TRISA4'
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:15): error: failed to generate expression
16F887.c success

failure

Return code = 1

Flowcode was unable to compile the flowchart's C code due to the following errors:


If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.

FINISHED



Where I made a mistake?
Attachments
16F887.fcf
(5 KiB) Downloaded 295 times
16F690.fcf
(5 KiB) Downloaded 311 times
Respectfully, Alexander

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: Problem with compilation

Post by Benj »

Hello
Another project is a conversion for the 16F887 does not compile, probably somewhere an error in C code:

F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:8): error: unknown identifier 'TRISA5'
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:8): error: unexpected '.' operator
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:2): error: failed to generate expression
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:2): error: invalid operand 'trisa.TRISA5'
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(76:15): error: failed to generate expression
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:8): error: unknown identifier 'TRISA4'
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:8): error: unexpected '.' operator
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:2): error: failed to generate expression
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:2): error: invalid operand 'trisa.TRISA4'
F:\Microcintrollers\Flowcode projects\labs-flowecode3\6\3\16F887\16F887.c(78:15): error: failed to generate expression
The error messages are telling you that the problem is on lines 76 and 78 of your C code file. To see which lines of code are causing problems simply compile to C and then lookup the appropriate line in the C code file using a text editor such as textpad or context.

To fix the compilation error try replacing the lines.

trisa.TRISA5 = 0;

with this.

trisa.5 = 0;
or
clear_bit(trisa, 5);
or
trisa = trisa & 0xDF;

Similarily

trisa.TRISA4 = 0;

can be replaced with any of these.

trisa.4 = 0;
or
clear_bit(trisa, 4);
or
trisa = trisa & 0xEF;

Alternativly you could replace both lines of code with this single line.

trisa = trisa & 0xCF;

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Problem with compilation

Post by alexander70 »

Thank you, now it compiles, but the program still does not fully working. Although, the oscilloscope shows the presence of pulses on RA5 (C2OUT) 16F887, display does not work. Perhaps I am somewhere else was wrong, I will seek. It is necessary to verify C code for 16F887, not only the syntax
Attachments
16F887.fcf
(5 KiB) Downloaded 313 times
Respectfully, Alexander

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: Problem with compilation

Post by Benj »

Hello

Your timer interrupt seems to be configured to accept the external clock "T0CKI" rather then the "CLKO" internal clock. This could be why your program is not running as expected.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Problem with compilation

Post by alexander70 »

So in the manual about this program stated: T0CKI pin a digital input (external) (page 81 http://ww1.microchip.com/downloads/en/D ... 41381A.pdf )
Respectfully, Alexander

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: Problem with compilation

Post by Benj »

Hello

Ok you are driving the input for the T0CKI via a diode so this setting is correct. It could be that the comparitor pins have moved in the 887 device and you have to change the tris and data pins appropriatly in your program. Without sitting down and going through the tutorial it is hard for me to say.

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Problem with compilation

Post by alexander70 »

Thank you, I'll read more information:)
Respectfully, Alexander

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Problem with compilation

Post by alexander70 »

Hi! I want to ask, is possible to initialize TMR0 by Flowcode software, without inserting C code?
Respectfully, Alexander

alexander70
Posts: 79
Joined: Mon Aug 03, 2009 12:14 pm

Re: Problem with compilation

Post by alexander70 »

How to set the initial value for TMR0 (TMR1)? Conversely, how to transfer the accumulated value of TMR0 (TMR1) in another variable? This can be done in the program Flowcode?
Respectfully, Alexander

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: Problem with compilation

Post by Benj »

Hello

If you want direct access to the onboard peripheral registers via Flowcode then unfortunatley you must use C.

You simply have to use a capitalized version of the flowcode variable you wish to assign or you can use a constant.

Flowcode variable "out1" Becomes "FCV_OUT1" in C code.

Writing values to registers.

tmr0 = FCV_OUT1;
tmr0 = 24;

Reading registers into variables

FCV_IN1 = tmr0;

To get the correct register name for your device (eg tmr0, tmr0l) you can lookup the name in the device datasheet. Just keep the name lowercase and it should work in Flowcode.

Post Reply