COA (1)
COA (1)
COA (1)
The easiest way to vary instructions through electric signals is two-state system – on and
off.
On is represented as 1 and off as 0, though 0 is not actually no signal but signal at a lower
voltage.
The number system having just these two digits – 0 and 1 – is called binary number
system.
Each binary digit is also called a bit. Binary number system is also positional value
system, where each digit has a value expressed in powers of 2, as displayed here
In any binary number, the rightmost digit is called least significant bit (LSB) and leftmost digit is
called most significant bit (MSB).
The most widely used alphanumeric code is American Standard Code for Information Interchange
(ASCII).
Unicode
Conversion
Decimal to Binary
Decimal numbers can be converted to binary by repeated division of the number by 2
while recording the remainder. Let’s take an example to see how this happens.
Decimal to Octal
Decimal numbers can be converted to octal by repeated division of the number by 8 while recording the
42310 = 1A716
Binary to Octal and Vice Versa
Starting from the least significant bit, make groups of three bits.
If there are one or two bits less in making the groups, 0s can be added after the most significant bit
Convert each group into its equivalent octal number
Binary to Hexadecimal
Starting from the least significant bit, make groups of four bits.
If there are one or two bits less in making the groups, 0s can be added after the most
significant bit.
Convert each group into its equivalent octal number.
CODES
The reflected binary code or Gray code is an ordering of the binary numeral system such that two successive
values differ in only one bit (binary digit).
Gray code is not weighted that means it does not depends on positional value of digit.
Gray code also known as reflected binary code, because the first (n/2) values compare with those of the last (n/2)
values, but in reverse order.
n-bit Gray code can be generated recursively using reflect and prefix method which is explained as following below.
Therefore, Gray code 0 and 1 are for Binary number 0 and 1 respectively. Gray codes: 00. 01, 11, and 10 are for
Binary numbers: 00, 01, 10, and 11 respectively.
Binary Coded Decimal (BCD) code
● In this code each decimal digit is represented by a 4-bit binary number.
● BCD is a way to express each of the decimal digits with a binary code.
● In the BCD, with four bits we can represent sixteen numbers (0000 to 1111).
● But in BCD code only first ten of these are used (0000 to 1001).
● The remaining six code combinations i.e. 1010 to 1111 are invalid in BCD.
Advantages of BCD Codes
It is very similar to decimal system.
We need to remember binary equivalent of decimal numbers 0 to 9 only.
● The ASCII stands for American Standard Code for Information Interchange.
● The ASCII code is an alphanumeric code used for data communication in digital
computers.
● The ASCII is a 7-bit code capable of representing 2 7 or 128 number of different
characters.
● The ASCII code is made up of a three-bit group, which is followed by a four-bit code.
ASCII Code
• American Standard Code for Information
Interchange
• ASCII is a 7-bit code, frequently used with an 8 th bit
for error detection (more about that in a bit).
Character ASCII (bin) ASCII (hex) Decimal Octal
A 1000001 41 65 101
B 1000010 42 66 102
C 1000011 43 67 103
…
Z
a
…
1
‘
Digit Binary Gray Code
Gray Code
• 0 0000 0000
Gray code is not a number system.
• It is an alternate way to represent four 1 0001 0001
bit data 2 0010 0011
• Only one bit changes from one decimal digit to the next 3 0011 0010
• Useful for reducing errors in communication.
4 0100 0110
• Can be scaled to larger numbers.
5 0101 0111
Binary Gray
4 bit binary number can be written as B3, B2, B1, B0 6 0110 0101
4 bit gray number can be written as G3, G2, G1, G0 7 0111 0100
G3=B3 8 1000 1100
G2=B3+B2 9 1001 1101
G1=B2+B1
10 1010 1111
G0=B1+B0
11 1011 1110
Gray Binary
B3=G3 12 1100 1010
B2=G3+G2 13 1101 1011
B1=B2+G1 14 1110 1001
B0=B1+G0 15 1111 1000
Binary Addition
0 0 0
0 0 1
1 0 1
1 1 0 with carry 1
1 1 1 1 with carry 1
• In case of even parity − If number of 1s is even, parity bit value is 0. If number of 1s is odd,
parity bit value is 1.
• In case of odd parity − If number of 1s is odd, parity bit value is 0. If number of 1s is even,
parity bit value is 1.
• Receiver’s End − On receiving a frame, the receiver counts the number of 1s in it. In case of
even parity check, if the count of 1s is even, the frame is accepted, otherwise it is rejected. In
case of odd parity check, if the count of 1s is odd, the frame is accepted, otherwise it is rejected.
Example
• Suppose that a sender wants to send the data 1001101 using even parity check method. It will
add the parity bit as shown below.
• The receiver will decide whether error has occurred by counting whether the total number of 1s is
even. When the above frame is received, three cases may occur namely, no error, single bit error
detection and failure to detect multiple bits error. This is illustrated as follows
• Even Parity Check: Total number of 1’s in the given data bit should be even. So if the total number of
1’s in the data bit is odd then a single 1 will be appended to make total number of 1’s even else 0 will
be appended(if total number of 1’s are already even). Hence, if any error occurs, the parity check
circuit will detect it at the receiver’s end
Mess
• Odd Parity Check: In odd parity system, if the total age P(Odd) P(Even)
(XYZ)
number of 1’s in the given binary string (or data bits) are
000 1 0
even then 1 is appended to make the total count of 1’s as
odd else 0 is appended. 001 0 1
1 1 0 1 11 1
Example
Binary Division
Binary Division
Binary Division
BCD Addition
Input :
A = 0111 B = 1000
Output :
Y = 1 0101
Input 1 Result
1 0
0 1
AND gate
● If both the inputs are true, the result is true else the result is false.
● If any one of the input is true, the result is true else the result is false.
● If either one of the input is true, the result is true else the result is false.
● If both the inputs are same, the result is false.