Word Sized constant in Byte array
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.
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 PUB MainProg L0 := %01100001_00110001_00011001_00001101 {     │ │ │ │ W1_highbyte │ W0_highbyte │ │ │ W1_lowbyte W0_lowbyte } dira[noparse][[/noparse]16..23]~~ repeat outa[noparse][[/noparse]16..23] := W0_lowbyte waitcnt(clkfreq*1+cnt) 'Wait 1 second outa[noparse][[/noparse]16..23] := W0_highbyte waitcnt(clkfreq*1+cnt) 'Wait 1 second outa[noparse][[/noparse]16..23] := W1_lowbyte waitcnt(clkfreq*1+cnt) 'Wait 1 second outa[noparse][[/noparse]16..23] := W1_highbyte waitcnt(clkfreq*1+cnt) 'Wait 1 second DAT L0 long W0 word W0_lowbyte byte 0 W0_highbyte byte 0 W1 word W1_lowbyte byte 0 W1_highbyte byte 0▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
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.