Professional Documents
Culture Documents
Coding In: Computer
Coding In: Computer
M O D U L E 1 0 :
CODING IN
COMPUTER
GROUP 1 POWERPOINT PRESENTATION
BINARY
CODES
This discusses Binary Coded Decimal and its decimal digit
representation and convert numbers from base to another and its BCD.
Binary Codes
• Digital computers use the binary numbers 0 and 1. Input is done in decimals
and converted in binary for internal processing.
Illustration:
1001 0111 0101 0001 0001
975 11
{
{
{
{
{
8 +1 4+2+1 4+1 1 1
{
{
{
{
{
1 7 5 1 2
{
{
7 5
1 3
A commonly used code is the Binary Coded Decimal (BCD) code which corresponds to the first
10 binary representation of the decimal digits 0-9. Since 4 bits may have up to42 binary
combinations, a total 6 combinations will be unused. The position weights of the BCD
are 8, 4, 2, 1.
{
{
{
{
2 0010 1 0
1 3
{
{
{
{
5 0101 1 1
1 4
{
{
{
{
1 5
8 1000 1 2
9 1001
Example:
a. We perform the following division:
14 divided by 2 is 7 rem. 0
7 divided by 2 is 3 rem. 1
3 divided by 2 is 1 rem. 1
1 divided by 2 is 0 rem. 1
Note, to be able to detect errors at the receiver ends, the sender sends an extra bit called
parity bit. A parity bit is an extra bit included with n-bit binary message to make the total
of 1’s message which may be either odd or even.
CHARACTERS IN
COMPUTER
Characters in Computer
Printable characters include the upper and lower cases letters (2 x 26), the 10
numerals (0-9), & 12 special characters (e.g. @, ‘, ~, !, #, $, %, ^, &, *, (, ), _, -, =,
+, [, ], {, }, ;, :, “, \, |, <, >, /, ?, ‘.)
0000
1111 0 0001
-1 1
0010
1110 2
-2
-5 5 0101
1011
-6
6
0110
1010
-7 7
-8 0111
1001 1000
Schematic Diagram of 4-bit2’s-compliment code for
integers in -8 up to 7 :
Fixed-Point Numbers
A fixed-point number consists of a whole and decimal part where the two parts are
separated by a radix point.
-.375
.375
-.75
.5
-.625
.625
-.75
.75
-.875
-1 .875
Schematic Diagram of 4-bit2’s-compliment code for
integers in -8 up to 7 :
CONVERTING
DECIMALS
TO RADIX 2
Converting Decimals to Radix 2
Example:
a. Convert .0625 to radix 2
• Error detection is the detection of errors caused by noise or other impairments during
transmission from the transmitter to the receiver. Error correction is the detection of
errors and reconstruction of the original, error-free data.
Message
Source Decoder
Noise Channel
Source Encoder
Receiver
If the receiver does not get the correct word, we use the method or scheme of
adding more bits. The aim of this method is called a scheme to detect error and correct
the error it in the channel.
Addition of 1 bit gives detecting the error but not correcting it.
00 000
10 101
Use 3 bits in a message of 2 bits.
01 011
11 110
Example.
1. The message 00 is encoded as 000 after the source.
2. If one error is detected, the sent message is one of the three words
100, 010, 001
3. The error is detected but none of the three words 100, 010, 001 is among the
messages 101, 011, or 110
Use more bits
We design the channel coding scheme by using more bits as follows:
If we use more bits such as 6 bits, the error is corrected. Suppose we have decoded words
of two bits in 6 bits as follows:
00 000000
10 101111
01 010110
11 111100
• Is a metric for comparing two binary data strings. While comparing two binary
strings of equal length, Hamming distance is the number of bit positions in which
the two bits are different.
CREDITS: This presentation template was created by Slidesgo, including icons by Flaticon, and infographics & images by Freepik.
Please keep this slide for attribution.