pins = msb + lsb

tim griff

Member
Hi,
I'm trying to output pins = b3
This is made up of two seperate variables ( b1 and b2).
If b1= 4 and b2 = 5 then what I'm trying to output in b3 is 01000101..
In effect putting b1 in the high order position and b2 in the low order position.

This are sent sent to two bcd to 7 segment displays

I'm struggling to get my head around this; any thought please.
Tim
 

jodicalhon

New Member
If b1 and b2 are going to be no larger than 16 (4 bits) you could just leave b2 where it is and multiply b1 by 16. Then add them together.
 

tim griff

Member
Hi both,
Many thanks .. both answers work well. Yes the count will only go up to 10 on either variable.

I started adding 16 then 48 then 32... and got mixed up.

Many thanks for you help
Regards
Tim
 
Top