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
SPI on Flowcode
- 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
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 <<
;
var32 = var32 | (FCV_BYTE2 << 16);
var32 = var32 | (FCV_BYTE3 << 24);
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 <<

var32 = var32 | (FCV_BYTE2 << 16);
var32 = var32 | (FCV_BYTE3 << 24);
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: SPI on Flowcode
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
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
Adrien DG
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: SPI on Flowcode
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
I can send and receive 32 bits words !!!
Thank you very much one more time !!!
Regards,
Adrien DG
Regards,
Adrien DG
Adrien DG