SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
Dr. (Mrs.) Gargi Khanna
Associate Professor
Electronics & Communication Engg. Deptt..
National Institute of Technology Hamirpur
(HP)
By:-
o Codes
o Weighted and unweighted codes
o BCD, Excess-3, 2421, 84-2-1
o Gray Code
o Alphanumeric Code, Unicode
 Code:A set of n-bit strings in which different bit strings
represent different numbers or other things.
 Code word: a particular combination of n-bit values
N-bit strings =2N valid code words.
 To represent 10 decimal digits, at least need 4 bits.
 Excessive ways to choose ten 4-bit words. Some
common codes:
 BCD: Binary-coded decimal, also known as 8421 code
 2421,5421, Excess-3, Gray,
 Codes can be used to represent:
Numericals, Nonnumerical texts, Symbols
Events/Actions/States/Conditions
In weighted code, each digit position has a weight
or value. The sum of all digits multiplied by a
weight gives the total amount being represented.
We can express any decimal number in tens,
hundreds, thousands and so on.
Eg:- (4327)10= 4(10³)+3(10²)+2(10¹)+7(100)
BCD or 8421 is a type of weighted code where each
digit position is being assigned a specific weight.
 Positively weighted codes: All the weights asigned
to binary bits are positive
 17 positively weighted codes
 The first weight must be 1, second weight must be 1 or
2 and the sum of all weights must be equal and greater
than 9
 Eg 8421, 2421, 5211, 3321, 4311.
 Negatively weighted codes: some of the weights
assigned to binary bits are negative
 Eg 642-3, 84-2-1,74-2-1, 631-1
 In non-weighted code, there is no positional weight i.e.
each position within the binary number is not assigned
a prefixed value. No specific weights are assigned to bit
position in non –weighted code.
 The non-weighted codes are:-
 a) The Gray code b) The Excess-3 code
 Four bits are used to represent each decimal digit
 In each 4-bit group, 6 values are not used
 Many possible codes, natural BCD 8421 (equivalent
binary digits) most common
 BCD is not as efficient as binary
 BCD is easy to convert to/from decimal (it really is
decimal with different symbols)
 BCD add/subtract circuits are complex
Decimal
digit
BCD
8421 2421 5421 8 4 -2 -1 6 4 2 -3
Excess-
3
0 0000 0000 0000 0000 0000 0011
1 0001 0001 0001 0111 0101 0100
2 0010 0010 0010 0110 0010 0101
3 0011 0011 0011 0101 1001 0110
4 0100 0100 0100 0100 0100 0111
5 0101 1011 1000 1011 1011 1000
6 0110 1100 1001 1010 1000 1001
7 0111 1101 1010 1001 1101 1010
8 1000 1110 1011 1000 1010 1011
9 1001 1111 1100 1111 1111 1100
Positively Weighted codes Unweighted code
Negatively Weighted codes
Convert following to BCD form
a) 567310 b) 34210 c) 21810
Convert following BCD to their decimal equivalent
a) 10000110 b) 00110010.10010100
Convert the following binary numbers to
their BCD equivalent.
a) 1101.012 b) 11.0112
(Binary to decimal, then decimal to BCD)
 The codes representing the pair of complementary digits
are also complementary to each other.
 Example: Excess-3 code 0: 0011
1: 0100
2: 0101
3: 0110
4: 0111
5: 1000
6: 1001
7: 1010
8: 1011
9: 1100
241: 0101 0111 0100
758: 1010 1000 1011
 Gray codes are minimum change codes
 From one numeric representation to the next,
only one bit changes
 Primary use is in numeric input encoding apps.
where we expect non-random input values
changes (I.e. value n to either n-1 or n+1)
 Rotary shaft position
Binary to gray conversion:-
a)The MSB in the Gray code is same as the
corresponding bit in the binary number.
b)Going from left to right, add each adjacent pair of
binary bit to get next gray code bit and discard
carry
Gray to binary conversion:-
a)TheMSB is the binary code is
same as corresponding digit in the gray code.
b)Add each binary digit generated to the gray digit
in the next adjacent position and discard carry.
Binary
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Gray
0000
0001
0011
0010
0110
0111
0101
0100
1100
1101
1111
1110
1010
1011
1001
1000
Gray Code
0 = 0000
1 = 0001
2 = 0011
3 = 0010
4 = 0110
5 = 1110
6 = 1010
7 = 1011
8 = 1001
9 = 1000
A Gray code changes by only 1 bit for
adjacent values. This is also called a
‘thumbwheel’ code because a
thumbwheel for choosing a decimal
digit can only change to an adjacent
value with each click of the
thumbwheel. This allows the binary
output of the thumbwheel to only
change one bit at a time; this can help
reduce circuit complexity, reduce signal
noise and result in less switching
events. Less switching results in
reduction in power dissipation
 Binary codes used to represent alphabetic and numeric
characters, symbols, control function
 Most common are:
 ASCII, 7 bit code, 128 symbols
 EBCDIC, 8 bit code, 256 symbols
 Unicode, 16 bit code
 Problems can arise when comparing symbol values
(collation)
 Comparing ‘A’ to ‘a’ in ASCII system yields different
results in an EBCDIC system.
 ASCII table
CS2100Number Systems and Codes 18
MSBs
LSBs 000 001 010 011 100 101 110 111
0000 NUL DLE SP 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 “ 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EOT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ‘ 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L  l |
1101 CR GS - = M ] m }
1110 O RS . > N ^ n ~
1111 SI US / ? O _ o DEL
A: 1000001
Functions ASCII Extended Code
39 Equivalent *
Hex Value Description
F1 17 $Q 11 DC1
F2 18 $R 12 DC2
F3 19 $S 13 DC3
F4 20 $T 14 DC4
F5 21 $U 15 NAK
F6 22 $V 16 SYN
F7 23 $W 17 ETB
F8 24 $X 18 CN
F9 25 $Y 19 EM
F10 26 $Z 1A SUB
F11 27 %B 1C FS
F12 28 %C 1D GS
UNICODE is a 16-bit code for representing
alphanumeric data. With 16 bits, can represent 65536
different symbols.
16 bits = 2 Bytes per character.
$0041-005A A-Z
$0061-4007A a-z
Some other alphabet/symbol ranges
$3400-3d2d Korean Hangul Symbols
$3040-318F Hiranga, Katakana, Bopomofo, Hangul
$4E00-9FFF Han (Chinese, Japenese, Korean)
UNICODE used by Web browsers, Java, most software
these days.
 Due to the limitation of 7-bit ASCII code, American
National Standard Institute (ANSI) also extend the 7-
bit ASCII code to 8-bit code, known as Latin-I.
 Latin-I is an ISO standard.
 However, the 8-bit code still not adequate for
representing all possible characters in use Unicode.
 Unicode can represent 65,536 characters, of which
approximately 49,000 have been defined.
 More recent standard, Unicode 3.1 supports millions of
different characters.
 Unicode is multilingual in the most global sense.
 The usual floating point number
format consist of:
 A sign bit.
 An exponent
 A mantissa.
 Different input devices are used for converting original
data into computer format.
 Keyboard: Generate binary number code for each key.
 Microphone: Convert analog sound into binary data
using ADC.
 Camera: Convert analog picture into binary data using
ADC.
 Etc.
 Many different standards in use for different types of data. Some
common data representation are:
Type of data Standard
Alphanumeric ASCII, EBCDIC, Unicode
Image (bitmap) GIF(graphical image format), TIFF (tagged
image file format), PNG (portable network
graphics)
Image (object) PostScript, JPEG, SWF (Macromedia Flash),
SVG.
Outline graphics and
fonts
PostScript, TrueType
Sound WAV, AVI, MP3, MIDI, WMA
Page description Pdf (Adobe Portable Document Format),
HTML, XML.
Video Quicktime, MPEG-2, WMV
Binary codes

Más contenido relacionado

La actualidad más candente

Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 
Weighted and Non Weighted Codes
Weighted and Non Weighted CodesWeighted and Non Weighted Codes
Weighted and Non Weighted CodesSubhamSatpathy2
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmeticgavhays
 
Dlc{binary to gray code conversion} ppt
Dlc{binary to gray code conversion} pptDlc{binary to gray code conversion} ppt
Dlc{binary to gray code conversion} pptTanish Gupta
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesstudent
 
What is bcd number system
What is bcd number systemWhat is bcd number system
What is bcd number systemMuhammad Shahid
 
BOOLEAN ALGEBRA AND LOGIC GATE
BOOLEAN ALGEBRA AND LOGIC GATE BOOLEAN ALGEBRA AND LOGIC GATE
BOOLEAN ALGEBRA AND LOGIC GATE Tamim Tanvir
 
Digital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsDigital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsImran Waris
 
Decoder Full Presentation
Decoder Full Presentation Decoder Full Presentation
Decoder Full Presentation Adeel Rasheed
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital ElectronicsJanki Shah
 
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
 
Fixed point and floating-point numbers
Fixed point and  floating-point numbersFixed point and  floating-point numbers
Fixed point and floating-point numbersMOHAN MOHAN
 

La actualidad más candente (20)

Binary arithmetic
Binary arithmeticBinary arithmetic
Binary arithmetic
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
Bcd
BcdBcd
Bcd
 
Binary codes
Binary codesBinary codes
Binary codes
 
Chapter 4: Combinational Logic
Chapter 4: Combinational LogicChapter 4: Combinational Logic
Chapter 4: Combinational Logic
 
Encoder
EncoderEncoder
Encoder
 
Weighted and Non Weighted Codes
Weighted and Non Weighted CodesWeighted and Non Weighted Codes
Weighted and Non Weighted Codes
 
BCD ADDER
BCD ADDER BCD ADDER
BCD ADDER
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Digital Logic circuit
Digital Logic circuitDigital Logic circuit
Digital Logic circuit
 
Dlc{binary to gray code conversion} ppt
Dlc{binary to gray code conversion} pptDlc{binary to gray code conversion} ppt
Dlc{binary to gray code conversion} ppt
 
BCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codesBCD,GRAY and EXCESS 3 codes
BCD,GRAY and EXCESS 3 codes
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
 
What is bcd number system
What is bcd number systemWhat is bcd number system
What is bcd number system
 
BOOLEAN ALGEBRA AND LOGIC GATE
BOOLEAN ALGEBRA AND LOGIC GATE BOOLEAN ALGEBRA AND LOGIC GATE
BOOLEAN ALGEBRA AND LOGIC GATE
 
Digital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systemsDigital and Logic Design Chapter 1 binary_systems
Digital and Logic Design Chapter 1 binary_systems
 
Decoder Full Presentation
Decoder Full Presentation Decoder Full Presentation
Decoder Full Presentation
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
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
 
Fixed point and floating-point numbers
Fixed point and  floating-point numbersFixed point and  floating-point numbers
Fixed point and floating-point numbers
 

Similar a Binary codes

review of number systems and codes
review of number systems and codesreview of number systems and codes
review of number systems and codessrinu247
 
Lecture 5 binary_codes
Lecture 5 binary_codesLecture 5 binary_codes
Lecture 5 binary_codesKamran Zafar
 
Binary to gray converter using xor
Binary to gray converter using xor Binary to gray converter using xor
Binary to gray converter using xor DINESH DEVIREDDY
 
Digital logic degin, Number system
Digital logic degin, Number systemDigital logic degin, Number system
Digital logic degin, Number systemAshish Kumar Thakur
 
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdfCDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdfshubhangisonawane6
 
Number System[HEXADECIMAL].pptx
Number System[HEXADECIMAL].pptxNumber System[HEXADECIMAL].pptx
Number System[HEXADECIMAL].pptxMaheShiva
 
Lecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfLecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfUmerKhan147799
 
004 NUMBER SYSTEM (1).pdf
004 NUMBER SYSTEM (1).pdf004 NUMBER SYSTEM (1).pdf
004 NUMBER SYSTEM (1).pdfMaheShiva
 
Octal to binary and octal to hexa decimal conversions
Octal to binary and octal to hexa decimal conversionsOctal to binary and octal to hexa decimal conversions
Octal to binary and octal to hexa decimal conversionsAfrasiyab Haider
 
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
 

Similar a Binary codes (20)

Digital electronics
Digital electronicsDigital electronics
Digital electronics
 
. 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
 
Lecture 5 binary_codes
Lecture 5 binary_codesLecture 5 binary_codes
Lecture 5 binary_codes
 
Binary to gray converter using xor
Binary to gray converter using xor Binary to gray converter using xor
Binary to gray converter using xor
 
Number system
Number systemNumber system
Number system
 
Digital logic degin, Number system
Digital logic degin, Number systemDigital logic degin, Number system
Digital logic degin, Number system
 
Codes r005
Codes  r005Codes  r005
Codes r005
 
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdfCDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
 
Number System[HEXADECIMAL].pptx
Number System[HEXADECIMAL].pptxNumber System[HEXADECIMAL].pptx
Number System[HEXADECIMAL].pptx
 
Number Codes and Registers
Number Codes and RegistersNumber Codes and Registers
Number Codes and Registers
 
binarycodes.pdf
binarycodes.pdfbinarycodes.pdf
binarycodes.pdf
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral Systems
 
Lecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdfLecture5 Chapter1- Binary Codes.pdf
Lecture5 Chapter1- Binary Codes.pdf
 
004 NUMBER SYSTEM (1).pdf
004 NUMBER SYSTEM (1).pdf004 NUMBER SYSTEM (1).pdf
004 NUMBER SYSTEM (1).pdf
 
Computer-codes.pptx
Computer-codes.pptxComputer-codes.pptx
Computer-codes.pptx
 
Octal to binary and octal to hexa decimal conversions
Octal to binary and octal to hexa decimal conversionsOctal to binary and octal to hexa decimal conversions
Octal to binary and octal to hexa decimal conversions
 
BCDCONVERTER.pptx
BCDCONVERTER.pptxBCDCONVERTER.pptx
BCDCONVERTER.pptx
 
DLD-W3-L1.pptx
DLD-W3-L1.pptxDLD-W3-L1.pptx
DLD-W3-L1.pptx
 
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...
 

Más de GargiKhanna1

Latch & Flip-Flop.pptx
Latch & Flip-Flop.pptxLatch & Flip-Flop.pptx
Latch & Flip-Flop.pptxGargiKhanna1
 
Digital Counter Design
 Digital Counter Design Digital Counter Design
Digital Counter DesignGargiKhanna1
 
Latch and flip flop
Latch and flip flopLatch and flip flop
Latch and flip flopGargiKhanna1
 
Multiplexers and Demultiplexers
Multiplexers and DemultiplexersMultiplexers and Demultiplexers
Multiplexers and DemultiplexersGargiKhanna1
 
Combinational Logic Circuit
Combinational Logic CircuitCombinational Logic Circuit
Combinational Logic CircuitGargiKhanna1
 
Error detection and correction codes
Error detection and correction codesError detection and correction codes
Error detection and correction codesGargiKhanna1
 
Logic Level Techniques for Power Reduction
Logic Level Techniques for Power Reduction Logic Level Techniques for Power Reduction
Logic Level Techniques for Power Reduction GargiKhanna1
 
Architectural Level Techniques
Architectural Level TechniquesArchitectural Level Techniques
Architectural Level TechniquesGargiKhanna1
 
Probabilistic Power Analysis
Probabilistic Power AnalysisProbabilistic Power Analysis
Probabilistic Power AnalysisGargiKhanna1
 
Monte carlo analysis
Monte carlo analysisMonte carlo analysis
Monte carlo analysisGargiKhanna1
 
Simulation power analysis low power vlsi
Simulation power analysis   low power vlsiSimulation power analysis   low power vlsi
Simulation power analysis low power vlsiGargiKhanna1
 
Boolean Function SOP & POS
Boolean Function SOP &  POSBoolean Function SOP &  POS
Boolean Function SOP & POSGargiKhanna1
 

Más de GargiKhanna1 (18)

Latch & Flip-Flop.pptx
Latch & Flip-Flop.pptxLatch & Flip-Flop.pptx
Latch & Flip-Flop.pptx
 
MOS logic family
MOS logic familyMOS logic family
MOS logic family
 
Digital Counter Design
 Digital Counter Design Digital Counter Design
Digital Counter Design
 
Latch and flip flop
Latch and flip flopLatch and flip flop
Latch and flip flop
 
Multiplexers and Demultiplexers
Multiplexers and DemultiplexersMultiplexers and Demultiplexers
Multiplexers and Demultiplexers
 
Combinational Logic Circuit
Combinational Logic CircuitCombinational Logic Circuit
Combinational Logic Circuit
 
Karnaugh Map
Karnaugh MapKarnaugh Map
Karnaugh Map
 
Error detection and correction codes
Error detection and correction codesError detection and correction codes
Error detection and correction codes
 
Number system
Number system Number system
Number system
 
Logic Level Techniques for Power Reduction
Logic Level Techniques for Power Reduction Logic Level Techniques for Power Reduction
Logic Level Techniques for Power Reduction
 
Architectural Level Techniques
Architectural Level TechniquesArchitectural Level Techniques
Architectural Level Techniques
 
Probabilistic Power Analysis
Probabilistic Power AnalysisProbabilistic Power Analysis
Probabilistic Power Analysis
 
Monte carlo analysis
Monte carlo analysisMonte carlo analysis
Monte carlo analysis
 
Simulation power analysis low power vlsi
Simulation power analysis   low power vlsiSimulation power analysis   low power vlsi
Simulation power analysis low power vlsi
 
Boolean Function SOP & POS
Boolean Function SOP &  POSBoolean Function SOP &  POS
Boolean Function SOP & POS
 
Logic gate
Logic gateLogic gate
Logic gate
 
Logic Gates
Logic GatesLogic Gates
Logic Gates
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 

Último

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 

Último (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

Binary codes

  • 1. Dr. (Mrs.) Gargi Khanna Associate Professor Electronics & Communication Engg. Deptt.. National Institute of Technology Hamirpur (HP) By:-
  • 2. o Codes o Weighted and unweighted codes o BCD, Excess-3, 2421, 84-2-1 o Gray Code o Alphanumeric Code, Unicode
  • 3.  Code:A set of n-bit strings in which different bit strings represent different numbers or other things.  Code word: a particular combination of n-bit values N-bit strings =2N valid code words.  To represent 10 decimal digits, at least need 4 bits.  Excessive ways to choose ten 4-bit words. Some common codes:  BCD: Binary-coded decimal, also known as 8421 code  2421,5421, Excess-3, Gray,  Codes can be used to represent: Numericals, Nonnumerical texts, Symbols Events/Actions/States/Conditions
  • 4. In weighted code, each digit position has a weight or value. The sum of all digits multiplied by a weight gives the total amount being represented. We can express any decimal number in tens, hundreds, thousands and so on. Eg:- (4327)10= 4(10³)+3(10²)+2(10¹)+7(100) BCD or 8421 is a type of weighted code where each digit position is being assigned a specific weight.
  • 5.  Positively weighted codes: All the weights asigned to binary bits are positive  17 positively weighted codes  The first weight must be 1, second weight must be 1 or 2 and the sum of all weights must be equal and greater than 9  Eg 8421, 2421, 5211, 3321, 4311.  Negatively weighted codes: some of the weights assigned to binary bits are negative  Eg 642-3, 84-2-1,74-2-1, 631-1
  • 6.  In non-weighted code, there is no positional weight i.e. each position within the binary number is not assigned a prefixed value. No specific weights are assigned to bit position in non –weighted code.  The non-weighted codes are:-  a) The Gray code b) The Excess-3 code
  • 7.  Four bits are used to represent each decimal digit  In each 4-bit group, 6 values are not used  Many possible codes, natural BCD 8421 (equivalent binary digits) most common  BCD is not as efficient as binary  BCD is easy to convert to/from decimal (it really is decimal with different symbols)  BCD add/subtract circuits are complex
  • 8. Decimal digit BCD 8421 2421 5421 8 4 -2 -1 6 4 2 -3 Excess- 3 0 0000 0000 0000 0000 0000 0011 1 0001 0001 0001 0111 0101 0100 2 0010 0010 0010 0110 0010 0101 3 0011 0011 0011 0101 1001 0110 4 0100 0100 0100 0100 0100 0111 5 0101 1011 1000 1011 1011 1000 6 0110 1100 1001 1010 1000 1001 7 0111 1101 1010 1001 1101 1010 8 1000 1110 1011 1000 1010 1011 9 1001 1111 1100 1111 1111 1100 Positively Weighted codes Unweighted code Negatively Weighted codes
  • 9. Convert following to BCD form a) 567310 b) 34210 c) 21810 Convert following BCD to their decimal equivalent a) 10000110 b) 00110010.10010100 Convert the following binary numbers to their BCD equivalent. a) 1101.012 b) 11.0112 (Binary to decimal, then decimal to BCD)
  • 10.  The codes representing the pair of complementary digits are also complementary to each other.  Example: Excess-3 code 0: 0011 1: 0100 2: 0101 3: 0110 4: 0111 5: 1000 6: 1001 7: 1010 8: 1011 9: 1100 241: 0101 0111 0100 758: 1010 1000 1011
  • 11.
  • 12.  Gray codes are minimum change codes  From one numeric representation to the next, only one bit changes  Primary use is in numeric input encoding apps. where we expect non-random input values changes (I.e. value n to either n-1 or n+1)  Rotary shaft position
  • 13. Binary to gray conversion:- a)The MSB in the Gray code is same as the corresponding bit in the binary number. b)Going from left to right, add each adjacent pair of binary bit to get next gray code bit and discard carry
  • 14. Gray to binary conversion:- a)TheMSB is the binary code is same as corresponding digit in the gray code. b)Add each binary digit generated to the gray digit in the next adjacent position and discard carry.
  • 16. Gray Code 0 = 0000 1 = 0001 2 = 0011 3 = 0010 4 = 0110 5 = 1110 6 = 1010 7 = 1011 8 = 1001 9 = 1000 A Gray code changes by only 1 bit for adjacent values. This is also called a ‘thumbwheel’ code because a thumbwheel for choosing a decimal digit can only change to an adjacent value with each click of the thumbwheel. This allows the binary output of the thumbwheel to only change one bit at a time; this can help reduce circuit complexity, reduce signal noise and result in less switching events. Less switching results in reduction in power dissipation
  • 17.  Binary codes used to represent alphabetic and numeric characters, symbols, control function  Most common are:  ASCII, 7 bit code, 128 symbols  EBCDIC, 8 bit code, 256 symbols  Unicode, 16 bit code  Problems can arise when comparing symbol values (collation)  Comparing ‘A’ to ‘a’ in ASCII system yields different results in an EBCDIC system.
  • 18.  ASCII table CS2100Number Systems and Codes 18 MSBs LSBs 000 001 010 011 100 101 110 111 0000 NUL DLE SP 0 @ P ` p 0001 SOH DC1 ! 1 A Q a q 0010 STX DC2 “ 2 B R b r 0011 ETX DC3 # 3 C S c s 0100 EOT DC4 $ 4 D T d t 0101 ENQ NAK % 5 E U e u 0110 ACK SYN & 6 F V f v 0111 BEL ETB ‘ 7 G W g w 1000 BS CAN ( 8 H X h x 1001 HT EM ) 9 I Y i y 1010 LF SUB * : J Z j z 1011 VT ESC + ; K [ k { 1100 FF FS , < L l | 1101 CR GS - = M ] m } 1110 O RS . > N ^ n ~ 1111 SI US / ? O _ o DEL A: 1000001
  • 19. Functions ASCII Extended Code 39 Equivalent * Hex Value Description F1 17 $Q 11 DC1 F2 18 $R 12 DC2 F3 19 $S 13 DC3 F4 20 $T 14 DC4 F5 21 $U 15 NAK F6 22 $V 16 SYN F7 23 $W 17 ETB F8 24 $X 18 CN F9 25 $Y 19 EM F10 26 $Z 1A SUB F11 27 %B 1C FS F12 28 %C 1D GS
  • 20. UNICODE is a 16-bit code for representing alphanumeric data. With 16 bits, can represent 65536 different symbols. 16 bits = 2 Bytes per character. $0041-005A A-Z $0061-4007A a-z Some other alphabet/symbol ranges $3400-3d2d Korean Hangul Symbols $3040-318F Hiranga, Katakana, Bopomofo, Hangul $4E00-9FFF Han (Chinese, Japenese, Korean) UNICODE used by Web browsers, Java, most software these days.
  • 21.  Due to the limitation of 7-bit ASCII code, American National Standard Institute (ANSI) also extend the 7- bit ASCII code to 8-bit code, known as Latin-I.  Latin-I is an ISO standard.  However, the 8-bit code still not adequate for representing all possible characters in use Unicode.  Unicode can represent 65,536 characters, of which approximately 49,000 have been defined.  More recent standard, Unicode 3.1 supports millions of different characters.  Unicode is multilingual in the most global sense.
  • 22.  The usual floating point number format consist of:  A sign bit.  An exponent  A mantissa.
  • 23.  Different input devices are used for converting original data into computer format.  Keyboard: Generate binary number code for each key.  Microphone: Convert analog sound into binary data using ADC.  Camera: Convert analog picture into binary data using ADC.  Etc.
  • 24.  Many different standards in use for different types of data. Some common data representation are: Type of data Standard Alphanumeric ASCII, EBCDIC, Unicode Image (bitmap) GIF(graphical image format), TIFF (tagged image file format), PNG (portable network graphics) Image (object) PostScript, JPEG, SWF (Macromedia Flash), SVG. Outline graphics and fonts PostScript, TrueType Sound WAV, AVI, MP3, MIDI, WMA Page description Pdf (Adobe Portable Document Format), HTML, XML. Video Quicktime, MPEG-2, WMV