Nov 6, 2011

Abstract of CCNA study guide-8 - tcp/ip 3

Continue the series of  Abstract CCNA study guide book .
Binary to Decimal and Hexadecimal Conversion


What all this means is that if a one digit (1) is placed in a value spot, then the nibble or byte
takes on that decimal value and adds it to any other value spots that have a 1. And if a zero (0)
is placed in a bit spot, you don’t count that value. Let’s work through a few examples
Ex1: 10010110 , Which bits are on? The 128, 16, 4, and 2 bits are on, so we’ll just add them up:
 128 + 16 + 4 + 2 = 150.
EX2: 01101100 , Which bits are on? The 64, 32, 8, and 4 bits are on, so we just need to add them up:
64 + 32 + 8 + 4 = 108.

Next Table  is a table you should memorize .
Binary Value
Decimal value
10000000
128
11000000
192
11100000
224
11110000
240
11111000
248
11111100
252
11111110
254
11111111
255

Hexadecimal addressing is converted by reading nibbles, not bytes.
First, understand that the hexadecimal addressing scheme uses only the numbers 0 through 9. And
since the numbers 10, 11, 12, and so on can’t be used (because they are two-digit numbers), the
letters A, B, C, D, E, and F are used to represent 10, 11, 12, 13, 14, and 15, respectively.

next Table shows both the binary value and the decimal value for each hexadecimal digit.
Hexadecimal Value
Binary Value
Decimal Value
0
0000
0
1
0001
1
2
0010
2
3
0011
3
4
0100
4
5
0101
5
6
0110
6
7
0111
7
8
1000
8
9
1001
9
A
1010
10
B
1011
11
C
1100
12
D
1101
13
E
1110
14
F
1111
15

So suppose you have something like this: 0x6A. (Sometimes Cisco likes to put 0x in front of characters so you know that they are a hex value) What are the binary and decimal values? All you have to remember is that each hex character is one nibble and two hex characters together make a byte.
To figure out the binary value, we need to put the hex characters into two nibbles and then put them
together into a byte. 6 = 0110 and A (which is 10 in hex) = 1010, so the complete byte would be 01101010.

To convert from binary to hex, just take the byte and break it into nibbles:
Say you have the binary number 01010101. First, break it into nibbles—0101 and 0101—with the value of each nibble being 5 since the 1 and 4 bits are on. This makes the hex answer 0x55. And in decimal format, the binary number is 01010101, which converts to 64 + 16 + 4 + 1 = 85.

Here’s another binary number:
11001100
Your answer would be 1100 = 12 and 1100 = 12 (therefore, it’s converted to CC in hex). The decimal conversion answer would be 128 + 64 + 8 + 4 = 204.

No comments:

Post a Comment