Word Sized constant in Byte array
DynamoBen
Posts: 366
I have several word sized constants that need to be place into a byte array which is subsequently sent via serial. For the life of me I can't figure out how to place both bytes into the array. I've tried bytemove, wordmove, constant.byte[noparse][[/noparse]x], but none of these seem to·work.
Can this be done? If so·how?
Can this be done? If so·how?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My new unsecure propmod both 1x1 and full size arriving soon.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My new unsecure propmod both 1x1 and full size arriving soon.
Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
Here is another "trick" that avoids using any shifting or math...
This demonstration uses the lights on the Propeller DEMO board.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
It isn't necessary to setup an entire variable array, you can just create one instance of a LONG defined in the DAT section like I have done...
...·From there, if you need to determon what each byte is of a particular LONG, you can do something like ...
... You can also use this method in reverse ...
· ... If you only wanted to affect the upper or lower WORD, then something like this would also work ...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 5/17/2009 3:46:58 PM GMT
The way it should also work with variables is:
You only have to take care of the alignment of the byte array.