SlideShare une entreprise Scribd logo
1  sur  23
Number Codes Digital Logic and  Software Principles © University of Wales Newport 2009 This work is licensed under a  Creative Commons Attribution 2.0 License .
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Number Codes
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Number Codes
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
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
Gray Disk Number Codes 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Number Codes
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

Contenu connexe

Tendances

review of number systems and codes
review of number systems and codesreview of number systems and codes
review of number systems and codessrinu247
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoderAbid Ali
 
3.codes( binary code ,excess 3, gray code )
3.codes( binary code ,excess 3, gray code )3.codes( binary code ,excess 3, gray code )
3.codes( binary code ,excess 3, gray code )MdFazleRabbi18
 
Octal to binary encoder
Octal to binary encoderOctal to binary encoder
Octal to binary encoderAjay844
 
Bcd to excess 3 code converter
Bcd to excess 3 code converterBcd to excess 3 code converter
Bcd to excess 3 code converterUshaswini Chowdary
 
Chapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSIChapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSIEr. Nawaraj Bhandari
 
Basic electronics
Basic electronicsBasic electronics
Basic electronicsMantra VLSI
 
Dr.naveen electronics binary codes
Dr.naveen electronics binary codesDr.naveen electronics binary codes
Dr.naveen electronics binary codesNAVEEN KUMAR
 
Chapter 01 Basic Principles of Digital Systems
Chapter 01 Basic Principles of Digital SystemsChapter 01 Basic Principles of Digital Systems
Chapter 01 Basic Principles of Digital SystemsSSE_AndyLi
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...Arti Parab Academics
 
LOGIC GATES - SARTHAK YADAV
LOGIC GATES - SARTHAK YADAVLOGIC GATES - SARTHAK YADAV
LOGIC GATES - SARTHAK YADAVDeepak Yadav
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesstudent
 

Tendances (20)

. computer codes
. computer codes. computer codes
. computer codes
 
review of number systems and codes
review of number systems and codesreview of number systems and codes
review of number systems and codes
 
Digital 1 8
Digital 1 8Digital 1 8
Digital 1 8
 
Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoder
 
Code conversion
Code conversionCode conversion
Code conversion
 
3.codes( binary code ,excess 3, gray code )
3.codes( binary code ,excess 3, gray code )3.codes( binary code ,excess 3, gray code )
3.codes( binary code ,excess 3, gray code )
 
Number system
Number systemNumber system
Number system
 
Octal to binary encoder
Octal to binary encoderOctal to binary encoder
Octal to binary encoder
 
Bcd to excess 3 code converter
Bcd to excess 3 code converterBcd to excess 3 code converter
Bcd to excess 3 code converter
 
Chapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSIChapter 5: Cominational Logic with MSI and LSI
Chapter 5: Cominational Logic with MSI and LSI
 
Codes r005
Codes  r005Codes  r005
Codes r005
 
Basic electronics
Basic electronicsBasic electronics
Basic electronics
 
Bcd
BcdBcd
Bcd
 
Number system
Number systemNumber system
Number system
 
Dr.naveen electronics binary codes
Dr.naveen electronics binary codesDr.naveen electronics binary codes
Dr.naveen electronics binary codes
 
Chapter 01 Basic Principles of Digital Systems
Chapter 01 Basic Principles of Digital SystemsChapter 01 Basic Principles of Digital Systems
Chapter 01 Basic Principles of Digital Systems
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
 
LOGIC GATES - SARTHAK YADAV
LOGIC GATES - SARTHAK YADAVLOGIC GATES - SARTHAK YADAV
LOGIC GATES - SARTHAK YADAV
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codes
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 

En vedette

[2011 CodeEngn Conference 05] 쿨캣 - virse program messge DOS to Win
[2011 CodeEngn Conference 05] 쿨캣 - virse program messge DOS to Win[2011 CodeEngn Conference 05] 쿨캣 - virse program messge DOS to Win
[2011 CodeEngn Conference 05] 쿨캣 - virse program messge DOS to WinGangSeok Lee
 
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)Ubuntu Korea Community
 
Solution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systemsSolution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systemsmanishpatel_79
 
8051 Assembly Language Programming
8051 Assembly Language Programming8051 Assembly Language Programming
8051 Assembly Language ProgrammingRavikumar Tiwari
 
Solution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiSolution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiMuhammad Abdullah
 
B sc cs i bo-de u-iii combitional logic circuit
B sc cs i bo-de u-iii combitional logic circuitB sc cs i bo-de u-iii combitional logic circuit
B sc cs i bo-de u-iii combitional logic circuitRai University
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...manishpatel_79
 
8051 experiments1
8051 experiments18051 experiments1
8051 experiments1tt_aljobory
 

En vedette (13)

Semiconductor theory
Semiconductor theorySemiconductor theory
Semiconductor theory
 
Introduction to fourier analysis
Introduction to fourier analysisIntroduction to fourier analysis
Introduction to fourier analysis
 
[2011 CodeEngn Conference 05] 쿨캣 - virse program messge DOS to Win
[2011 CodeEngn Conference 05] 쿨캣 - virse program messge DOS to Win[2011 CodeEngn Conference 05] 쿨캣 - virse program messge DOS to Win
[2011 CodeEngn Conference 05] 쿨캣 - virse program messge DOS to Win
 
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
 
Design considerations
Design considerationsDesign considerations
Design considerations
 
Decoders student
Decoders studentDecoders student
Decoders student
 
Solution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systemsSolution manual the 8051 microcontroller based embedded systems
Solution manual the 8051 microcontroller based embedded systems
 
8051 Assembly Language Programming
8051 Assembly Language Programming8051 Assembly Language Programming
8051 Assembly Language Programming
 
Solution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidiSolution manual 8051 microcontroller by mazidi
Solution manual 8051 microcontroller by mazidi
 
B sc cs i bo-de u-iii combitional logic circuit
B sc cs i bo-de u-iii combitional logic circuitB sc cs i bo-de u-iii combitional logic circuit
B sc cs i bo-de u-iii combitional logic circuit
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...
 
Logic gates
Logic gatesLogic gates
Logic gates
 
8051 experiments1
8051 experiments18051 experiments1
8051 experiments1
 

Similaire à Number codes

W3 Chapter 2B Notes CCB1223 Digital Logic.pdf
W3 Chapter 2B Notes CCB1223 Digital Logic.pdfW3 Chapter 2B Notes CCB1223 Digital Logic.pdf
W3 Chapter 2B Notes CCB1223 Digital Logic.pdfMOHDZAMRIBINIBRAHIM1
 
PPT - 2.pptx
PPT - 2.pptxPPT - 2.pptx
PPT - 2.pptxANUTD1
 
Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2ISMT College
 
ENGINEERING ELECTRONICS SEMESTER FIVE COMM
ENGINEERING ELECTRONICS SEMESTER FIVE COMMENGINEERING ELECTRONICS SEMESTER FIVE COMM
ENGINEERING ELECTRONICS SEMESTER FIVE COMMworkaccess21
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital ElectronicsJanki Shah
 
Information sheet/Kertas Penerangan
Information sheet/Kertas PeneranganInformation sheet/Kertas Penerangan
Information sheet/Kertas Peneranganathirahchehusin
 
Lecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfLecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfUmerKhan147799
 
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...
12.Representation of signed binary numbers.  Binary codes - BCD code, Gray co...12.Representation of signed binary numbers.  Binary codes - BCD code, Gray co...
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...JatinJatin30
 

Similaire à Number codes (20)

Code conversion r006
Code conversion r006Code conversion r006
Code conversion r006
 
W3 Chapter 2B Notes CCB1223 Digital Logic.pdf
W3 Chapter 2B Notes CCB1223 Digital Logic.pdfW3 Chapter 2B Notes CCB1223 Digital Logic.pdf
W3 Chapter 2B Notes CCB1223 Digital Logic.pdf
 
PPT - 2.pptx
PPT - 2.pptxPPT - 2.pptx
PPT - 2.pptx
 
Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2Digital Logic BCA TU Chapter 2.2
Digital Logic BCA TU Chapter 2.2
 
ch2.pdf
ch2.pdfch2.pdf
ch2.pdf
 
Digital logic mohammed salim ch2
Digital logic mohammed salim ch2Digital logic mohammed salim ch2
Digital logic mohammed salim ch2
 
Mcs 012 soved assignment 2015-16
Mcs 012 soved assignment 2015-16Mcs 012 soved assignment 2015-16
Mcs 012 soved assignment 2015-16
 
Binary codes
Binary codesBinary codes
Binary codes
 
binarycodes.pdf
binarycodes.pdfbinarycodes.pdf
binarycodes.pdf
 
Number system
Number systemNumber system
Number system
 
Floyd_CH2.ppt
Floyd_CH2.pptFloyd_CH2.ppt
Floyd_CH2.ppt
 
ENGINEERING ELECTRONICS SEMESTER FIVE COMM
ENGINEERING ELECTRONICS SEMESTER FIVE COMMENGINEERING ELECTRONICS SEMESTER FIVE COMM
ENGINEERING ELECTRONICS SEMESTER FIVE COMM
 
Number system
Number systemNumber system
Number system
 
Number Codes and Registers
Number Codes and RegistersNumber Codes and Registers
Number Codes and Registers
 
Digital electronics
Digital electronicsDigital electronics
Digital electronics
 
DESIGN OF COMBINATIONAL LOGIC
DESIGN OF COMBINATIONAL LOGICDESIGN OF COMBINATIONAL LOGIC
DESIGN OF COMBINATIONAL LOGIC
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Information sheet/Kertas Penerangan
Information sheet/Kertas PeneranganInformation sheet/Kertas Penerangan
Information sheet/Kertas Penerangan
 
Lecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfLecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdf
 
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...
12.Representation of signed binary numbers.  Binary codes - BCD code, Gray co...12.Representation of signed binary numbers.  Binary codes - BCD code, Gray co...
12.Representation of signed binary numbers. Binary codes - BCD code, Gray co...
 

Plus de School of Design Engineering Fashion & Technology (DEFT), University of Wales, Newport (8)

Number bases
Number basesNumber bases
Number bases
 
Sequential Logic
Sequential LogicSequential Logic
Sequential Logic
 
Logic Equation Simplification
Logic Equation SimplificationLogic Equation Simplification
Logic Equation Simplification
 
Stabilised Power Supplies
Stabilised Power SuppliesStabilised Power Supplies
Stabilised Power Supplies
 
Amplifier Compensation
Amplifier CompensationAmplifier Compensation
Amplifier Compensation
 
Counter And Sequencer Design- Student
Counter And Sequencer Design- StudentCounter And Sequencer Design- Student
Counter And Sequencer Design- Student
 
Chapter 6 Probability
Chapter 6  ProbabilityChapter 6  Probability
Chapter 6 Probability
 
Chapter 4 Integration
Chapter 4  IntegrationChapter 4  Integration
Chapter 4 Integration
 

Dernier

How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 

Dernier (20)

How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 

Number codes

  • 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.
  • 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
  • 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
  • 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