Page 1 of 1

Program compiles in V3 but not in V4

Posted: Wed Sep 23, 2009 9:18 pm
by Zane
Hi,

I have a program that will compile under version 3 of flowcode but when the same file is opened in version 4 it will not compile. The compiler generates the following messages
..........................................................................................................

C:\Users\Wine Cellar I2C PIC18F452.c(2494:33): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(2494:33): error: invalid operand '- 9'
C:\Users\Wine Cellar I2C PIC18F452.c(2494:31): error: failed to generate expression

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

C:\Users\Wine Cellar I2C PIC18F452.c(6772:18): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6772:18): error: invalid operand '- 128'
C:\Users\Wine Cellar I2C PIC18F452.c(6772:16): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6847:18): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6847:18): error: invalid operand '- 128'
C:\Users\Wine Cellar I2C PIC18F452.c(6847:16): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6922:18): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6922:18): error: invalid operand '- 128'
C:\Users\Wine Cellar I2C PIC18F452.c(6922:16): error: failed to generate expression

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

Wine Cellar I2C PIC18F452.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


Any help would be most welcomed.

Thanks

Re: Program compiles in V3 but not in V4

Posted: Thu Sep 24, 2009 7:20 am
by Steve
I've looked into this and it reveals a small bug in the coversion of Flowcode programs. I'm going to quickly explain how I found the errors so that others can debug their own programs if necessary...

There are essentially 4 errors shown by the compiler messages. For example, the first error is:

Code: Select all

C:\Users\Wine Cellar I2C PIC18F452.c(2494:33): error: failed to generate expression
And this indicates an error in line 2494 of the C file. The other errors are on lines 6772, 6847, and 6922.

Looking at the C code generated by Flowcode, we can see the problem line:

Code: Select all

2492	//Is the fraction less than negative .9
2493	//Decision: DisplayValueFraction < - 9?
2494	if (FCV_DISPLAYVALUEFRACTION < - 9)
2495	{
The problem is with the "- 9". This needs to be entered without the space between the "-" and the "9". The other 3 errors are a similar problem.

Now we need to find where in the Flowcode flowchart these problems are. To do this, scroll up through the C code file until you get to the start of the function containing the error. In this case, the error is in this function:

Code: Select all

void FCM_DisplayDataValues()
This is the "DisplayDataValues" macro. Now it should be relatively easy to find the problematic icon - you can see the icon and the fix in the attached image.

In a similar way, you need to find the other 3 errors within the flowchart. They are all in the <MenuTempSetup> macro.

The bug is that statements like "x = - 9" need to be written as "x = -9".

Re: Program compiles in V3 but not in V4

Posted: Thu Sep 24, 2009 9:19 am
by Zane
Hi Steve,

Thanks for your help, i will give your suggestion a try.