Page 1 of 1

SPI

Posted: Sat Jun 24, 2023 12:05 am
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

Re: SPI

Posted: Sat Jun 24, 2023 9:23 am
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

Re: SPI

Posted: Sat Jun 24, 2023 1:26 pm
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

Re: SPI

Posted: Sat Jun 24, 2023 9:21 pm
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