array help using .byte[1]
Zap-o
Posts: 452
Why wont this work ?
Where buffer is a long and tempvar is a byte. Count is a long, but just used to index my buffer
[b] tempvar := buffer [noparse][[/noparse] count ].byte [noparse][[/noparse] 2 ] [/b]
Where buffer is a long and tempvar is a byte. Count is a long, but just used to index my buffer
Comments
if buffer is an array of longs, just do:
tempvar := (buffer[noparse][[/noparse]count] & $00ff0000) >> 16
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit the home of pPropQL, pPropQL020 and OMU for the pPropQL/020 at omnibus.uni-freiburg.de/~rp92
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--Steve
Propalyzer: Propeller PC Logic Analyzer
http://forums.parallax.com/showthread.php?p=788230
Here is a way to define an array as a long and access the individual bytes without having to do any additional multiplying or shifting. The only drawback is that you need to define your variables in the DAT section.
This example lights the corresponding LEDs on the Propeller DemoBoard
...or, you can simplify the DAT section to something like this if you have a large array...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 5/22/2009 9:25:11 PM GMT