How to get a string from SPI Bus

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

Moderator: Benj

Post Reply
stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

How to get a string from SPI Bus

Post by stefan.erni »

I like to read 18 Byte from a SPi Bus
It looks easy....
Give number of byte and the name of the string..
But what is this" BYTE Ch "

GetString

Attempts to read a string of bytes from the SPI bus.
Parameters
BYTE NumBytes
BYTE Ch
Return value
STRING

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: How to get a string from SPI Bus

Post by Benj »

Hello,

Thanks for letting us know. I have edited the component and removed the additional parameter, this should have been a local variable instead.

The fixed SPI Master component should now be available via the Flowcode 8 update system.

Let us know how you get on.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: How to get a string from SPI Bus

Post by stefan.erni »

Hi Ben

If I use a byte array instead of a string it gives me an error
PIC32BIT_CAL_String.c:910:13: note: expected 'MX_STRING' but argument is of type 'volatile MX_CHAR *'
static void FCI_SCOPY(MX_STRING sSrc, MX_UINT16 iSrc_len, MX_STRING sDst, MX_UINT16 iDst_len)
If I choose a string then my data from reading spi are corrupted, maybe there are some 0 (0x00).

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: How to get a string from SPI Bus

Post by Benj »

Hello,

I have added some more macros to the SPI Master component to allow byte arrays to be sent and received. The byte arrays should correctly allow for any NULL values.

The new component should be available now via the update system.

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: How to get a string from SPI Bus

Post by stefan.erni »

Hi Ben

Thats working perfect now !

regards

Stefan

Post Reply