Professional Documents
Culture Documents
ch2 Number Systems and Codes
ch2 Number Systems and Codes
Chapter 2
Number Systems and Codes
Thái Truyển Đại Chấn
Outline
LSB
MSB
Decimal-to-Binary Conversions
Decimal-to-Binary Conversions
• Repeated Division
Decimal-to-Binary Conversions
• Repeated Division
Start
Is Q = 0
Divide by 2
Start
Decimal-to-Binary Conversions
• Counting Range
• Counting in Hexadecimal
• Usefulness of Hex
Conversion Summary
• Why is conversion is necessary?
• Summary
• Binary/Hex Decimal
• Decimal Binary/Hex
• Hex Binary
• Binary Hex
BCD Code
• Decimal ↔ Straight binary coding
• Binary-coded-decimal (hereafter abbreviated BCD)
BCD : Tách số ra thành từng con số rồi chia cho 2 => Sau đó hợp thành 1 dải số có 4 số
Binary: Lấy số đó chia 2 + Dư 1 thì ghi 1
+ Ko dư thì ghi 0
The Gray Code
• Only one bit ever changes between two successive
numbers in the sequence
The Gray Code
• Converting (a) binary to Gray and (b) Gray to binary
The Gray Code
• An eight-position, three-bit shaft encoder.
Putting All Together
Gray code for group of 4 bits
The Byte, Nibble, and Word
• Byte
• Nibble 4 Bits
• Word A byte is eight bits, a word is 2 bytes (16 bits), a doubleword is 4 bytes (32 bits), and a quadword is 8 bytes (64 bits). Figure
29-2 shows the byte order of each of the fundamental data types when referenced as operands in memory.
Alphanumeric Codes
• All of the various characters and functions that are
found on a computer keyboard
• A, B, C, …, a, b, c, …, 1, 2, 3, …, ., ,, ?, …, +, /, #, …
• American Standard Code for Information Interchange
(ASCII)
• 27 = 128 possible code groups
• Transfer of alphanumeric info.: a computer ↔ external
devices
• Store the information that an operator types in at the
computer’s keyboard.
Alphanumeric Codes
• Example
padding with 0s
=> They have equal plane of 4
bits
Parity Method for Error Detection
• Movement of binary data and codes from one
location
• Error can occur
• Electrical noise
• Detection code
• Correction code
Parity Method for Error Detection
• Parity bit
• Even-parity method
• Odd-parity method
• Detection code, not correction code
• Single-bit error detection
• Checking the parity, request for retransmission,
retransmission
Applications
• Transmitting an ASCII character
(Application 2-5)