the digital codes. binary coded decimal (bcd) would it be easy for you if you can replace a decimal...
TRANSCRIPT
![Page 1: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/1.jpg)
The Digital The Digital CodesCodes
![Page 2: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/2.jpg)
Binary Coded Decimal Binary Coded Decimal (BCD)(BCD)
Would it be easy for you if you can Would it be easy for you if you can replace a decimal number with an replace a decimal number with an individual binary code? individual binary code? Such as 00011001 = 19Such as 00011001 = 191010
The 8421 code is a type of BCD to do The 8421 code is a type of BCD to do that.that.
BCD code provides an excellent BCD code provides an excellent interface to binary systems:interface to binary systems: Keypad inputsKeypad inputs Digital readoutsDigital readouts
![Page 3: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/3.jpg)
Binary Coded DecimalBinary Coded Decimal
ex1: dec-to-BCDex1: dec-to-BCD
(a)(a) 3535
(b)(b) 9898
(c)(c) 170170
(d)(d) 2469 2469
ex2: BCD-to-decex2: BCD-to-dec
(a)(a) 1000011010000110
(b)(b) 001101010001001101010001
(c)(c) 10010100011100001001010001110000
Decimal Decimal DigitDigit 00 11 22 33 44 55 66 77 88 99
BCDBCD 00000000 00010001 00100010 00110011 01000100 01010101 01100110 01110111 10001000 10011001
Let’s crack these…
Note: 1010, 1011, 1100, 1101, 1110, and 1111 are INVALID CODE!
![Page 4: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/4.jpg)
BCD AdditionBCD Addition BCD is a numerical code and BCD is a numerical code and can be usedcan be used
in arithmetic operations. Here is how to in arithmetic operations. Here is how to add two BCD numbers:add two BCD numbers: Add the two BCD numbers, using the rules for Add the two BCD numbers, using the rules for
basic binary addition.basic binary addition. If a 4-bit sum is equal to or less than 9, it is a If a 4-bit sum is equal to or less than 9, it is a
valid BCD number.valid BCD number. If a 4-bit sum > 9, or if a carry out of the 4-bit If a 4-bit sum > 9, or if a carry out of the 4-bit
group is generated it is an invalid result. Add group is generated it is an invalid result. Add 6 (0110) to a 4-bit sum in order to skip the six 6 (0110) to a 4-bit sum in order to skip the six the invalid states and return the code to 8421. the invalid states and return the code to 8421. If a carry results when 6 is added, simply add If a carry results when 6 is added, simply add the carry to the next 4-bit group.the carry to the next 4-bit group.
![Page 5: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/5.jpg)
BCD AdditionBCD Addition
Try these:Try these:ex: Add the following numbersex: Add the following numbers
(a) 0011+0100(a) 0011+0100(b) 00100011 + 00010101(b) 00100011 + 00010101(c) 10000110 + 00010011(c) 10000110 + 00010011(d) 010001010000 + 010000010111(d) 010001010000 + 010000010111(e) 1001 + 0100(e) 1001 + 0100(f) 1001 + 1001(f) 1001 + 1001(g) 00010110 + 00010101(g) 00010110 + 00010101(h) 01100111 + 01010011(h) 01100111 + 01010011
![Page 6: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/6.jpg)
The Gray CodeThe Gray Code
The Gray code is unweighted and is not The Gray code is unweighted and is not an arithmetic code.an arithmetic code. There are no specific weights assigned to There are no specific weights assigned to
the bit positions.the bit positions. Important: the Gray code exhibits only Important: the Gray code exhibits only
a single bit change from one code word a single bit change from one code word to the next to the next in sequencein sequence.. This property is important in many This property is important in many
applications, such as shaft position applications, such as shaft position encoders.encoders.
![Page 7: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/7.jpg)
The Gray CodeThe Gray Code
DecimDecimalal
BinarBinaryy
Gray Gray CodeCode
00 00000000 00000000
11 00010001 00010001
22 00100010 00110011
33 00110011 00100010
44 01000100 01100110
55 01010101 01110111
66 01100110 01010101
77 01110111 01000100
DecimDecimalal
BinarBinaryy
Gray Gray CodeCode
88 10001000 11001100
99 10011001 11011101
1010 10101010 11111111
1111 10111011 11101110
1212 11001100 10101010
1313 11011101 10111011
1414 11101110 10011001
1515 11111111 10001000
![Page 8: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/8.jpg)
The Gray CodeThe Gray Code
Binary-to-Gray code conversionBinary-to-Gray code conversion The MSB in the Gray code is the same as The MSB in the Gray code is the same as
corresponding MSB in the binary corresponding MSB in the binary number.number.
Going from left to right, add each Going from left to right, add each adjacent pair of binary code bits to get adjacent pair of binary code bits to get the next Gray code bit. the next Gray code bit. Discard carriesDiscard carries..
ex:ex: convert convert 101101011022 to Gray code to Gray code
1 1 ++ 0 0 ++ 1 1 ++ 1 1 ++ 0 binary 0 binary
1 1 1 0 1 Gray1 1 1 0 1 Gray
![Page 9: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/9.jpg)
The Gray CodeThe Gray Code
Gray-to-Binary ConversionGray-to-Binary Conversion The MSB in the binary code is the same as The MSB in the binary code is the same as
the corresponding bit in the Gray code.the corresponding bit in the Gray code. Add each binary code bit generated to the Add each binary code bit generated to the
Gray code bit in the next adjacent position. Gray code bit in the next adjacent position. Discard carriesDiscard carries..
ex:ex: convert the Gray code word convert the Gray code word 11011 to 11011 to binarybinary
1 1 1 1 0 0 1 1 1 Gray 1 Gray
+ + + + + + + +
1 1 0 0 0 0 1 1 0 Binary 0 Binary
![Page 10: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/10.jpg)
The Gray Code - The Gray Code - ApplicationApplication
http://www.mipraso.de/enzyklopaedie/g/gray-code-scheibe.gif
http://www.engr.colostate.edu/~dga/mechatronics/figures/9-11.gif
Bit 0
Bit 1
Bit 2
Bit 3
![Page 11: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/11.jpg)
Alphanumeric CodesAlphanumeric Codes
Represent numbers and alphabetic Represent numbers and alphabetic characters. characters. Also represent other characters such as Also represent other characters such as
symbols and various instructions symbols and various instructions necessary for conveying information.necessary for conveying information.
The ASCII is the most common The ASCII is the most common alphanumeric code.alphanumeric code. ASCII = American Standard Code for ASCII = American Standard Code for
Information InterchangeInformation Interchange
![Page 12: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/12.jpg)
ASCIIASCII
ASCII has 128 characters and ASCII has 128 characters and symbols represented by a 7-bit symbols represented by a 7-bit binary code.binary code. It can be considered an 8-bit code with It can be considered an 8-bit code with
the MSB always 0. (00h-7Fh)the MSB always 0. (00h-7Fh) 00h-1Fh (the first 32) – control characters00h-1Fh (the first 32) – control characters 20h-7Fh – graphics symbols (can be printed 20h-7Fh – graphics symbols (can be printed
or displayed)or displayed)
![Page 13: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/13.jpg)
ASCII ASCII TableTable
http://ascii-table.com/img/table.gif
![Page 14: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/14.jpg)
Extended ASCIIExtended ASCII
There are an additional 128 There are an additional 128 characters that were adopted by characters that were adopted by IBM for use in their PCs. It’s popular IBM for use in their PCs. It’s popular and is used in applications other and is used in applications other than PCs than PCs unofficial standard. unofficial standard. The extended ASCII characters are The extended ASCII characters are
represented by an 8-bit code series represented by an 8-bit code series from 80h-FFhfrom 80h-FFh
![Page 15: The Digital Codes. Binary Coded Decimal (BCD) Would it be easy for you if you can replace a decimal number with an individual binary code? Would it be](https://reader036.vdocuments.mx/reader036/viewer/2022072014/56649e925503460f94b977a9/html5/thumbnails/15.jpg)
Extended Extended ASCII TableASCII Table
http://ascii-table.com/img/table-pc.gif