Bit from a Byte?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times

Bit from a Byte?

Post by DirkB »

How to? Just read a bit from a byte.

Thanks

Dirk

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Bit from a Byte?

Post by medelec35 »

Hi Dirk,

If you only want the result to be a 1 or 0 (E.g for bit 4 ) then I would use the format:
Bit = Byte & 16 - (16-1)

Or of course you can use Bit = Byte & 16 - 15
Just so long as the last value is 1 less of first number

You could use other formats:
E.g Hex: Bit = Byte & 0x10 - (0x10 -1)

Or Binary:
Bit = Byte & 0b10000 - (0b10000-1)

Hope this helps.

Martin
Martin

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times

Re: Bit from a Byte?

Post by DirkB »

Hi Matin,

cool, this works well!

Ok, how to: Combine a Byte 8 bit and a Byte 4 bit to a Byte with 12 bit word lenght.
8 bit word is lsb, 4 bit word is msb, and - later split them back to original word lenght.
Hope you understand my bad english :roll:

Thank you very much

Dirk

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Bit from a Byte?

Post by medelec35 »

Your welcome.

See if this helps you:
http://www.matrixmultimedia.com/mmforum ... 628#p33628

Martin
Martin

Post Reply