Shop OBEX P1 Docs P2 Docs Learn Events
help with byte Array — Parallax Forums

help with byte Array

AnubisbotAnubisbot Posts: 112
edited 2009-04-30 11:30 in Propeller 1
Hi,

i try to figure out how i get
from a byte array 4 bytes what present a half of a 64 bit xbee adress into my long variable ?

Since my longs are also a array, i can not figure it out


XBAdress[noparse][[/noparse]0]. byte[noparse][[/noparse]0] := $00
XBAdress[noparse][[/noparse]0]. byte := $13
XBAdress[noparse][[/noparse]0]. byte := $A2
XBAdress[noparse][[/noparse]0]. byte := $00

Thas for the first half of the 64 bit adi, and the second should go into the XBAdress

Post Edited (Anubisbot) : 4/29/2009 11:04:37 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-29 23:10
    You have to use a space after the open bracket "[noparse][[/noparse]" or the forum software will use it for formatting.

    You could give each 32 bit part of the 64 bit address as a long constant like:

    XBAddress[noparse][[/noparse] 0 ] := $00A21300
    XBAddress[noparse][[/noparse] 1 ] := <something else>

    or you could give them as individual bytes like:

    XBAddress.byte[noparse][[/noparse] 0 ] := $00
    XBAddress.byte[noparse][[/noparse] 1 ] := $13
    XBAddress.byte[noparse][[/noparse] 2 ] := $A2
    XBAddress.byte[noparse][[/noparse] 3 ] := $00
    XBAddress.byte[noparse][[/noparse] 4 ] := <something else>
    XBAddress.byte[noparse][[/noparse] 5 ] := <something else>
    ... and so on ...
  • AnubisbotAnubisbot Posts: 112
    edited 2009-04-30 11:30
    Hi thanks mike,

    so when i get that right, i dont write it like this when i want to store more that 1 address :
    XBAddress[noparse][[/noparse] 3 ].byte[noparse][[/noparse] 0 ] := $00
    


    instead i need to calculate the start position of the long, and that would look like this i guess:
    XBAddress.byte[noparse][[/noparse] 8 ] := $00
    


    This should bring me to long nr 3 in my long array to store addresses.
Sign In or Register to comment.