Various Codes

Embed Size (px)

Citation preview

  • 7/27/2019 Various Codes

    1/15le goes here

    1

    CCooddeess

    2

    Codes

    Codes are groupings of symbols thatCodes are groupings of symbols thatare used for information exchange...are used for information exchange...

    Examples ?

    3

    Example: Morse code (1844)

    Used in telegraphy today is a historical code4

    Example: Braille code

  • 7/27/2019 Various Codes

    2/15le goes here

    5

    Example: Nautical flag code

    6

    Example: Maya code-numbers

    7

    Example: Maya code (?)

    8

    Binary Codes

    To represent a group of 2 distinctTo represent a group of 2 distinctelements in a binary code, it requireselements in a binary code, it requiresa minimum ofa minimum of nn--bitsbits..

    n

  • 7/27/2019 Various Codes

    3/15le goes here

    9

    Example-1

    It is known that a digital computer usesIt is known that a digital computer usestwo states that are represented with:two states that are represented with:thethe zerozero andand thethe oneone..

    10

    Example-1 It is known that a digital computer uses two states thatIt is known that a digital computer uses two states that

    are represented with:are represented with: thethe zerozero andand thethe oneone..

    A group ofA group of fourfour different binary elementsdifferent binary elementscan be represented withcan be represented with 22 bits.bits.

    0 0

    0 1

    1 0

    1 1

    4

    2

    0

    1

    2

    3

    11

    Example-2

    A group of eight distinct elements can beA group of eight distinct elements can berepresented by 3 bits.represented by 3 bits.

    00 00 00

    00 00 11

    00 11 00

    00 11 11

    11 00 00

    11 00 11

    11 11 00

    11 11 11

    12

    Special Codes

  • 7/27/2019 Various Codes

    4/15le goes here

    13

    Special Codes

    88--44--22--11

    BCDBCD

    ExcessExcess--33

    AikenAiken

    22--outout--ofof--55

    14

    Binary (8-4-2-1)

    Weighted Code

    84218421

    00 00000000

    11 00010001

    22 00100010

    33 00110011

    44 01000100

    55 01010101

    66 01100110

    77 01110111

    88 10001000

    99 10011001

    1010 10101010

    1111 10111011

    1212 11001100

    1313 11011101

    1414 11101110

    1515 11111111

    15

    Binary Coded Decimal (BCD)

    BCDBCD

    00 00000000

    11 00010001

    22 00100010

    33 00110011

    44 01000100

    55 01010101

    66 01100110

    77 01110111

    88 1000100099 10011001

    10101010

    10111011

    11001100

    11011101

    11101110

    11111111

    n

    o

    t

    u

    s

    e

    d

    16

    Excess-3 (XS3)

    XS3XS3

    00000000

    00010001

    00100010

    00 00110011

    11 01000100

    22 01010101

    33 01100110

    44 01110111

    55 10001000

    66 10011001

    77 10101010

    88 10111011

    99 11001100

    11011101

    11101110

    11111111

  • 7/27/2019 Various Codes

    5/15le goes here

    17

    Excess-3 (XS3)XS3XS3

    00000000

    00010001

    00100010

    00 00110011

    11 01000100

    22 01010101

    33 01100110

    44 01110111

    55 10001000

    66 10011001

    77 10101010

    88 10111011

    99 11001100

    11011101

    11101110

    11111111

    Symmetric code

    18

    Aiken codeAikenAiken

    00 00000000

    11 00010001

    22 00100010

    33 00110011

    44 01000100

    01010101

    01100110

    01110111

    10001000

    10011001

    10101010

    55 10111011

    66 11001100

    77 11011101

    88 1110111099 11111111

    2-4-2-1 Code

    19

    Aiken code

    AikenAiken

    00 00000000

    11 00010001

    22 00100010

    33 00110011

    44 01000100

    01010101

    01100110

    01110111

    1000100010011001

    10101010

    55 10111011

    66 11001100

    77 11011101

    88 11101110

    99 11111111

    Symmetric code

    2-4-2-1 Code

    20

    2-out-of-5

    It is used as ErrorDetecting Code; natural even parity

    VeryPracticalCode

    22--outout--ofof--55

    00 1100011000

    11 0001100011

    22 0010100101

    33 0011000110

    44 0100101001

    55 0101001010

    66 0110001100

    77 1000110001

    88 1001010010

    99 1010010100

  • 7/27/2019 Various Codes

    6/15le goes here

    21

    2-out-of-5

    22--outout--ofof--55

    00 1100011000

    11 0001100011

    22 0010100101

    33 0011000110

    44 0100101001

    55 0101001010

    66 0110001100

    77 1000110001

    88 1001010010

    99 1010010100Except for the zero (0)which is decimal 24. The

    rest of the code followsthe weights: 74210 22

    2-out-of-5

    This code is used by theU.S. Postal Service---- Zip Code

    23

    The first and last bars are the frame bars, used for aligningthe scanner which reads the bar-code. The last digits areused for error correction (checksum)..

    24

    0 7 0 2 4 4 9 0 5

    The first and last bars are the frame bars, used for aligningthe scanner which reads the bar-code. The last digits areused for error correction (checksum)..

  • 7/27/2019 Various Codes

    7/15le goes here

    25

    Bar Code based codes

    11--D codesD codes

    22--D codesD codes

    PracticalCodes

    1-D and 2-D Codes will not be included in the exams 26

    1-D codes

    Code 39 = Code 3Code 39 = Code 3--ofof--9; alphanumeric (full ASCII)9; alphanumeric (full ASCII)bar code;bar code;applications in inventory, asset tracking, ID badgesapplications in inventory, asset tracking, ID badges

    27

    1-D codes

    Code 39 = Code 3Code 39 = Code 3--ofof--9; alphanumeric (full ASCII)9; alphanumeric (full ASCII)bar code;bar code;applications in inventory, asset tracking, ID badgesapplications in inventory, asset tracking, ID badges

    Interleaved 2 of 5 ; NumericInterleaved 2 of 5 ; Numeric--only bar code,only bar code,industrial applications, carton labeling, laboratoryindustrial applications, carton labeling, laboratory

    usesuses

    28

    1-D codes

    Code 39 = Code 3Code 39 = Code 3--ofof--9; alphanumeric (full ASCII)9; alphanumeric (full ASCII)bar code;bar code;applications in inventory, asset tracking, ID badgesapplications in inventory, asset tracking, ID badges

    Interleaved 2 of 5 ; NumericInterleaved 2 of 5 ; Numeric--only bar code,only bar code,industrial applications, carton labeling, laboratoryindustrial applications, carton labeling, laboratory

    usesuses UPC (Universal Product Code), Numeric Bar code;UPC (Universal Product Code), Numeric Bar code;

    used in retail product labeling.used in retail product labeling.

  • 7/27/2019 Various Codes

    8/15le goes here

    29

    1-D codes

    Code 39 = Code 3Code 39 = Code 3--ofof--9; alphanumeric (full ASCII)9; alphanumeric (full ASCII)bar code;bar code;applications in inventory, asset tracking, ID badgesapplications in inventory, asset tracking, ID badges

    Interleaved 2 of 5 ; NumericInterleaved 2 of 5 ; Numeric--only bar code,only bar code,industrial applications, carton labeling, laboratoryindustrial applications, carton labeling, laboratoryusesuses

    UPC (Universal Product Code), Numeric Bar code;UPC (Universal Product Code), Numeric Bar code;used in retail product labeling.used in retail product labeling.

    Code 128Code 128 Alphanumeric (full ASCII);Alphanumeric (full ASCII);

    applications in Shipping, Warehouse management.applications in Shipping, Warehouse management.30

    2-D code

    --PDF417;PDF417;applications web postage stamp..applications web postage stamp..

    31

    PDF417

    32

    PDF417

  • 7/27/2019 Various Codes

    9/15le goes here

    33

    Alphanumeric codes

    Used to print, teletype or view informationUsed to print, teletype or view informationor other means of human alphaor other means of human alpha--numericnumericcommunication.communication.

    34

    Alphanumeric codes

    Used to print, teletype or view informationUsed to print, teletype or view informationor other means of human alphaor other means of human alpha--numericnumericcommunication.communication.

    EBCIDIC

    ASCII

    UniCode

    35

    EBCIDIC

    EBCIDICEBCIDIC ((EExtendedxtended BCD IBCD Interchangenterchange CCode):ode):

    8 bits = 256 characters.8 bits = 256 characters.

    36

    ASCII

    EBCIDIC (Extended BCD Interchange Code):EBCIDIC (Extended BCD Interchange Code):8 bits = 256 characters.8 bits = 256 characters.

    ASCII (AASCII (Americanmerican SStandardtandard CCodeode forforIInformationnformation IInterchangenterchange):):

    7 bits = 128 characters (now Super7 bits = 128 characters (now SuperASCII use all 8ASCII use all 8--bits ).bits ).

  • 7/27/2019 Various Codes

    10/15le goes here

    37

    ASCII

    38

    Unicode

    EBCIDIC (Extended BCD Interchange Code):EBCIDIC (Extended BCD Interchange Code):8 bits = 256 characters.8 bits = 256 characters.

    ASCII (American Standard Code forASCII (American Standard Code forInformation Interchange):Information Interchange):7 bits = 128 characters.7 bits = 128 characters.

    Unicode (New standard for 16Unicode (New standard for 16 bitbitalphanumeric codes)alphanumeric codes)

    39

    A useful code is the Gray

    Gray code is of cyclic nature having theGray code is of cyclic nature having thefollowing property:following property:

    From one number to the next, the Gray codeFrom one number to the next, the Gray codechanges only one bitchanges only one bit

    40

    Bit changes

    Gray code is of cyclic nature having the following property:Gray code is of cyclic nature having the following property:

    From one number to the next, the Gray codeFrom one number to the next, the Gray code changes onlychanges onlyone bitone bit

    Binary

    00

    01 1

    10 2

    11 1

    Gray

    00

    01 1

    11 1

    10 1

  • 7/27/2019 Various Codes

    11/15le goes here

    41

    Gray Code

    The Gray code is used for labeling KarnaughThe Gray code is used for labeling Karnaughmaps for logic circuit simplification, formaps for logic circuit simplification, forrouting in parallel computer systems,routing in parallel computer systems,etc..etc..

    42

    Gray Codes

    43

    Gray Codes

    44

    Gray Codes

  • 7/27/2019 Various Codes

    12/15le goes here

    45

    Binary and BCD numbers

    Bits obtained from conversion, ofBits obtained from conversion, ofbinary numbers, are binary digitsbinary numbers, are binary digits

    46

    Binary and BCD numbers

    Bits obtained from conversion, ofBits obtained from conversion, ofbinary numbers, are binary digitsbinary numbers, are binary digits

    Bits obtained from coding (BCD) areBits obtained from coding (BCD) arecombinations of 1s and 0s arrangedcombinations of 1s and 0s arrangedaccording to the rules of the codeaccording to the rules of the code(BCD).(BCD).

    47

    Example-1

    (13)(13)1010 = (1101)= (1101)22,,

    48

    Example-1

    (13)(13)1010 = (1101)= (1101)22,,

    butbut,,

    (13)(13)1010 = (0001 0011)= (0001 0011)BCDBCD

    (1 3)(1 3)1010

  • 7/27/2019 Various Codes

    13/15le goes here

    49

    Example-2

    (7)(7)1010 = (111)= (111)22,,

    50

    Example-2

    (7)(7)1010 = (111)= (111)22,,

    but,but,

    (0111)(0111)BCDBCD

    771010

    51

    Another Example

    (15)(15)1010 = (1111)= (1111)22,,

    but,but,

    (15)(15)1010 = (0001 0101)= (0001 0101)BCDBCD

    (1 5)(1 5)1010

    52

    Binary & BCD

    ((1515))1010

  • 7/27/2019 Various Codes

    14/15le goes here

    53

    Binary & BCD

    ((1515))1010

    ((11111111))22 ()()BCDBCD

    54

    Binary & BCD

    ((1515))1010

    ((11111111))22 ((00010001 01010101))BCDBCD

    END

    55

    New codes

    56

    Code-A

    AA

    00 00000000

    11 00010001

    22 00100010

    00110011

    01000100

    33 01010101

    44 01100110

    01110111

    1000100055 10011001

    66 10101010

    10111011

    11001100

    77 11011101

    88 11101110

    99 11111111

    Symmetric code

  • 7/27/2019 Various Codes

    15/15

    57

    Code-BBB

    00 00000000

    11 00010001

    22 00100010

    00110011

    01000100

    01010101

    33 01100110

    44 01110111

    55 10001000

    66 10011001

    10101010

    10111011

    11001100

    77 11011101

    88 1110111099 11111111

    Symmetric code

    58

    Code-CCC

    00 00000000

    11 00010001

    22 00100010

    33 00110011

    01000100

    01010101

    01100110

    44 01110111

    55 10001000

    10011001

    10101010

    10111011

    66 11001100

    77 11011101

    88 1110111099 11111111

    Symmetric code