Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- Semiconductor theory by School of Design ... 9526 views
- Applications of semiconductor devic... by School of Design ... 6946 views
- Introduction to fourier analysis by School of Design ... 4752 views
- BCD,GRAY and EXCESS 3 codes by student 58888 views
- [2011 CodeEngn Conference 05] 쿨캣 - ... by GangSeok Lee 1510 views
- 박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D) by Ubuntu Korea Comm... 1868 views

6,863 views

Published on

The BEng & Foundation Degrees and HNC/D in Engineering are designed to meet the needs of employers by placing the emphasis on the theoretical, practical and vocational aspects of engineering within the workplace and beyond. Engineering is becoming more high profile, and therefore more in demand as a skill set, in today’s high-tech world. This course has been designed to provide you with knowledge, skills and practical experience encountered in everyday engineering environments.

Published in:
Education

License: CC Attribution License

No Downloads

Total views

6,863

On SlideShare

0

From Embeds

0

Number of Embeds

1

Shares

0

Downloads

174

Comments

0

Likes

4

No embeds

No notes for slide

- 1. Number Codes Digital Logic and Software Principles © University of Wales Newport 2009 This work is licensed under a Creative Commons Attribution 2.0 License .
- 2. <ul><li>The following presentation is a part of the level 4 module -- Digital Logic and Signal Principles. This resources is a part of the 2009/2010 Engineering (foundation degree, BEng and HN) courses from University of Wales Newport (course codes H101, H691, H620, HH37 and 001H). This resource is a part of the core modules for the full time 1 st year undergraduate programme. </li></ul><ul><li>The BEng & Foundation Degrees and HNC/D in Engineering are designed to meet the needs of employers by placing the emphasis on the theoretical, practical and vocational aspects of engineering within the workplace and beyond. Engineering is becoming more high profile, and therefore more in demand as a skill set, in today’s high-tech world. This course has been designed to provide you with knowledge, skills and practical experience encountered in everyday engineering environments. </li></ul><ul><li>Contents </li></ul><ul><li>BCD Numbers </li></ul><ul><li>Converting between Decimal and BCD </li></ul><ul><li>From One-Byte BCD to Binary: </li></ul><ul><li>BCD Addition </li></ul><ul><li>BCD Subtraction </li></ul><ul><li>Other Codes </li></ul><ul><li>Gray Code </li></ul><ul><li>Shaft Encoder </li></ul><ul><li>Credits </li></ul><ul><li>In addition to the resource below, there are supporting documents which should be used in combination with this resource. Please see: </li></ul><ul><li>Holdsworth B, Digital Logic Design, Newnes 2002 </li></ul><ul><li>Crisp J, Introduction to Digital Systems, Newnes 2001 </li></ul>Number Codes
- 3. Binary Coded Decimal BCD Numbers Each decimal digit to be represented in BCD is converted into its 4 digit binary equivalent. The final number will consist of four times the number of original decimal digits. As the decimal digits relating to 1010, 1011, 1100, 1101, 1110, 1111 do not exist these are invalid. Decimal Binary BCD 0 0000 0000 0000 0000 1 0000 0001 0000 0001 2 0000 0010 0000 0010 3 0000 0011 0000 0011 4 0000 0100 0000 0100 5 0000 0101 0000 0101 6 0000 0110 0000 0110 7 0000 0111 0000 0111 8 0000 1000 0000 1000 9 0000 1001 0000 1001 10 0000 1010 0001 0000 11 0000 1011 0001 0001 12 0000 1100 0001 0010 13 0000 1101 0001 0011 14 0000 1110 0001 0100 15 0000 1111 0001 0101 16 0001 0000 0001 0110 17 0001 0001 0001 0111 18 0001 0010 0001 1000 19 0001 0011 0001 1001 20 0001 0100 0010 0000
- 4. Converting between Decimal and BCD From Decimal to BCD: To convert decimal to binary replace each decimal digit by its binary equivalent and then concatenate the result. For example, 2769 0010 0111 0110 1001 = 0010011101101001 Number Codes
- 5. From BCD to Decimal: Group the bits from the left into fours – if leading zeroes have been removed so that the total number of digits are a multiple of four. Convert each group into its decimal equivalent. Example 110101011010010001 00 11 0101 0110 1001 0001 3 5 6 9 1
- 6. BCD Addition BCD numbers can be added as long as certain rules are followed – these are. if the addition produces a carry or if it creates an invalid BCD number then correct the digit by adding six where the error occurred. For example, 24 + 13 = 37 15 + 9 = 24 19 + 28 = 47 Number Codes 0010 0100 0001 0011 0011 0111 0001 0101 0000 1001 0001 1110 0000 0110 0010 0100 0001 1001 0010 1000 0100 0001 0000 0110 0100 0111
- 7. BCD Subtraction BCD numbers can be subtracted as long as certain rules are followed – these are. if the subtraction produces a borrow or if it creates an invalid BCD number then correct the digit by subtracting six where the error occurred. For example, 37 - 12 = 25 65 – 19 = 46 41 – 18 = 23 Number Codes 0011 0111 0001 0010 0010 0101 0110 0101 0001 1001 0100 1100 0000 0110 0100 0110 0100 0001 0001 1000 0010 1001 0000 0110 0010 0011
- 8. Other Codes ASCII Representation of Digits (American Standard Code for Information Interchange) ASCII is a code that allows not only decimal digits to be represented in binary format but also other non numerical characters. In its simplest form it has seven binary digits allowing the identification of 128 different characters. For the representation of the numbers from 0 to 9 we simply convert each digit to four bit binary and then add 011 to the left hand side. 5 0101 0110101 decimal binary ASCII Number Codes
- 9. EBCDIC Representation of Digits (Extended Binary Coded Decimal Interchange Code) This is an eight bit code which is used to represent decimal numbers. The decimal number is converted to its four bit binary equivalent and then four ones are added to the left. 5 0101 11110101 decimal binary EBCDIC Number Codes
- 10. Excess-3 (XS3) Excess three is the same as BCD but before the conversion takes place three is added to the decimal number. This means the following combinations do not exist as valid XS3 numbers. 0000 0001 0010 1101 1110 and 1111 This representation simplifies the addition process. Rule: if the addition stage generates a carry add 3, if it does not subtract 3 Number Codes
- 11. For example, 24 + 13 = 37 15 + 9 = 24 19 + 28 = 47 Subtraction Rule: if the subtraction stage requires a borrow subtract 3, if it does not add 3 Number Codes 0101 0111 0100 0110 1001 1101 0011- 0011- 0110 1010 0100 1000 0011 1100 1000 0100 0011- 0011+ 0101 0111 0100 1100 0101 1011 1010 0111 0011- 0011+ 0111 1010
- 12. For example, 37 - 12 = 25 65 – 19 = 46 41 – 18 = 23 Number Codes 0110 1010 0100 0101 0010 0101 0011+ 0011+ 0101 1000 1001 1000 0100 1100 0100 1100 0011+ 0011- 0111 1001 0111 0100 0100 1011 0010 1001 0011+ 0011- 0101 0110
- 13. 4221 This coding technique is used to produce a balanced number of 0s and 1s in a random sequence of decimal conversions Rather than the multipliers scaling by a factor of 2 as we move to the left, the multipliers are 4, 2, 2, 1 not 8, 4, 2, 1 This is sometimes written 4221 BCD. Number Codes
- 14. Summary Number Codes Digit ASCII EBCDIC XS3 4221 0 0011 0000 1111 0000 0011 0000 1 0011 0001 1111 0001 0100 0001 2 0011 0010 1111 0010 0101 0010 3 0011 0011 1111 0011 0110 0011 4 0011 0100 1111 0100 0111 1000 5 0011 0101 1111 0101 1000 0111 6 0011 0110 1111 0110 1001 1100 7 0011 0111 1111 0111 1010 1101 8 0011 1000 1111 1000 1011 1110 9 0011 1001 1111 1001 1100 1111
- 15. Gray Code If the decimal numbers to be encoded are increasing or decreasing linearly e.g. 3 – 4 – 5 – 6 – 7 or 23 – 22 – 21 – 20 – 19 etc then it is possible for the conversion process to cause ambiguities as the digits change. This can be prevented if Gray Codes are employed. Begin with all zeros and change the least significant bit. Change the next bit and reflect previous lower significant bits. Carry on with this process. Number Codes
- 16. Shaft Encoder This converts rotary movement into a digital number. It takes the following form: Number Codes Encoder Disk Light Sources Light Detectors Rotating Shaft
- 17. The encoder disk has areas that are opaque and areas that are transparent. As the disk turns light is passed to the detectors or blocked. The disk has the following form: complete this for binary code Binary Disk 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- 18. Number Codes
- 19. As the disk rotates anticlockwise we will reach a point where the output is 0 1 1 1 which is the output for position 7. Further rotation will move us to segment 8 where the output is 1 0 0 0 . Note that each of the four bits change their state during this transition. Problems arise due to the fact that the light sources and detectors can never be “perfectly” aligned and therefore one of the bits will change before the others. Bit 0 first we have a reading of 0 1 1 0 position 6 Bit 1 first we have a reading of 0 1 0 1 position 5 Bit 2 first we have a reading of 0 0 1 1 position 3 Bit 3 first we have a reading of 1 1 1 1 position 15 Number Codes
- 20. We can see that with this code we can have erroneous outputs, which could be very serious. For this reason we use Grey Code Generation of Gray is as follows: 0 0 0 0 0 0 0 0 1 1 0 0 1 1 3 0 0 1 0 2 0 1 1 0 6 0 1 1 1 7 0 1 0 1 5 0 1 0 0 4 1 1 0 0 12 1 1 0 1 13 1 1 1 1 15 1 1 1 0 14 1 0 1 0 10 1 0 1 1 11 1 0 0 1 9 1 0 0 0 8 Note Only one bit changes as we move from one segment to the next – hence no possible erroneous outputs. Complete the Gray disk on the next page. How can we convert from Gray to Binary? Number Codes
- 21. Gray Disk Number Codes 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- 22. Number Codes
- 23. This resource was created by the University of Wales Newport and released as an open educational resource through the Open Engineering Resources project of the HE Academy Engineering Subject Centre. The Open Engineering Resources project was funded by HEFCE and part of the JISC/HE Academy UKOER programme. © 2009 University of Wales Newport This work is licensed under a Creative Commons Attribution 2.0 License . The JISC logo is licensed under the terms of the Creative Commons Attribution-Non-Commercial-No Derivative Works 2.0 UK: England & Wales Licence. All reproductions must comply with the terms of that licence. The HEA logo is owned by the Higher Education Academy Limited may be freely distributed and copied for educational purposes only, provided that appropriate acknowledgement is given to the Higher Education Academy as the copyright holder and original publisher. The name and logo of University of Wales Newport is a trade mark and all rights in it are reserved. The name and logo should not be reproduced without the express authorisation of the University. Number Codes

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment