How do I convert from a 4 bit number such as x = 0110
to an 8 bit number such as x = 00100110
Do I:
-----0110
00001111 And
---------
00000110
00000110
00100000 OR
---------
00100110 Result
Thanks, Don
How do I convert from a 4 bit number such as x = 0110
to an 8 bit number such as x = 00100110
Do I:
-----0110
00001111 And
---------
00000110
00000110
00100000 OR
---------
00100110 Result
Thanks, Don
Last edited by dbachman; - 24th February 2009 at 05:48.
4 bit number . . . you trying to convert code from Stamp?
x = 0110 is I believe the same as x = 00000110 and same as 6 and same as $06. There are no nibble variables in PBP you have to use the whole byte. So MyVar Var NIB becomes MyVar VAR BYTE.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi Joe,
So....
Data @0 , 6
read 0, x
Would the variable x be equal to 00000110b
so then to make it 00100110 I would OR it with 00100000?
Thanks, Don
http://en.wikipedia.org/wiki/Bitwise_operation
I am not a MATH Guy, but I believe in the example you listed, a bitwise OR would do that. Here is a link with some info. Or cannot you just add the 32 to six ?
Last edited by Archangel; - 24th February 2009 at 06:35.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
with PBP, 4 Bit number don't exist. I know STAMPs have Nibble variable, but not in PBP. You have Bit, BYTE, and WORD. So you could use OR or just directly set the bit you want
ByteA = %110
ByteA.5=1
should do the trick as well.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks