v3 to v4 conversion problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
jimhumphries
Posts: 112
Joined: Wed Oct 12, 2005 6:29 pm
Location: USA
Been thanked: 1 time
Contact:

v3 to v4 conversion problem

Post by jimhumphries »

Steve/Ben:

I received and registered my v4 pro upgrade last week and this weekend I tried to convert one of my v3 files to v4. The v3 version runs on a 16F876 with about 400 bytes of program memory to spare. This version uses "thermometers" and a C code block for writing custom characters to the LCD RAM. I opened the v3 version in v4 and got the prompt to convert the thermometers to the new ADCs. I did that, deleted the old components, checked and corrected "Connections" and "Ext Properties" for all of the connected components (I love the new ADC conversion speed choices) and converted the custom character C code block to the new LCD macro write-to-ram format. When I tried to compile the revised flowcode to HEX (for the 16F876) I got a string of error messages and the code failed to compile.

Since I was close to the program memory limit for the original v3 code and 16F876 I changed the chip type to an 18F2525 (pin-for-pin compatible), saved and recompiled. This time the compile went OK and I noted that the amount of program memory used was 15010 bytes - about the same as (and not exceeding the program memory capacity) for the v3/16F876 version.

I've stared at the compiled files for the 18F and the C code for the 16F and I can't figure it out so I'm attaching .fcf and the .msg files for both the 16F and 18F compiles. I hope you guys can figure this out. I would have posted this to the v4 forum but I don't have posting privileges there yet.

I can't seem to get the 16F.msg file uploaded so here is the text:
========================================================================================================================================
File name: C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c
Generated by: Flowcode v4.0.0.53
Date: Sunday, August 02, 2009 12:55:01
Licence: Professional
Registered to: Jim Humphries Hanna/Humphries
http://www.matrixmultimedia.com
Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F876 "V4pumpt41ak16f4M.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
V4pumpt41ak16f4M.c
Starting preprocessor: "C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\pp.exe" "C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c" -i "C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\include" -d _PIC16F876 -la -c2 -o "C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.pp" -v -d _BOOSTC -d _PIC16
.....................................................................................................................................................................
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1431:23): error: unknown identifier 'ADCS2'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1431:23): error: invalid operand 'ADCS2'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1431:18): error: failed to generate expression
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1431:18): error: invalid operand '<<'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1431:12): error: failed to generate expression
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1624:23): error: unknown identifier 'ADCS2'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1624:23): error: invalid operand 'ADCS2'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1624:18): error: failed to generate expression
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1624:18): error: invalid operand '<<'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1624:12): error: failed to generate expression
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1817:23): error: unknown identifier 'ADCS2'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1817:23): error: invalid operand 'ADCS2'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1817:18): error: failed to generate expression
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1817:18): error: invalid operand '<<'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(1817:12): error: failed to generate expression
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(2010:23): error: unknown identifier 'ADCS2'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(2010:23): error: invalid operand 'ADCS2'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(2010:18): error: failed to generate expression
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(2010:18): error: invalid operand '<<'
C:\Documents and Settings\Jim Humphries\Desktop\pump current build\Pump Software\2009 files\4MHz files\Pump\v4 tests\V4pumpt41ak16f4M.c(2010:12): error: failed to generate expression
.....................................................................................
V4pumpt41ak16f4M.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
====================================================================================================================================
Regards,

Jim
V4pumpt41ak16f4M.fcf
(207.73 KiB) Downloaded 280 times
V4pumpt41ak18f4M.fcf
(208.08 KiB) Downloaded 268 times
[attachment=0]V4pumpt41ak18f4M.msg.txt
Attachments
V4pumpt41ak18f4M.msg.txt
(6.38 KiB) Downloaded 275 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: v3 to v4 conversion problem

Post by medelec35 »

Similar problems here:
http://www.matrixmultimedia.com/mmforum ... 60&p=14211

Could it be the ADC component?
Just a stab in the dark, have you used the updated files from here:
http://www.matrixmultimedia.com/mmforum ... =29&t=6573
Martin

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: v3 to v4 conversion problem

Post by Benj »

Hello

Ok the problem is that you have chosen a conversion speed that is uncompatible with your device. The 16F876 only has the following options available

FOSC/2
FOSC/8
FOSC/32
FRC

The 16F876A does have the extra conversion speed settings so this is why these setting are available for this target device.

Unfortunatley changing all the ADCs to use the FOSC/8 setting resulted in this.

ROM available:8192 words, used:8715 words (106.3%), free:-523 words (-6.-3%)
Too much code to fit in ROM, overfilled by:523 locations.

jimhumphries
Posts: 112
Joined: Wed Oct 12, 2005 6:29 pm
Location: USA
Been thanked: 1 time
Contact:

Re: v3 to v4 conversion problem

Post by jimhumphries »

Guys - thanks for the replies.

I missed the limited Fosc/ choice difference in the 16F87X data sheet. Since I intend to add FP math routines to my application it's time to add more program memory so I'll move to the 18F252 or the 18F2525.

Ben: Out of curiosity, why does v4 produce fatter compiled code than v3? I had about 400 bytes left in the 16F876 memory compiling the original Flowcode with v3 and have -1046 bytes left compiling with v4. That's a 1446 byte difference or about 9% of the total available program memory.

Jim

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: v3 to v4 conversion problem

Post by Benj »

Hello Jim

The ADC functions now contain code to generate strings and voltages which may explain the inflated code size. These functions however should not effect the size of the program unless you are specifically calling them.

Also now for every individual analogue channel you are using an individual hardware macro function to sample the channel. This allows for individual analogue channels to have different properties in the same program but does result in increased code size.

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

Re: v3 to v4 conversion problem

Post by Steve »

It may also be the linking of the "float.lib" library on the parameter list for the linker. You might be able to remove references to this file, but this may result in a compilation failure.

We'll look into this here and see if there is a way to make the code thinner.

jimhumphries
Posts: 112
Joined: Wed Oct 12, 2005 6:29 pm
Location: USA
Been thanked: 1 time
Contact:

Re: v3 to v4 conversion problem

Post by jimhumphries »

Ben/Steve:

I'm not too worried about it but I am curious to know what you find. I haven't yet been able to get a working v3 program, compiled under v4, to fully play on the 18F parts so I need to slog through this until I'm more fully familiar with the v3/v4 differences. I'm sure I'll have more questions.

Jim

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

Re: v3 to v4 conversion problem

Post by Steve »

Hi Jim,

If you want to send me your v3 program(s), I'll have a look at them here to see if I can see something obvious that is preventing them from running when imported to v4.

jimhumphries
Posts: 112
Joined: Wed Oct 12, 2005 6:29 pm
Location: USA
Been thanked: 1 time
Contact:

Re: v3 to v4 conversion problem

Post by jimhumphries »

Steve:

My problem seems to have been in setting the chip configuration bits. The PIC was resetting itself and I thought it was a software problem. I reconfigured the chip (18F252) to disable everything other than brownout and the v4 converted v3 code seemed to run fine. Remember that the v3 code fit within the 8K words available on the 16F part and that worked fine but the compiled v4 version wouldn't fit so I had to change chips and must not have configured the new chip correctly.

Jim

Post Reply