























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























Computer Mathematics I
Jiraporn Pooksook Department of Electrical and Computer Engineering Naresuan University
Figure: Retrieved from https://www.electronics- tutorials.ws/binary/binary-coded-decimal.html
Binary Coded Decimal system is represented by a group of 4 bits using binary notation from 0000 to 1001. Binary coded decimal is different from hexadecimal because BCD numbers stop at 9 binary 1001 2. The advantage of BCD is that it allows easy conversion between decimal (base-10) and binary (base-2) form. However, the disadvantage is that BCD code is wasteful.
Example: 12 to BCD=? 00012 = 1 00102 = 2 Then, = 0001 0010
Example: 92 to BCD=? 10012 = 9 00102 = 2 Then, = 1001 0010
This is an unweighted code. It is obtained from the value of BCD adding by 3.
Example: 12 to Excess-3=? 01002 = 1 01012 = 2 Then, = 0100 0101
Example: 92 to Excess-3=? 11002 = 9 01012 = 2 Then, = 1100 0101
This is also a weighted code similarly to BCD.
Example: 12 to 2421=? 0001 = 1 0010 = 2 Then, = 0001 0010
Example: 92 to 2421=? 1111 = 9 0010 = 2 Then, = 1111 0010
The excess-3, 84-2-1, and 2421 codes are examples of self-complementing codes. Example : Excess- 395 = 0110 1100 1000 604 = 1001 0011 0111 (The 9’s complement of each number)
Figure: Retrieved from Digital Design / M. Morris R. Mano, Micheal D. Ciletti.-3nd ed.
Converting Binary to Gray:
n-bit code can be generated by n-1 bit code. Example(from 2 bits to 3 bits): Adding prefix 0 to the gray code in 2 bits Gray = 00 ⇒ 000 Gray = 01 ⇒ 001 Gray = 11 ⇒ 011 Gray = 10 ⇒ 010 Then adding prefix 1 to the reflects Gray = 10 ⇒ 110 Gray = 11 ⇒ 111 Gray = 01 ⇒ 101 Gray = 00 ⇒ 100 This method is the cyclic code.
The parity bit’s task: I (^) If an even parity bit is generated in the sending end for each message transmission, the message together with the parity bit is transmitted to its destination. I (^) The parity of the received data is checked. If the parity of the received information is not even, it means that at least one bit has changed value during the transmission. I (^) After an error is detected, there are many solution depending on the situation. One possibility is to request retransmission.
I (^) If the number of 1’s is odd, then P = 1. I (^) If the number of 1’s is even, then P = 0. Example: 0100 1 , 0110 0 What if the data 01010 is changed to 01011 Detectable? 11010 Detectable? 11111 Detectable? 00110 Detectable? Problem: Can’t detect which bit is in error. Can’t detect even numbers of errors.
Minimum distance of a code = smallest no. of bits in which any two codewords differ Example: Message 1 = 01101 Message 2 = 10011 Message 3 = 00110 Message 4 = 11000 Distance between codes: Message 1 and Message 2 = 4 Message 1 and Message 3 = 3 Hence, the minimum distance of a code = 3.
A two-out-of-five code is an m of n code that provides exactly ten possible combinations. It uses five bits representation. There are ways to assign weights to each bit such that the set bits sum to the desired value, with an exception for zero. A two-out-of-five code can have the number of 1’s = 2. Decimal 01247 0 00011 1 11000 2 10100 3 01100 4 10010 5 01010 6 00110 7 10001 8 01001 9 00101
If the number of 1’s 6 = 2 and the number of 0’s 6 = 3, detects as errors. What is the minimum distance of 2-out-of-5 code? What if the data 01010 is changed to 01011 Detectable? 11010 Detectable? 01001 Detectable? 00110 Detectable?