Separate a byte into bits

picguate

New Member
Friends, I need your help regarding to separate a byte into bits, for example:

Let b1 = %11001100

I want to have the next result

bit0 have to be 0
bit1 have to be 0
bit2 have to be 1
bit3 have to be 1
bit4 have to be 0
bit5 have to be 0
bit6 have to be 1
bit7 have to be 1

Could somebody tell me how to do it.

Thanks in advance.
 

Dippy

Moderator
Check page 9 of the current on-line BASIC Manual.

You will see how b0 can be read exactly as you want into bit0 : bit7.

(and b1 => bit8: bit15)
 

lbenson

Senior Member
So in case there is any confusion, you get what you specified as the bit values by simply changing the result of your assignment to b0 (instead of b1):

Let b0 = %11001100
 

westaust55

Moderator
Have a look at my PIXACE memory map which pretty much covers the current range of PICAXE chips. See post 14 at thread: http://www.picaxeforum.co.uk/showthread.php?t=9525&page=2

This pictorially shows how the bits bytes and words are “connected” as well as other types of memory for each type of PICAXE. OWith larger programs, it can be useful to mark up with the SYMBOL names for each variable / memory location so you know where /how each variable or location is used.
 
Top