Page 1 of 1

V4 compiling error

Posted: Thu Jan 13, 2011 9:21 pm
by nmindana
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

Re: V4 compiling error

Posted: Thu Jan 13, 2011 11:38 pm
by medelec35
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:
http://www.matrixmultimedia.com/mmforum ... =26&t=6936
There is some information there on how to find the part of flowchart causing the error when line numbers are given.

Re: V4 compiling error

Posted: Fri Jan 14, 2011 7:40 am
by nmindana
What can I say, you are Brilliant 8)

Long live medelec35.

Can't thank you enough.

Regards

Indana

Re: V4 compiling error

Posted: Fri Jan 14, 2011 8:38 am
by medelec35
Thank you for the kind words & feedback.
Just glad your flowchart is compiling for you now.

Re: V4 compiling error

Posted: Fri Jan 14, 2011 4:44 pm
by nmindana
Hi,

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

Indana

Re: V4 compiling error

Posted: Fri Jan 14, 2011 5:44 pm
by medelec35
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.13 KiB) Viewed 13547 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.

Re: V4 compiling error

Posted: Sat Jan 15, 2011 10:50 pm
by nmindana
Thanks once again :D

Re: V4 compiling error

Posted: Sat Jan 15, 2011 11:23 pm
by medelec35
Your welcome,
Once again lol.

EEPROM problem

Posted: Mon Jan 17, 2011 7:58 am
by nmindana
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).

Re: V4 compiling error

Posted: Mon Jan 17, 2011 8:41 am
by medelec35
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

Re: V4 compiling error

Posted: Mon Jan 17, 2011 1:27 pm
by nmindana
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:

Re: V4 compiling error

Posted: Mon Jan 17, 2011 1:29 pm
by nmindana
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 ?

Re: V4 compiling error

Posted: Mon Jan 17, 2011 6:05 pm
by nmindana
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);

}

Re: V4 compiling error

Posted: Mon Jan 17, 2011 10:17 pm
by medelec35
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.

Re: V4 compiling error

Posted: Tue Jan 18, 2011 10:11 am
by Benj
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.

Re: V4 compiling error

Posted: Tue Jan 18, 2011 11:02 pm
by nmindana
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.

Re: V4 compiling error

Posted: Tue Jan 18, 2011 11:38 pm
by medelec35
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 13435 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.

Re: V4 compiling error

Posted: Wed Jan 19, 2011 9:15 am
by nmindana
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

Re: V4 compiling error

Posted: Wed Jan 19, 2011 10:44 am
by nmindana
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

Re: V4 compiling error

Posted: Wed Jan 19, 2011 12:31 pm
by medelec35
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:
http://www.matrixmultimedia.com/mmforum ... 368#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!