Page 1 of 1

Problem with compilation

Posted: Fri Oct 02, 2009 4:01 am
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?

Re: Problem with compilation

Posted: Fri Oct 02, 2009 7:52 am
by Steve
Flowcode v4 problems need to be posted on the V4 forum. Please repost this question there.

Re: Problem with compilation

Posted: Fri Oct 02, 2009 8:27 am
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.

Re: Problem with compilation

Posted: Fri Oct 02, 2009 8:47 am
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

Re: Problem with compilation

Posted: Fri Oct 02, 2009 9:21 am
by alexander70
OK, thank you.

Re: Problem with compilation

Posted: Tue Oct 06, 2009 12:08 pm
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?

Re: Problem with compilation

Posted: Tue Oct 06, 2009 12:22 pm
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;

Re: Problem with compilation

Posted: Tue Oct 06, 2009 1:07 pm
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

Re: Problem with compilation

Posted: Tue Oct 06, 2009 1:55 pm
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.

Re: Problem with compilation

Posted: Tue Oct 06, 2009 2:38 pm
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 )

Re: Problem with compilation

Posted: Tue Oct 06, 2009 3:35 pm
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.

Re: Problem with compilation

Posted: Tue Oct 06, 2009 3:48 pm
by alexander70
Thank you, I'll read more information:)

Re: Problem with compilation

Posted: Wed Oct 07, 2009 12:09 pm
by alexander70
Hi! I want to ask, is possible to initialize TMR0 by Flowcode software, without inserting C code?

Re: Problem with compilation

Posted: Wed Oct 07, 2009 12:25 pm
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?

Re: Problem with compilation

Posted: Wed Oct 07, 2009 12:55 pm
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.