SPI on Flowcode

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

Moderators: Benj, Mods

Post Reply
Adrien DG
Posts: 15
Joined: Thu Jun 11, 2009 11:09 am

SPI on Flowcode

Post by Adrien DG »

Good Morning !!
First Excuse me for my english.

I'm working on a project, and I have to realize a communication between a PIC 16F877A and a CPLD in SPI transmission.
The problem is :
The CPLD send a binary code in 32 bits, but the PIC is a 8bits one.
How can I do to cut the 32 bits word in 4 8bits words with flowcode ?

I've already tried to do a "getchar" with the SPI block, but a char is not a word.
Help Me please, it's very important.

Regards
Adrien
Regards,
Adrien DG

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: SPI on Flowcode

Post by Benj »

Hello Adrien

A byte or char is 8-bits whereas a word is 4-bytes or 32-bits.

The GetChar macro will allow you to receive bytes so you could receive a byte at a time from the 32-bit source.

You could then keep all bytes seperate in Flowcode or you could use C to recombine them into a 32-bit number. Note that if you do this you will need to always reference the 32-bit number in C as Flowcode is unable to handle 32-bit numbers.

Here is the example C code to recombine the bytes stored in Flowcode variables byte0 - byte3.

unsigned long var32;
var32 = FCV_BYTE0;
var32 = var32 | (FCV_BYTE1 << 8);
var32 = var32 | (FCV_BYTE2 << 16);
var32 = var32 | (FCV_BYTE3 << 24);

Adrien DG
Posts: 15
Joined: Thu Jun 11, 2009 11:09 am

Re: SPI on Flowcode

Post by Adrien DG »

Oh, thank you,
I will try that !
I have to do an Ethernet communication, for the same project,
Can I do this with Flowcode ?

Regards,
Adrien
France
Regards,
Adrien DG

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: SPI on Flowcode

Post by Benj »

Hello

Yes Flowcode supports Ethernet via an I2C Wiznet module. This can be done using our EB023 Internet E-Block or using your own Wiznet module.

Adrien DG
Posts: 15
Joined: Thu Jun 11, 2009 11:09 am

Re: SPI on Flowcode

Post by Adrien DG »

The SPI communication runs as we expect !!
I can send and receive 32 bits words !!!
Thank you very much one more time !!!

Regards,
Adrien DG
Regards,
Adrien DG

Post Reply