# binary code?

Discussion in 'OT Technology' started by Renz, Jan 19, 2003.

1. ### RenzGuest

where is a good place to go and learn about binary code. i'm taking cisco 2 and i was reading the book earlier and the book confused the hell out of me. i didnt understand it at all. so i wanted to see if any of you guru's new of a place that i could go and learn binary code or a place that explains it at a begginers level.

thanks in advance for any help or links..

2. ### DommiGuest

binary for purposes of cisco...

1 2 4 8 16 32 64 128

now if you have a value of
01010101

your true value would be
0+2+0+8+0+32+128
or 170

if you had a value of
10101010

it would be
1+0+4+16+0+64+0
or 85

4. ### CyberBulletsI reach to the sky, and call out your name. If I c

Joined:
Nov 13, 2001
Messages:
11,865
Likes Received:
0
Location:
BC, Canada/Stockholm, Sweden

as an ex cisco student, you have ur binary backwards

128, 64, 32, 16, 8, 4, 2, 1

so 10101010 =
128 + 0 + 64 + 0 + 16 + 0 + 4 + 2 + 0
=214

5. ### D1G1T4LActive Member

Joined:
May 4, 2001
Messages:
16,489
Likes Received:
0
Location:
Bay Area

6. ### D1G1T4LActive Member

Joined:
May 4, 2001
Messages:
16,489
Likes Received:
0
Location:
Bay Area
actually isn't it

10101010 =
128 + 0 + 32 + 0 + 8 + 0 + 2 + 0 = 170

7. ### D1G1T4LActive Member

Joined:
May 4, 2001
Messages:
16,489
Likes Received:
0
Location:
Bay Area
01010101
=
0 + 64 + 0 + 16 + 0 + 4 + 0 + 1 = 85

10101010
=
128 + 0 + 32 + 0 + 8 + 0 + 2 + 0 = 170

8. ### KabukoGuest

It actually surprises me how many students get to college without ever having learned number bases, I seem to remember learning it in grade school, doing a brief review in middle school, and the same in high school. It's part of the fundamentals of counting. (Not trying to put you down or anything, I think you're by far in the majority, it just always surprises me).

9. ### CyberBulletsI reach to the sky, and call out your name. If I c

Joined:
Nov 13, 2001
Messages:
11,865
Likes Received:
0
Location:
BC, Canada/Stockholm, Sweden
my bad...

but if u wanna convert binary to hex (like for IPX/SPX, etc)

use it in groups of 4.

11111111b = 256d

1111 1111b
11111111b = FFh

01000000b = 64d

0100 0000b
01000000b = 40h

10. ### RenzGuest

uuummm thanks that is pretty much how the book explained it and i didnt understand it neither.

i'll try how stuff works and see if they can explain it more clearly with less tech talk. I need it explained to me as a begginer. thanks for all the help though guys..

Renz

11. ### 5Gen_PreludeThere might not be an "I" in the word "Team", but

Joined:
Mar 14, 2000
Messages:
14,519
Likes Received:
1
Location:
Vancouver, BC, CANADA
How much more basic can you get BTW?

I mean:

4789 =

4 * 1000 + 7 * 100 + 8 * 10 + 9

Thats base 10

With base 2, it's the same thing except that instead of having 10 digits to select from, you only have 2 (0 and 1). Each place digit value regardless of whether it's base 2 or base 10 or base 8, is always set up the same:

Code:
```4789 = (4 * 10^3) + (7 * 10^2) + (8 * 10^1) + (9 * 10^0)
4789 = (4 * 1000) + (7 * 100)  + (8 * 10)   + (9 * 1)
4789 =    4000    +    700     +     80     +     9
```
Notice that you multiply the digit by the base number raised to the power of the position.

so:

Code:
```
101010 = (1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0)
101010 = (1 * 32)  + (0 * 16)  +  (1 * 8)  + (0 * 4)   + (1 * 2)   + (0 * 1)
101010 =    32     +    0      +     8     +    0      +    2      +     0
101010 = 42

```

12. ### RenzGuest

so far you have explained it to me the best....

but what is the answer then for

code:--------------------------------------------------------------------------------
4789 = (4 * 10^3) + (7 * 10^2) + (8 * 10^1) + (9 * 10^0)
4789 = (4 * 1000) + (7 * 100) + (8 * 10) + (9 * 1)
4789 = 4000 + 700 + 80 + 9
--------------------------------------------------------------------------------

in each? what is the 0101010 # for 4789 in each? that is what i dont get.
i understand that you multiply each and get the #. now how do i change 4000, 700, 80, and 9 into 1's and 0's?
that is what i dont understand

13. ### fobMember

Joined:
Oct 26, 2000
Messages:
219
Likes Received:
0
Location:
Orange County, CA
Lets say you have 8 bits _ _ _ _ _ _ _ _

the highest value you can represent is 2^8 - 1 = 256 - 1 = 255

Starting from the RIGHT and working to the LEFT you will represent each bit as follows:

2^0 then 2^1 then 2^2 ..... until you get to 2^7 respectively (LEFT to RIGHT):

128 64 32 16 8 4 2 1

Lets say you are given the number 225, first thing you need to ask yourself is if the far left bit (128) will divide into 225. If the answer is yes then you set that bit to 1, if no then set it to 0. Our answer is yes, so we now have: 1 _ _ _ _ _ _ _

We have taken away 128 from 225 (225 - 128 = 97) leaving us with 97. Now ask yourself if the next bit (64) will divide into 97 and the answer is yes. Now set that bit to 1: 1 1 _ _ _ _ _ _

97 - 64 = 33, see if the next bit (32) will divide into 33, yes it does so we now get: 1 1 1 _ _ _ _ _

33 - 32 = 1, obviously 1 will not be able to fit into anything except the far RIGHT bit so we set everything accordingly: 1 1 1 0 0 0 0 1

As you follow these directions, write it on paper, that way you can visualize a little bit better. If you are still unable to understand, I will gladly write my train-of-thought on paper and scan it.

14. ### fobMember

Joined:
Oct 26, 2000
Messages:
219
Likes Received:
0
Location:
Orange County, CA
4789 would require 13 bits: _ _ _ _ _ _ _ _ _ _ _ _ _

4096 2048 1024 512 256 128 64 32 16 8 4 2 1

Does 4096 divide into 4789? YES! 1 _ _ _ _ _ _ _ _ _ _ _ _
4789 - 4096 = 693

Does 2048 divide into 693? NO! 1 0 _ _ _ _ _ _ _ _ _ _ _

Does 1024 divide into 693? NO! 1 0 0 _ _ _ _ _ _ _ _ _ _

Does 512 divide into 693? YES! 1 0 0 1 _ _ _ _ _ _ _ _ _
693 - 512 = 181

Does 256 divide into 181? NO! 1 0 0 1 0 _ _ _ _ _ _ _ _

Does 128 divide into 181? YES! 1 0 0 1 0 1 _ _ _ _ _ _ _
181 - 128 = 53

Does 64 divide into 53? NO! 1 0 0 1 0 1 0 _ _ _ _ _ _

Does 32 divide into 53? YES! 1 0 0 1 0 1 0 1 _ _ _ _ _
53 - 32 = 21

Does 16 divide into 21? YES! 1 0 0 1 0 1 0 1 1 _ _ _ _
21 - 16 = 5

Does 8 divide into 5? NO! 1 0 0 1 0 1 0 1 1 0 _ _ _

Does 4 Divide into 5? YES! 1 0 0 1 0 1 0 1 1 0 1 _ _
5 - 4 = 1

Does 2 divide into 1? NO! 1 0 0 1 0 1 0 1 1 0 1 0 _

Does 1 divide into 1? HELL YES! 1 0 0 1 0 1 0 1 1 0 1 0 1

Final answer: 1001010110101

15. ### 5Gen_PreludeThere might not be an "I" in the word "Team", but

Joined:
Mar 14, 2000
Messages:
14,519
Likes Received:
1
Location:
Vancouver, BC, CANADA
And then once you figure all of that out and understand it, going forward, go into calculator, switch to scientific, enter the decimal (base 10 number) you want in binary, then click the bin radio button. Want to go the other way? Make sure binary is selected, enter the number, then press decimal!

w00t!

16. ### RenzGuest

i just wanted to thank you guys for explainng this to me. i finally understand it. i'm more of a hands on visual type of person. reading things and theory just doesnt do it for me. thanks to the help of you guys i understand it better now.

17. ### DommiGuest

stand corrected...