SPI

For general Flowcode discussion that does not belong in the other sections.
Post Reply
DAVIDJOINER
Posts: 140
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 18 times

SPI

Post by DAVIDJOINER »

Hi

Trying to interface to max22530 a/d converter

Having some problems as need to use in burst mode

ie i want to select register x01 and the unit will send back 16 bits

Tried to use spi master to get byte array to allow storing of the received data

But cannot seem to get the drop down box to accept the byte array in the component macro

Can you create me a small flowcode example of the SPI using get byte array

Ie send a command (ie register 01 ) and store the 2 received bytes into a byte array

I must be doing something wrong but cannot work it out

Many thanks in advance
David

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: SPI

Post by chipfryer27 »

Hi
But cannot seem to get the drop down box to accept the byte array in the component macro
It seems you only need to refer to the buffer name. Say you created buffer[2] as your byte array to hold 2 x bytes, in the component you would set

NumBytes = 2
Data = buffer

I don't have anything to test with though.

Regards

DAVIDJOINER
Posts: 140
Joined: Wed Dec 02, 2020 7:35 pm
Been thanked: 18 times

Re: SPI

Post by DAVIDJOINER »

Hi

Many thanks for quick response that has now solved that particular problem

Will now continue to next stage to try and read the 4 analogue channels in burst mode

Not sure if will be successful but will try and of course any further hints or advice is always welcome

Out of interest using a Mikroe Click 5 4 channel isolated A/D board Isolates >1000v which i need for my current Project


Thanks
David

chipfryer27
Valued Contributor
Posts: 1147
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 284 times
Been thanked: 412 times

Re: SPI

Post by chipfryer27 »

Hi

Glad to hear that part is solved.

Not seen the datasheet yet (busy this weekend) but guessing there will be a register per channel and it's maybe sending back 12 or 14 bits as two bytes? If so remember to AND the MSB to exclude any unwanted higher bits. Then you can combine MSB and LSB into your final integer value (e.g. value = (MSB<<8)+LSB).

If you get stuck or get funny results post your chart and I'm sure someone will assist.

Regards

Post Reply