Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A weather station adds two rainfall readings stored in 8 bits: 01001011 and 00110110.
Add them in binary, and give the answer in binary and in denary.
Add binary in columns from the right: (write 0, carry 1) and (write 1, carry 1). An 8-bit register holds 0 to 255, so a total above 255 is an overflow. A logical shift of places left multiplies by , and right divides by ; bits shifted off the end are lost and 0s come in. In 8-bit two's complement the MSB is worth .
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Given. 01001011 and 00110110.
Plan. Add in columns from the right, then check in denary.
Step 1. The right-hand columns. . Then : write 0, carry 1.
Step 2. The middle columns. : write 0, carry 1. : write 0, carry 1. : write 0, carry 1. : write 0, carry 1.
Step 3. The left-hand columns. : write 0, carry 1. .
Step 4. Read the answer. 10000001, which is .
Check. 01001011 is 75 and 00110110 is 54. . The total is below 255, so there is no overflow.
Answer: 10000001, which is 129.
Log in to join the discussion.
Loading…