Please enable JavaScript.
Coggle requires JavaScript to display documents.
Ch. 3 Number and Character Coding Systems - Coggle Diagram
Ch. 3 Number and Character Coding Systems
3.2 Number System Conversion
Binary to denary: Only digits 0 and 1 are used in the binary number system.
Hexadecimal to denary: In the hexadecimal number system, the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F are used.A, B, C, D, E, F represent 10, 11, 12, 13, 14, 15 respectively.
From a Denary Number to a Binary Number or a Hexadecimal Number
Divide the denary number by b repetitively until the quotient is smaller than b.
Obtain the answer by writing up from the quotient to the remainders in reverse order.
From a Binary Number to a Hexadecimal Number
Group the digits of the binary number by four starting from the righthand side.
Replace each group of the four digits by an equivalent hexadecimal digit.
To convert a hexadecimal number into a binary number:
Convert each digit of the hexadecimal number into a group of
__
.
Obtain the binary number by grouping all the binary digits together.
3.1 Denary, Binary and Hexadecimal Number Systems
Binary Number: Computers use it for data
representations and manipulations.
Hexadecimal Number: Programmers use it to communicate
with computers.
Denary Number: We use it in our daily life for counting
and calculation.
3.4 Addition and Subtraction of Different Number Representations
The calculation on both addition and subtraction of unsigned in other number systems is the same as that in the denary system.
A ‘carry’ is generated when the sum of digits equals or exceeds the base value.
A ‘borrow’ from the left digit is necessary if a larger digit is subtracted from a smaller one
Overflow error:Occur when the calculation result is outside the range that the digits can represent.
3.3 Number Representation in Computer Systems
Binary number system: The ONLY number system that a computer uses in storing numbers and performing arithmetic.
Bit
A single binary digit
The basic unit for storing data in a computer
A single bit can only represent two distinct values.
For example: 0 or 1, True or False, On or Off
Byte
A data unit used in computers
Consists of 8 bits and is the smallest addressable unit in a
microprocessor.
Word
Modern computers can handle data stored in two or more bytes at a time.
The natural unit of data used by a computer is called a word.
The word length (word size) is measured in bits.
Conversion of unit: The difference of each unit is 1024 times.
Representation of unsigned Binary Integer
Unsigned integer is a type of integer representation that contains no sign symbol.
Non-negative integers such as population and sales volume of books
can be represented by unsigned integers.
All bits in a word are used to represent the magnitude.
Representation of Signed Binary Numbers
Sign-and-magnitude
The sign bit
1: a negative integer
0: a positive integer
The leftmost bit, known as sign bit, is used to specify the sign of a binary integer.
The shortfall is that there are two representations of zero : both 1000 00002 and 0000 00002 represent zero in an 8-bit signed binary integer.
2.Two's complement
Widely used in computers to represent binary integers
All integers have unique representations.
Representation of a positive binary integer is exactly the same as that of the original value
To get a negative binary integer:
Starting from the corresponding positive binary integer, invert all bits from ‘0’ to ‘1’ and ‘1’ to ‘0’ . The result is known as one's complement
Add 1 to the one’s complement.
3.5 Character Coding Systems
Other than numeric data, a computer needs to store and process characters.
The character coding system is a way to represent characters in a form that can be manipulated efficiently in a computer.
ASCII
Two common character coding systems:
American standard code for Information Inter change (ASCII)
Extended Binary-coded Decimal Inter change code(EBCDIC)
Each code represents either a printable character or a non-printable character (e.g.end-of-line character)
Each ASCII character consists of 7 and it can contain(i.e. 128) different characters.
They include all the alphanumeric characters (the small and capital English letters, digits from 0 to 9) and graphics symbols.
Chinese Character Coding system
The standard ASCII: 128 characters
The extended ASCII: 256 characters
There are more than 100 000 Chinese characters and we use more than 10,000 of them in our daily lives.
Chinese characters are usually represented in:
Big5 code : traditional Chinese
Guo Biao(GB) code : simplifed Chinese
Unicode
Both character coding systems use two bytes to represent one Chinese character.
If a Chinese text file is processed with the wrong coding system, strange and meaningless characters will appear.
Unicode
Used to represent all the existing languages in the world
Contain about 100 000 characters
The representations of Unicode known as code point are variable in length.
Made up of one to four bytes
The code points are carefully defined so that the most frequently used characters, such as the ASCII, are put at the front of the code table.
These characters can be represented by a one-byte code point.