V4 compiling error

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

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

V4 compiling error

Postby nmindana » Thu Jan 13, 2011 9:21 pm

Dear All,

Whilst trying to programme and compile the following attached file, I am stuck with a compiler error, works fine on Simulation :!:
Please advice.


File name: D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.c
Generated by: Flowcode v4.3.7.63
Date: Thursday, January 13, 2011 21:47:37
Licence: Professional
Registered to: narayanaindana


http://www.matrixmultimedia.com


Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F88 "data logging can manipulate.c"
BoostC Optimizing C Compiler Version 6.95 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to FlowCode User under Single user Pro License for 1 node(s)
Limitations: PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited


data logging can manipulate.c
Starting preprocessor: C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\pp.exe "D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.c" -i C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\include -d _PIC16F88 -la -c2 -o "D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.pp" -v -d _BOOSTC -d _PIC16


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

D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.c(1714): error: missing right paren
D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.c(1714): error: error in 'if' expression
D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.c(1714): error: missing right paren
D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.c(1714): error: missing semicolon
D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.c(1714): error: missing right paren
D:\Documents and Settings\MURTHY.HOME\Desktop\data logging can manipulate.c(1258): error: failure

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
Attachments
data logging can manipulate.fcf
(34.39 KiB) Downloaded 105 times

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

Re: V4 compiling error

Postby medelec35 » Thu Jan 13, 2011 11:38 pm

Hi nmindana,
If you look in main of your flowchart and scroll down to decision: EEAddress < =90
There is a space between < and =. This is reason for failure. after removing space (shoud be <= ), should compile OK
If you look at:
viewtopic.php?f=26&t=6936
There is some information there on how to find the part of flowchart causing the error when line numbers are given.
These users thanked the author medelec35 for the post:
nmindana (Fri Jan 14, 2011 7:38 am)
Rating: 5.26%
 
Martin

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

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Fri Jan 14, 2011 7:40 am

What can I say, you are Brilliant 8)

Long live medelec35.

Can't thank you enough.

Regards

Indana

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

Re: V4 compiling error

Postby medelec35 » Fri Jan 14, 2011 8:38 am

Thank you for the kind words & feedback.
Just glad your flowchart is compiling for you now.
Martin

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

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Fri Jan 14, 2011 4:44 pm

Hi,

I am trying to a print "%" (percentage) symbol on the LCD without much success, can any help.

Indana

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

Re: V4 compiling error

Postby medelec35 » Fri Jan 14, 2011 5:44 pm

I have tried using standard LCD eblock EB-005, and % displays OK. I am assuming you are using the 'Print String' function?
Print%.jpg
Print%.jpg (42.14 KiB) Viewed 7107 times

If you have a different LCD, then can you place a link for LCD or datasheet. in the unlikely event your LCD does not have % stored within its memory, then a custom character can be made.
These users thanked the author medelec35 for the post:
nmindana (Sat Jan 15, 2011 10:49 pm)
Rating: 5.26%
 
Martin

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

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Sat Jan 15, 2011 10:50 pm

Thanks once again :D

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

Re: V4 compiling error

Postby medelec35 » Sat Jan 15, 2011 11:23 pm

Your welcome,
Once again lol.
Martin

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

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

EEPROM problem

Postby nmindana » Mon Jan 17, 2011 7:58 am

Hi,

The following programme is meant to time events and store it in EEPROM, upon press "read button" is meant to display the result as percentages.
It works fine on simulation, but returns "255" on hardware for a value of "0", can't understand why, please help !

I am using 16F88 chip, INTRC 8Mghz /LCD display / EB006 (programmer).
Attachments
data logging can manipulate.fcf
(37.1 KiB) Downloaded 112 times

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

Re: V4 compiling error

Postby medelec35 » Mon Jan 17, 2011 8:41 am

When using pic maths, you will need to multiply first to improve accuracy (so long as result does not exceed 32767). If not the following will happen:
E.g If Trigger=15 & Total=47.
result from simulator = (15/47)*100
= 0.31*100
= 31

Result on hardware
= (15/47)*100
=0*100
=0

as you can see the simulator rounds result of 1st calculation to 2 or 3 decimal places.
Microcontroller does not!
Try:
(Trigger*100)/Total
These users thanked the author medelec35 for the post:
nmindana (Mon Jan 17, 2011 1:23 pm)
Rating: 5.26%
 
Martin

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

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Mon Jan 17, 2011 1:27 pm

Hi medelac,

Tried your suggestion, still displays a value of 255, not sure if my erase macro is working well on PIC, works ok on simulation.
Please advice ? :cry:

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Mon Jan 17, 2011 1:29 pm

Hi when an event is not trigger it displays a value of 255 on lcd, it should be "0" ? works on simulation but something wrong with pic ?

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Mon Jan 17, 2011 6:05 pm

Hi, I am struggling to get EEprom work on 16F88, the attached programme works OK on simulation, but not on the hardware.
The LCD reads "255", instead of "0".

Viewing complied C, reveals the following error. Flowcode does not support eeprom for this device ? see below !

Please advice :cry:




//EEPROM(0): //Macro implementations


char FCD_EEPROM0_EEPROMRead(short addr)
{
char data = 0;

#ifdef _BOOSTC
#ifdef MX_EE
#ifndef MX_EEADR
#ifdef EEADR
#define MX_EEADR eeadr
#endif
#ifdef EEADRL
#define MX_EEADR eeadrl
#endif
#endif
#ifndef MX_EEDATA
#ifdef EEDATA
#define MX_EEDATA eedata
#endif
#ifdef EEDATAL
#define MX_EEDATA eedatal
#endif
#ifdef EEDATL
#define MX_EEDATA eedatl
#endif
#endif

#ifndef MX_EEADR //Catch Error
#ifdef _BOOSTC
#pragma error "EEPROM error - MX_EEADR not set"
#endif
#ifdef HI_TECH_C
#error EEPROM error - MX_EEADR not set
#endif
#endif

#ifndef MX_EEDATA
#ifdef _BOOSTC
#pragma error "EEPROM error - MX_EEDATA not set"
#endif
#ifdef HI_TECH_C
#error EEPROM error - MX_EEDATA not set
#endif
#endif

MX_EEADR = addr & 0xff;
#if (MX_EE_SIZE > 256)
eeadrh = (addr & 0xff00) >> 8;
#endif
#ifdef MX_EE_TYPE2
clear_bit(eecon1, EEPGD);
#endif
#ifdef MX_EE_TYPE3
clear_bit(eecon1, EEPGD);
clear_bit(eecon1, CFGS);
#endif
set_bit(eecon1, RD);
data = MX_EEDATA;
#else
#ifdef MX_EE_TYPE67X
#ifdef _BOOSTC
#pragma error "FlowCode does not support EEPROM for this device"
#endif
#ifdef HI_TECH_C
#error FlowCode does not support EEPROM for this device
#endif
#else
#ifdef MX_EE_TYPE62X

#ifdef _BOOSTC
#pragma error "FlowCode does not support EEPROM for this device"
#endif
#ifdef HI_TECH_C
#error FlowCode does not support EEPROM for this device
#endif
#else
#ifdef _BOOSTC
#pragma error "Chip does not have EEPROM memory"
#endif
#ifdef HI_TECH_C
#error Chip does not have EEPROM memory
#endif
#endif
#endif
#endif
#endif
#ifdef HI_TECH_C
data = eeprom_read(addr);
#endif

return (data);

}
Attachments
data logging can manipulate.fcf
(37.19 KiB) Downloaded 82 times

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

Re: V4 compiling error

Postby medelec35 » Mon Jan 17, 2011 10:17 pm

I believe all the code:

Code: Select all

//EEPROM(0): //Macro implementations


char FCD_EEPROM0_EEPROMRead(short addr)
{
      char data = 0;

      #ifdef _BOOSTC
         #ifdef MX_EE
            #ifndef MX_EEADR
               #ifdef EEADR
                  #define MX_EEADR eeadr
               #endif
               #ifdef EEADRL
                  #define MX_EEADR eeadrl
               #endif
            #endif
            #ifndef MX_EEDATA
               #ifdef EEDATA
                  #define MX_EEDATA eedata
               #endif
               #ifdef EEDATAL
                  #define MX_EEDATA eedatal
               #endif
               #ifdef EEDATL
                  #define MX_EEDATA eedatl
               #endif
            #endif

            #ifndef MX_EEADR   //Catch Error
               #ifdef _BOOSTC
                  #pragma error "EEPROM error - MX_EEADR not set"
               #endif
               #ifdef HI_TECH_C
                  #error EEPROM error - MX_EEADR not set
               #endif
            #endif

            #ifndef MX_EEDATA
               #ifdef _BOOSTC
                  #pragma error "EEPROM error - MX_EEDATA not set"
               #endif
               #ifdef HI_TECH_C
                  #error EEPROM error - MX_EEDATA not set
               #endif
            #endif

            MX_EEADR = addr & 0xff;
            #if (MX_EE_SIZE > 256)
               eeadrh = (addr & 0xff00) >> 8;
            #endif
            #ifdef MX_EE_TYPE2
               clear_bit(eecon1, EEPGD);
            #endif
            #ifdef MX_EE_TYPE3
               clear_bit(eecon1, EEPGD);
               clear_bit(eecon1, CFGS);
            #endif
            set_bit(eecon1, RD);
            data = MX_EEDATA;
         #else
            #ifdef MX_EE_TYPE67X
               #ifdef _BOOSTC
                  #pragma error "FlowCode does not support EEPROM for this device"
               #endif
               #ifdef HI_TECH_C
                  #error FlowCode does not support EEPROM for this device
               #endif
            #else
               #ifdef MX_EE_TYPE62X

                  #ifdef _BOOSTC
                     #pragma error "FlowCode does not support EEPROM for this device"
                  #endif
                  #ifdef HI_TECH_C
                     #error FlowCode does not support EEPROM for this device
                  #endif
               #else
                  #ifdef _BOOSTC
                     #pragma error "Chip does not have EEPROM memory"
                  #endif
                  #ifdef HI_TECH_C
                     #error Chip does not have EEPROM memory
                  #endif
               #endif
            #endif
         #endif
      #endif
      #ifdef HI_TECH_C
         data = eeprom_read(addr);
      #endif

      return (data);

}

applies to every flowchart that is compiled, and are just conditions for the components you use (only components that are not available to all target devices) so the compiler knows what to compile. If you use a PWM component, it will show similar FlowCode does not support warnings.
You can ignore these warnings, since your target has EEPROM, they do not apply to you.
These users thanked the author medelec35 for the post:
nmindana (Mon Jan 17, 2011 11:08 pm)
Rating: 5.26%
 
Martin

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

User avatar
Benj
Matrix Staff
Posts: 14576
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4603 times
Been thanked: 4241 times
Contact:

Re: V4 compiling error

Postby Benj » Tue Jan 18, 2011 10:11 am

Hello,

Could it be that the EEPROM is being erased when you re-program your device? The default state for EEPROM is to read back 255. If you do not want the EEPROM to be erased during programming then there is an option to turn off this functionality by clicking Chip -> Configure -> Options.

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Tue Jan 18, 2011 11:02 pm

Hi thanks for the reply.

The chip is initially reset before it is issued to the customer by pressing the Erase button.
This fills up the first half of eeprom data with byte "55" and the rest half to "0"

What the programme is meant to do is to record events to EEPROM on pressing trigger button in the first half, and once the read button is pressed data is read and displayed on the LCD. What is happening now is that if no events have happened it returns "255" instead of "0", although eeprom is initially reset as above. If there are triggered events it displays the correct value.
Attachments
data logging can manipulate.fcf
(37.67 KiB) Downloaded 67 times

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

Re: V4 compiling error

Postby medelec35 » Tue Jan 18, 2011 11:38 pm

First try this:
In your initialize macro, set variables to 0 that may not be read if conditions are not met e.g:
RESULT1 = 0
RESULT2 = 0
RESULT = 0
That may solve your problem?
I believe you are just reading initialised variables.

If this is not the case
It may be an idea to determine if problem is with Flowchart not reading or writing correctly to EEPROM, or just a problem with your calulations.
One way to check is:
Run hardware and press A1 button to erase chip.
Run PPPv3 (can be found in C:\Program Files\Matrix Multimedia\Flowcode V4\Tools\PPP)
Click 'View' menu then 'View PICmicro' ppp will then read chip.
You can then see all the contents of EEPROM, so you can check if all EEPROM location are set at correct values
For instance, I used a 18F4455. pressed switch A1. used ppp to read data. Got this:
EEPROM Contents.jpg
EEPROM Contents.jpg (90.01 KiB) Viewed 6995 times

As you can see, Quiet a few EEPROM locations are filled with 0x37 = 55 decimal. Also what you can't see are quiet a few locations are filled with 0's.
These users thanked the author medelec35 for the post:
nmindana (Wed Jan 19, 2011 12:40 pm)
Rating: 5.26%
 
Martin

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

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Wed Jan 19, 2011 9:15 am

Thanks medelec35,

Very clever idea, which I have not thought about, will have a look and let you know, how I got on.

regards

Indana

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: V4 compiling error

Postby nmindana » Wed Jan 19, 2011 10:44 am

Dear All,

Thank you for all your help. Flowcode is a brilliant piece of software.

I have sorted out my problem, problem with maths, just realised 0/0 is undefined value, which the PIC reads as 255.

Special thanks to medelec35 who ans every question posted, which is very helpful for novices like me. Phew it's been a steep
learning curve. Thanks to all the clever people behind flowcode.

regards

Indana
These users thanked the author nmindana for the post:
medelec35 (Wed Jan 19, 2011 12:12 pm)
Rating: 5.26%
 

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

Re: V4 compiling error

Postby medelec35 » Wed Jan 19, 2011 12:31 pm

Thats great! Glad you a managed to solve this one, well done.
nmindana wrote:
Special thanks to medelec35 who ans every question posted, which is very helpful for novices like me.

Your welcome and thanks. I don't always get it right, but glad when I do, especially I helped some one resolve their issue. :-)
nmindana wrote:
just realised 0/0 is undefined value, which the PIC reads as 255.
That is such an intresting and useful fact (I did not know that!), I Have used it here:
viewtopic.php?f=26&t=6936&p=16368#p16368
See, you will be helping others as well :-)
nmindana wrote:


Thanks to all the clever people behind flowcode.

I'm sure loads of users (my self included) agree with that!
These users thanked the author medelec35 for the post:
nmindana (Wed Jan 19, 2011 12:40 pm)
Rating: 5.26%
 
Martin

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