Flowcode v4 and Microchip Zigbee stack... How to compile ?

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

Post Reply
nbremond
Posts: 7
Joined: Wed Jun 08, 2011 12:51 pm
Has thanked: 3 times

Flowcode v4 and Microchip Zigbee stack... How to compile ?

Post by nbremond »

Hello,

I am currently developping a PIC 18F4620 based electronic board that will communicate with other similar boards using ZigBee.
The choice has been made to use the Microchip RF module (MRF24J40 based) that comes with a free Zigbee 2006 compliant stack written in C, and that can be compiled with the C18 compiler provided with MPLAB.

The rest of the application (management of the keyboard, LCD, relays, T° sensors, current measurements...) is developped with flowcode v4 and is commpiled with the BoostC compiler provided by Matrix. And unfortunatly, the ZigBee communication component provided with Flowcode is only compatible with Xbee that is based on AT commands, and does not provide the flexiblility of the Microchip stack. In addition, my hardware is not compatible with Xbee.

I was not successful to compile the whole application (ZigBee + flowcode part) because of differences in the compilers behaviors - incompatibility between compilers.

Please could you help me to find a way to compile the whole application?

Please note that the Flowcode part of the application has to call some functions of the ZigBee stack in order to have the ZigBee RF messages processed.... These call can be easely done with "C Code" boxes in flowcode. In addition, I suppose the "External Code" option in the project properties can be used to add the includes and the definitions required to call the microchip Zigbee stack.

Thanks in advance.
Bernard.

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: Flowcode v4 and Microchip Zigbee stack... How to compile

Post by Benj »

Hello Bernard,

Moving code from one compiler to another is called porting. This can be very difficult if you are not familiar with both types of compiler eg the Microchip compiler and the BoostC compiler.

I would advise switching to the XBEE modules as this will probably save you time in the long run. However if you must use the microchip modules then you will probably need to use a custom component to allow you to code the stack correctly.

Please see here for more information regarding creating custom components.
http://www.matrixmultimedia.com/Flowcode_Components.php

nbremond
Posts: 7
Joined: Wed Jun 08, 2011 12:51 pm
Has thanked: 3 times

Re: Flowcode v4 and Microchip Zigbee stack... How to compile

Post by nbremond »

Hello Benj,

Thanks a lot for your quick response. Ability to create a custom component is a very good capability of Flow code... and I'll use it if I can.
But the Microchip zigBee stack is a quite big piece of software, and it has been approved/qualified by the Zigbee alliance, and I'am not realy allowed (by the licence) to modify it. So a portage to BoostC is not realy an option. It is too bad that several ANSI C compiler are not compatible because of the addtions to the ANSI C language made to address hardware related capabilities...

What about compiling the flowcode generated C code using the C18 compiler provided with MPLAB ? Do you think it is feasible ? Maybee by updating the code of some components using the option to edit the code ?

Another option could be to compile the Microchip zigbee stack with C18, and the flowcode C code with BoostC and to link them togheter during the linkage phase... Do you think it is feasible ?
Or maybee to have 2 HEX files loaded at different addresses, but then, what about the flowcode calling some of the ZigBee stack functions ?

Best regards,
Bernard

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: Flowcode v4 and Microchip Zigbee stack... How to compile

Post by Benj »

Hi Bernard,

Well if you are not allowed to port across the code for the zigbee stack then it makes sense that you will have to port across the Flowcode code into MPLAB for use with the C18 compiler.

This should be fairly straight forward.

i.e.

Register names can normally be converted like this.

boostc - portb
C18 - PORTB

Here is code for bit toggling a register.

boostc - portb.RB0 = 1
C18 - PORTBbits.RB0 = 1;

Linking from two pre-compiled sources using two different compilers is not really feasible and I wouldn't even attempt to go down this road.

Regarding calls to the Zigbee stack this will all have to be done via C in the C18 compiler.

That is unless you can sanction a move to the supported XBEE modules.

nbremond
Posts: 7
Joined: Wed Jun 08, 2011 12:51 pm
Has thanked: 3 times

Re: Flowcode v4 and Microchip Zigbee stack... How to compile

Post by nbremond »

Thanks Benj for your quick response, and the examples of code.
Do you think changing the code for the components I use (with the "Edit code" in the contextual menu) is good enought, or is there any code automatically generated by Flowcode that needs to be changed, with no way for me to change it except by a kind of post processing ?

Changing the hardware now is not an option because it is already developped, and in addition, I think it is a good opportunity for Flowcode to support the Microchip zigbee stack to open a new field of applications (domotique, remote sensors, remote actuators...) .
Indeed the microchip zigbee solution is very cost and PCB real estate effective, the stack is free and the source code is available, and a prebuild RF module is available from microchip in order to simplify rapid prototyping.

My idea/need is to use flowcode as a C code generator for all my microchip based design, not only to support the eBlocs approach.
So far I have been successfull except for the implementation of complex, time based, interrupts in order to build a real time sequencer, and doing debug with my PICKit3 instead of the eBlock the ICD option seems to work with. Any idea ? Or maybee I'll open another topic on this later...

I just realized that Microchip claim to support Hi-tech C compiler for its ZigBee stack. I think I'll give it a try to see If I can compile the ZigBee stack this way (last time I tried I had error messages).
Then the FlowCode generated C should be able to compile with Hi-tech with no issue, isn't it ? What do you think ?

Thanks again.
Bernard

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: Flowcode v4 and Microchip Zigbee stack... How to compile

Post by Benj »

Hello,

Flowcode does support the HiTech compiler so as long as you are able to use this then you should be able to get everything working together.

nbremond
Posts: 7
Joined: Wed Jun 08, 2011 12:51 pm
Has thanked: 3 times

Re: Flowcode v4 and Microchip Zigbee stack... How to compile

Post by nbremond »

Thanks Ben, I'll let you know if I'am not successful with the Hi-Tech compiler, to try to find a workaround...
Best regards,
Bernard.

Post Reply