flowcode V4

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

Moderators: Benj, Mods

Post Reply
aerofrick
Posts: 23
Joined: Mon Mar 08, 2010 4:37 pm
Location: Slovenia
Contact:

flowcode V4

Post by aerofrick »

Hi

I was wondering haw is it with updating Flowcode from V4 to V4.2 or the latest V4.3? I just ordered Flowcode V4 and the store where I ordered it didn’t know haw this goes. Is the update free and if I can just download and pres update or is there something else I have to do?

Jan

User avatar
Steve
Matrix Staff
Posts: 3193
Joined: Tue Jan 03, 2006 3:59 pm
Contact:

Re: flowcode V4

Post by Steve »

Our usual policy is to charge 50% for major upgrades (e.g. V3 to V4) and offer the minor upgrades for free (e.g. v4.0 to v4.3).

The latest Flowcode update can be found in the downloads section of this page:
http://www.matrixmultimedia.com/Flowcode3a-X.php

aerofrick
Posts: 23
Joined: Mon Mar 08, 2010 4:37 pm
Location: Slovenia
Contact:

Re: flowcode V4

Post by aerofrick »

thanks for the info

jan

aerofrick
Posts: 23
Joined: Mon Mar 08, 2010 4:37 pm
Location: Slovenia
Contact:

Re: flowcode V4

Post by aerofrick »

Hi

I received the Flowcode V4 and updated it but when I tried to program my pic it didn't translate instead it turned errors (20-30 errors) and in the end it said:

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.

But the program contained just a loop and an output that was suppose to put ''1'' on the port A of pic 16f1937

I tried to use this pic because I need 3 PWM signals, 6 sensors attached to it and a couple of relay switches. I also need to make an rs232 communication between two pic devices and because I found it to be the cheapest one.

Any help appreciated


Jan

User avatar
Steve
Matrix Staff
Posts: 3193
Joined: Tue Jan 03, 2006 3:59 pm
Contact:

Re: flowcode V4

Post by Steve »

Please post your FCF file, the C file and the MSG.TXT file here and we'll try to sort this out for you.

aerofrick
Posts: 23
Joined: Mon Mar 08, 2010 4:37 pm
Location: Slovenia
Contact:

Re: flowcode V4

Post by aerofrick »

Hi
When I tried to translate it says
I left out the file name...


Launching the compiler...
C:\Program Files\HI-TECH Software\PICC\9.70\bin\picc.exe --CHIP=16F1937 -N48 Flowcode1.c
(100) unterminated #if[n][def] block from line 51
(1273) Omniscient Code Generation not available in Lite mode (warning)
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.70
Copyright (C) 2009 Microchip Technology Inc.
(908) exit status = 1

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




And this is the program translated in C

//************************************************************************************
//**
//** File name: C:\Users\administrator1\Desktop\flowcode test\Flowcode1.c
//** Generated by: Flowcode v4.3.7.63
//** Date: Tuesday, April 06, 2010 14:28:56
//** Licence: Professional
//** Registered to: Jan Bo?eglav
//**
//**
//** http://www.matrixmultimedia.com
//************************************************************************************


#define MX_PIC

//Defines for microcontroller
#define P16F1937
#define MX_EE
#define MX_EE_TYPE1
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_C
#define MX_SPI_SDI 4
#define MX_SPI_SDO 5
#define MX_SPI_SCK 3
#define MX_UART
#define MX_UART_C
#define MX_UART_TX 6
#define MX_UART_RX 7
#define MX_I2C
#define MX_MI2C
#define MX_I2C_C
#define MX_I2C_SDA 4
#define MX_I2C_SCL 3
#define MX_PWM
#define MX_PWM_CNT 2
#define MX_PWM_TRIS1 trisc
#define MX_PWM_1 2
#define MX_PWM_TRIS2 trisc
#define MX_PWM_2 1
#define MX_PWM_TRIS2a trisb
#define MX_PWM_2a 3

//Functions
#define MX_CLK_SPEED 19660800
#ifdef _BOOSTC
#include <system.h>
#endif
#ifdef HI_TECH_C
#include <pic.h>
#endif

//Configuration data

//Internal functions
#include "V:\programi\FCD\internals.h"

//Macro function declarations


//Variable declarations
char FCV_SWITCH;



//Macro implementations

void main()
{

//Initialisation
ansela = 0x00;
anselb = 0x00;
ansele = 0x00;


//Interrupt initialisation code
option_reg = 0xC0;


//Loop
//Loop: While 1
while (1)
{
//Input
//Input: A0 -> switch
trisa = trisa | 0x01;
FCV_SWITCH = ((porta & 0x01) == 0x01);


//Output
//Output: switch -> A2
trisa = trisa & 0xfb;
if (FCV_SWITCH)
porta = (porta & 0xfb) | 0x04;
else
porta = porta & 0xfb;


}


mainendloop: goto mainendloop;
}

void MX_INTERRUPT_MACRO(void)
{
}

Basically this program is running in a loop and it puts ''1'' on port A bit 2 when the switch connected to port A bit 0 is ''1'' It is just a test program but it made me realize that there is something wrong.
It used to turn up errors but i followed some advice at http://www.matrixmultimedia.com/mmforum ... 12&start=0

Jan

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: flowcode V4

Post by Benj »

Hello Jan,

Seems to be compiling ok for me.
Attachments
test_prog.fcf
(4 KiB) Downloaded 256 times

appocalypse
Posts: 5
Joined: Mon Jun 21, 2010 12:34 pm
Contact:

call stack usage???

Post by appocalypse »

Hi there :!:

Call Stack Usage Report
=======================
main and Task(s): hw used:4, exceeded by:0
interrupt: hw used:5, exceeded by:0
Serious Warning: Possible sw stack corruption, function 'FCM_filldata' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)
Memory Usage Report

Do u see whats going wrong :?:

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: flowcode V4

Post by Benj »

Hello,
Serious Warning: Possible sw stack corruption
This means that your software stack i.e. your return path to main from your macros may be corrupted due to a macro being called as part of the main loop and as part of an interrupt. If the two macros happen to be called at the same time. e.g. the macro in main is running when an interrupt occurs which runs the macro again. This can corrupt variables and can cause other unwanted problems such as stack corruption.

The macro that is causing the problem is reported as being called "filldata"

appocalypse
Posts: 5
Joined: Mon Jun 21, 2010 12:34 pm
Contact:

Re: flowcode V4

Post by appocalypse »

thnx 4 replyin ben.

plz do suggest a good way to get around this prob, em new to programmin :)

thanx

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: flowcode V4

Post by Benj »

Hello,

The best way to get around this problem is to call the function only from your main loop.

When the interrupt macro is triggered set a variable to equal 1.

In your main loop check the variable and if it is equal to 1 then call the macro. Remember to reset the variable to 0 after you have called the macro to ensure that the macro does not keep running on each iteration of your main program loop.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9008
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: flowcode V4

Post by medelec35 »

Benj wrote:Hello Jan,

Seems to be compiling ok for me.
Hello Ben.
Just out of curiosity I compiled to hex using Flowcode 4.3.7.63 and got the same as Jan.
Launching the compiler...

Code: Select all

C:\Program Files\Matrix Multimedia\Flowcode V4\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F1937 "test_prog.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


test_prog.c
Starting preprocessor: C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\pp.exe C:\Users\Martin\Documents\test_prog.c -i C:\PROGRA~1\MATRIX~1\FLOWCO~1\BoostC\include -d _PIC16F1937 -la -c2 -o C:\Users\Martin\Documents\test_prog.pp -v -d _BOOSTC -d _PIC16 


......

C:\Users\Martin\Documents\test_prog.c(72:2): error: unknown identifier 'ansela'
C:\Users\Martin\Documents\test_prog.c(72:2): error: invalid operand 'ansela'
C:\Users\Martin\Documents\test_prog.c(72:9): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(73:1): error: unknown identifier 'anselb'
C:\Users\Martin\Documents\test_prog.c(73:1): error: invalid operand 'anselb'
C:\Users\Martin\Documents\test_prog.c(73:8): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(74:1): error: unknown identifier 'ansele'
C:\Users\Martin\Documents\test_prog.c(74:1): error: invalid operand 'ansele'
C:\Users\Martin\Documents\test_prog.c(74:8): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(78:2): error: unknown identifier 'option_reg'
C:\Users\Martin\Documents\test_prog.c(78:2): error: invalid operand 'option_reg'
C:\Users\Martin\Documents\test_prog.c(78:13): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(87:2): error: unknown identifier 'trisa'
C:\Users\Martin\Documents\test_prog.c(87:2): error: invalid operand 'trisa'
C:\Users\Martin\Documents\test_prog.c(87:8): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(88:13): error: unknown identifier 'porta'
C:\Users\Martin\Documents\test_prog.c(88:13): error: invalid operand 'porta'
C:\Users\Martin\Documents\test_prog.c(88:19): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(88:19): error: invalid operand '& '
C:\Users\Martin\Documents\test_prog.c(88:27): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(88:27): error: invalid operand '=='
C:\Users\Martin\Documents\test_prog.c(88:9): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(97:2): error: unknown identifier 'trisa'
C:\Users\Martin\Documents\test_prog.c(97:2): error: invalid operand 'trisa'
C:\Users\Martin\Documents\test_prog.c(97:8): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(99:2): error: unknown identifier 'porta'
C:\Users\Martin\Documents\test_prog.c(99:2): error: invalid operand 'porta'
C:\Users\Martin\Documents\test_prog.c(99:8): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(99:2): error: error in the body of 'if' expression
C:\Users\Martin\Documents\test_prog.c(107:2): error: unknown identifier 'trisa'
C:\Users\Martin\Documents\test_prog.c(107:2): error: invalid operand 'trisa'
C:\Users\Martin\Documents\test_prog.c(107:8): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(109:2): error: unknown identifier 'porta'
C:\Users\Martin\Documents\test_prog.c(109:2): error: invalid operand 'porta'
C:\Users\Martin\Documents\test_prog.c(109:8): error: failed to generate expression
C:\Users\Martin\Documents\test_prog.c(109:2): error: error in the body of 'if' expression
test_prog.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
Is there a zip file with latest files in please? perhaps you have compiled with updated files on your PC, and ours just need updating?
Martin

User avatar
Steve
Matrix Staff
Posts: 3193
Joined: Tue Jan 03, 2006 3:59 pm
Contact:

Re: flowcode V4

Post by Steve »

I think the 16F19xx family of devices is currently only supported via the HITECH compiler, which is why it does not compile.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9008
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Re: flowcode V4

Post by medelec35 »

steve wrote:I think the 16F19xx family of devices is currently only supported via the HITECH compiler, which is why it does not compile.
Thanks steve. I forgot about 19xx uses Hitec. oops
Martin

appocalypse
Posts: 5
Joined: Mon Jun 21, 2010 12:34 pm
Contact:

Re: flowcode V4

Post by appocalypse »

what is the maximum array size limit if using 16F877A?

data1[96]
data2[96]
data3[95]
compiles ok!

data1[110]
data2[96]
compiles ok!

data1[110]
data2[110]
"doesn't compile".

appocalypse
Posts: 5
Joined: Mon Jun 21, 2010 12:34 pm
Contact:

Re: flowcode V4

Post by appocalypse »

how to go by a software stack instead of hardware.

User avatar
Benj
Matrix Staff
Posts: 14929
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: flowcode V4

Post by Benj »

Hello,

The maximum array size on a 16F device is 256 bytes. However when you say doesn't compile do you mean you get an error saying the device is out of memory or is something else going wrong?

The stack is responsible for keeping track of where the program has been eg each time it jumps to a subroutine or an interrupt it will have to store the return address so that it can return from the function correctly. Switching to a software stack simply gives you more scope for jumps without getting lost and not more memory. In fact there will be less memory available as you are using the memory to store the stack.

appocalypse
Posts: 5
Joined: Mon Jun 21, 2010 12:34 pm
Contact:

Re: flowcode V4

Post by appocalypse »

thanks for the helpful benj.
ill try in findin another way.

Post Reply