Professional Documents
Culture Documents
KCS Murti
Structure
Number systems Decimal Binary Hexa Decimal Operations BCD Codes
Number Systems
Decimal (0,1,2,3,4,5,6,7,8,9) Octal (0,1,2,3,4,5,6,7) Hexadecimal (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) Binary (0,1) A number anan-1a2a1a0a-1a-m expressed in base-r system, has coefficients multiplied by powers of r
an.rn+an-1.rn-1+.+a2.r2+a1.r1+a0.r0+a-1.r-1+a-2+a .r-m .r 2 -m
Convert to decimal
(B65F)16 = 11 X 163 + 6 X 162 + 5 X 161 +15 = (46687)10 (4021.2)5=4 X 53 + 0 X 52 + 2 X 51 + 1 X 50 + 2 X 51 = (511.4)10
Decimal to Binary
Repeated division steps: Divide the decimal number by 2 Write the remainder after each division until a quotient of zero is obtained. The first remainder is the LSB and the last is the MSB
Decimal to binary..
Convert (41)10 to binary Integer 41 20 10 5 2 1 Convert (153)10 to Octal 0 153 19 2 0
XX F241 Microprocessors KCS Murti
Reminder 1 0 0 1 0 1 Ans=101001
1
3 2 Ans=(231)8
Decimal to hexadecimal
Convert (227)10 to Hexadecimal Integer 227 14 0 3 E Ans=0xE3H Reminder
Complements
Two types namely radix and diminished radix complement Diminished Radix or (r-1)s complement : For a number N with n digits, it is defined as (rn-1)-N Radix or rs complement : For a number N with n digits, it is defined as (rn-1)-N+1
9s complement of 546700 is (999999-546700)=453299 9s complement of 012398 is (999999-012398)=987601 10s complement of 012398 is 987602 10s complement of 246700 is 753300
1s and 2s complement
1s complement of 1011000 is 1s complement of 0101101 is 0100111 1010010
Signed magnitude of -7
10000111
Place magnitude in remaining 7 bits Represent -7 in 2s complement form Start with 8 bit code for +7 Invert each bit including the MSB Add 1
00000110 00000111
Addition
+13 +9 +22 00001101 00001001 00100110 +9 -13 -4 -9 00001001 11110011 11111100 11110111
+13 -9 +4
-13
-22
11110011
11101010
7A 3F B9
7 3 1110 B16
A F 2510 916
Overflow
115 209 68
115 -47 68
BCD code
Each decimal digit is represented using 4 bits. Ex: convert 87410 to BCD: 8 7 4 0100 0111 0100 = 010001110100BCD
BCD code..
Advantages
1. Ease of conversion 2. Easy to design the logic circuit. 3. Only the 4 bit groups for the decimal digits 0 to 9 need to be remembered.
Disadvantages:
1. BCD requires more bits
Grey code
Binary
Gray Code
Example
Binary to Gray Binary Gray 1 1 0 1 0 0 1 1
1 0
0 0
1 1
Grey codes
Angular position Measurement where each segment is assigned a binary number
Load
Drive
Shaft encoder
Shaft encoder
Shaft Encoder
Alphanumeric Code
ASCII American Standard Code for Information Interchange A binary code for letters, numerals, special characters and control characters. Seven bit code: 27 = 128 possible code groups 94 Graphic Characters and 34 non printing control characters
Alphanumeric Code
Example
Let the code group is 1000001 (ASCII code forA), if even parity is used, P=0. so, the new code 10000010 if odd parity is used, P=1 so, the new code 10000011 Where the last bit in the new code is parity bit (P)
Limitations:
1. Position of error cannot be detected. 2. Parity method would not work if two bits were in error.