byte access of array longs Question
Rick_H
Posts: 116
I want to parse through some longs to transmit to my VB application.
What would be a good loop structure for this?
I know this isn't right. I need to put each var in order into bytes to transmit to VB.net and then reassemble them into longs. The VB part is easy I just can't seam to get this straight into my head. if I reference Mandarin[0] will index5 be the lsb of mandarin[1]? or am I going about this all the wrong way?
What would be a good loop structure for this?
Var long flag3, mandarin[6], op1[5], op2[5], op3[5], op4[5], op5[5], op6[5] long dataout[256] pub Data | index 1, index2 repeat index1 from 144 to 0 dataout[index1] := mandarin[0].Byte[index1]
I know this isn't right. I need to put each var in order into bytes to transmit to VB.net and then reassemble them into longs. The VB part is easy I just can't seam to get this straight into my head. if I reference Mandarin[0] will index5 be the lsb of mandarin[1]? or am I going about this all the wrong way?
Comments
Yes, and no... your data read line needs to look like this... BYTE[@mandarin][index1] ... Index5 though would be ls-byte of mandarin[1] assuming that index5 would actually equate to a value of 4 ... remember 0 counts... so ...
BYTE[@mandarin][0] equals mandarin[0] byte 0
BYTE[@mandarin][1] equals mandarin[0] byte 1
BYTE[@mandarin][2] equals mandarin[0] byte 2
BYTE[@mandarin][3] equals mandarin[0] byte 3
BYTE[@mandarin][4] equals mandarin[1] byte 0
BYTE[@mandarin][5] equals mandarin[1] byte 1
BYTE[@mandarin][6] equals mandarin[1] byte 2
BYTE[@mandarin][7] equals mandarin[1] byte 3
might also want to change the dataout[256] declaration to byte rather than long.
ya sorry that was a typo, I wast more memory that way
i.e. LONG = [Byte3 Byte2 Byte1 Byte0]
the byte reference to the long is
Base Address+0 Byte0
Base Address+1 Byte1
Base Address+2 Byte2
Base Address+3 Byte3
in Big-Endian it would look like this
Base Address+0 Byte3
Base Address+1 Byte2
Base Address+2 Byte1
Base Address+3 Byte0