4 - 1 binary codes computers and other digital systems "work" with binary numbers. i/p...
Post on 27-Dec-2015
245 Views
Preview:
TRANSCRIPT
4 - 1
Binary Codes
• Computers and other digital systems "work" with binary numbers.• I/P & O/P is usually done using decimal numbers, alphabetics,
special symbols.• Some way of representing alphanumerics with binary numbers is
required.• These representations are called codes.• Many codes are possible, and a few standard codes are used, such as:
ASCII - American Standard Code for Information Interchange
EBCDIC - Extended Binary Coded Decimal
Interchange Code BCD - Binary Coded Decimal. For numbers only. Hardware and/or software is required to convert coded numbers into binary numbers before any arithmetic operations can take place.
7-bit System
Used in Big Mainframe Systems
4 - 2
Alphanumeric Character codes
Character 6-bit internal code ASCII code 8-bit EBCDIC
A 010 001 100 0001 1100 0001
B 010 010 100 0010 1100 0010
C 010 011 100 0011 1100 0011
D 010 100 100 0100 1100 0100
E 010 101 100 0101 1100 0101
F 010 110 100 0110 1100 0110
G 010 111 100 0111 1100 0111
H 011 000 100 1000 1100 1000
I 011 001 100 1001 1100 1001
J 100 001 100 1010 1101 0001
…………
…………………
4 - 3
ASCII7-bit
Codes
Character ASCII Code Character ASCII Code
@ 1000000 FORM FEED 0001100 A 1000001 CARRIAGE RETURN 0001101 B 1000010 RUBOUT 1111111 C 1000011 SPACE 0100000 D 1000100 ! 0100001 E 1000101 " 0100010 F 1000110 # 0100011 G 1000111 $ 0100100 H 1001000 % 0100101 I 1001001 & 0100110 J 1001010 ' 0100111 K 1001011 ( 0101000 L 1001100 ) 0101001 M 1001101 * 0101010 N 1001110 + 0101011 O 1001111 , 0101100 P 1010000 - 0101101 Q 1010001 . 0101110 R 1010010 / 0101111 S 1010011 0 0110000 T 1010100 1 0110001 U 1010101 2 0110010 V 1010110 3 0110011 W 1010111 4 0110100 X 1011000 5 0110101 Y 1011001 6 0110110 Z 1011010 7 0110111 [ 1011011 8 0111000 \ 1011100 9 0111001 ] 1011101 : 0111010 | 1011110 ; 0111011
NULL 0000000 < 0111100 HORIZ TAB 0001001 = 0111101 LINE FEED 0001010 > 0111110 VERT TAB 0001011 ? 0111111
4 - 4
Binary Codes for Decimal Numbers
Decimal
digit
8421
(BCD)
6311 Excess-3 2-out-of-5 Gray
0 0000 0000 0011 00011 0000
1 0001 0001 0100 00101 0001
2 0010 0011 0101 00110 0011
3 0011 0100 0110 01001 0010
4 0100 0101 0111 01010 0110
5 0101 0111 1000 01100 1110
6 0110 1000 1001 10001 1010
7 0111 1001 1010 10010 1011
8 1000 1011 1011 10100 1001
9 1001 1100 1100 11000 1000
Weighted codes: 8421, 6311, Excess-3 Non-weighted codes: 2-out-of-5, Gray
4 - 5
Binary Codes for Decimal Numbers (cont.)
BCD - Convert decimal numbers to binary code, digit by digit
(at least bits required).
8421 code: 95.16
6311 code: 925
4 (for each decimal digit)
1001 0101 . 0001 0110
9 5 1 6
1100 0011 0111
By looking up the previous table
4 - 6
The Meaning of Data
e.g.: Consider the following 16-cell register
If one assumes that the content of the register represents a binary integer, the decimal number is:
1100001111001001 = If one assumes an 8-bit EBCDIC code, the two characters are: In excess-3 code: In BCD code: The same bit configuration may be interpreted differently for different types of elements of information. The computer must be programmed to process this information according to the type of information stored.
1 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
5012110
C I
9096
??? Meaningless, why???
4 - 7
Boolean Algebra
• George Boole (1815-1864) applied a set of symbols to logical operations.
• Digital electronics applies his set theory and logic to (binary) switching networks.
• Binary number system is used to represent the two possible states of our systems.
The symbols 0 & 1 are used to represent: True or False Flow or No Flow Open or Closed Voltage1 or Voltage2 etc.
word statementscurrents, fluidsswitches, doors, etc.
anything with 2 states
4 - 8
Boolean Algebra
Deals with manipulation of Variables & Constants
Boolean Variables, such as X, Y, Z, A, B, C, etc. can have "values" of either 0 or 1.
0 & 1 are constants & are symbols only, representing two different states of a quantity.
i.e.
F or T
Low voltage or high voltage, usually written L or H
Flow or not flow
e.g. 0V logical 0
+5V logical 1
or 0V 1
+5V 0
+ ve logic
- ve logic
4 - 9
Basic Operations
Only 3
e.g. Not 1 is written as:
Not : X and Y : X or Y : 1 or X : If the variables represent voltages of the I/P or O/P of a switching
network, we symbolically represent these operations by:
NOT
If O/P is called C, we write:
X X '
NOT (compliment or invert)
AND
OR1´ or 1
X ´ or XX • YX + Y1 + X
C = X´
inversion symbol or “bubble
4 - 10
Boolean Operations (cont.)
AND
OR
where values for X, A, B, C are . They actually correspond to two different voltage levels when realized electronically.
e.g.
Characteristics of
an Inverter
0 or 1
0 & 5V; -12V & 0V, etc.
if X = 0 C = 1
if X = 1 C = 0
Truth Table
X C
0 1
1 0
AB
C = A + B+
B
4 - 11
Boolean Operations (cont.)
AND gate A B C
OR gate A B C
0 0
0 1
1 0
1 1
0 0 00 1 01 0 01 1 1
0
111
LogicalMultiplication
Also called Inclusive OR
LogicalAddition
A
BC = A ● B
A
BC = A + B
top related