SEND RECEIVE ARRAY accuracy check

Camerart

Member
Hi,
I'm learning ARRAYS, in my case I'm sending using SPI.

I have tried lots of different ideas, and am figuring out that each BYTE, is sent anonymously, so must be labelled correctly by the receiver e,g 1st = 1st and so on. Is this correct?

I have a send(10) BYTE ARRAY, and a receive(10) BYTE ARRAY. This is working fine as '1' goes in '1' and so on, but I can see there may be errors later if I'm not sure what happening.

I'm wondering if a start and stop BYTE could be sent, so that receive knows when to start counting and when to stop. Is this normal, or a good idea?
Cheers, Camerart.
 

Cromewell

Administrator
Staff member
Usually you will send a content length type message to know how many bytes are expected.
 

Cromewell

Administrator
Staff member
Yes, basically. Some kind of fixed size message to indicate the size of whatever is following. Then the variable sized thing that you now know how much to read.
 

Camerart

Member
Hi,
I've been reminded of LEN(), can someone explain how this would work with a list of BYTES, so that they are read in sequence, please?
C
 

Camerart

Member
Hi,
With help, I've now done it, using LEN() to find the length of the array, then Midstring to extract each byte.
Thanks, C
 
Top