Presentation is loading. Please wait.

Presentation is loading. Please wait.

Codes and Code Converters Lecture L6.12 Section 6.5 Section 9.5.

Similar presentations


Presentation on theme: "Codes and Code Converters Lecture L6.12 Section 6.5 Section 9.5."— Presentation transcript:

1 Codes and Code Converters Lecture L6.12 Section 6.5 Section 9.5

2 Codes and Code Converters ASCII Binary-to-BCD Converters Gray Code Bar Codes

3 Standard ASCII Codes

4 ASCII Codes

5 Definitions of ASCII Control Characters

6

7

8

9

10

11

12 Codes and Code Converters ASCII Binary-to-BCD Converters Gray Code Bar Codes

13 Binary-to-BCD Converter

14 MODULE bin2bcd TITLE 'Binary to binary coded decimal' DECLARATIONS " INPUT PINS " I3..I0 PIN 11,7,6,5;" Switches S I = [I3..I0];" 4-bit input vector " OUTPUT PINS " [E,D,C,B,A] PIN 5,4,3,2,1 ISTYPE 'com';" LEDs BCD = [E,D,C,B,A]; bin2bcd.abl EDCBA I =

15 bin2bcd.abl (cont’d) 16;" Identify the Hex Base truth_table ( I -> BCD )" Binary to BCD Code Converter 0 -> 00; 1 -> 01; 2 -> 02; 3 -> 03; 4 -> 04; 5 -> 05; 6 -> 06; 7 -> 07; 8 -> 08; 9 -> 09; 0A -> 10; 0B -> 11; 0C -> 12; 0D -> 13; 0E -> 14; 0F -> 15; END bin2bcd

16 Shift and Add-3 Algorithm 1. Shift the binary number left one bit. 2. If 8 shifts have taken place, the BCD number is in the Hundreds, Tens, and Units column. 3. If the binary value in any of the BCD columns is 5 or greater, add 3 to that value in that BCD column. 4. Go to 1.

17 Steps to convert an 8-bit binary number to BCD

18 Example of converting hex E to BCD

19 Truth table for Add-3 Module C A3 A2 A1 A0 S3 S2 S1 S0

20 Binary-to-BCD Converter

21 Binary-to-BCD Converter

22 Other Binary Coded Decimal Representations

23 Codes and Code Converters ASCII Binary-to-BCD Converters Gray Code Bar Codes

24 Gray Code Note that the least significant bit that can be changed without repeating a value is the bit that is changed

25 Gray codes eliminate errors Binary Code Gray Code

26 Gray Code Conversion Gray Code Decimal equivalent G_in = [G2..0]; G_out = [B2..0]; Truth_table (G_in => G_Out) Fill in this TRUTH_TABLE Command so as to convert the Gray code input, [G2..0], to the binary output, [B2..0]

27 Gray Code Conversion Gray Code Decimal equivalent G_in = [G2..0]; G_out = [B2..0]; Truth_table (G_in => G_Out) 0 -> 0; 1 -> 1; 3 -> 2; 2 -> 3; 6 -> 4; 7 -> 5; 5 -> 6; 4 -> 7; Fill in this TRUTH_TABLE Command so as to convert the Gray code input, [G2..0], to the binary output, [B2..0]

28 Codes and Code Converters ASCII Binary-to-BCD Converters Gray Code Bar Codes

29 Code 39 Bar Code ABCD 3-of-9 bars are WIDE bars (Bars can be black or white)


Download ppt "Codes and Code Converters Lecture L6.12 Section 6.5 Section 9.5."

Similar presentations


Ads by Google