0% found this document useful (0 votes)
25 views

Computer Codes

Computer Codes

Uploaded by

Savinu Gamage
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Computer Codes

Computer Codes

Uploaded by

Savinu Gamage
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

COMPUTER CODES CHAPTER 02

DATA FORMATS
Computers
 Process and store all forms of data in binary format
Human communication
 Includes language, images and sounds
Data formats:
 Specifications for converting data into computer-
usable form
 Define the different ways human data may be
represented, stored and processed by a computer
INTRODUCTION
Real World Computer
Data Input device Data
10101010

Dear Mom: Keyboard 10110010…

Digital
10110010…
Camera
SOURCES OF DATA
Binary input
 Begins as discrete input
 Example: keyboard input such as A 1+2=3 math
 Keyboard generates a binary number code for each key
Analog
 Continuous data such as sound or images
 Requires hardware to convert data into binary numbers

Computer
A 1+2=3 math Input
device
1101000101010101…
STANDARDS ORGANIZATIONS

ISO – International Standards Organization


CSA – Canadian Standards Association
ANSI – American National Standards Institute
IEEE – Institute for Electrical and Electronics Engineers
COMMON DATA REPRESENTATIONS
Type of Data Standard(s)

Alphanumeric Unicode, ASCII, EDCDIC,BCD

Image (bitmapped) ▪GIF (graphical image format)


▪TIF (tagged image file format)
▪PNG (portable network graphics)

Sound WAV, AVI, MP3, MIDI, WMA

Video(Motion Picture) Quicktime, MPEG-2, RealVideo, WMV


WHY STANDARDS?
Standard are “arbitrary”
They exist because they are
Convenient
Efficient
Flexible
Appropriate
Etc.
DATA TYPES
DATA TYPES: NUMERIC
Used for mathematical manipulation
Add, subtract, multiply, divide

Types
Integer (whole number)
Real (contains a decimal point)
DATA TYPES: ALPHANUMERIC
Alphanumeric:
 Characters: b T
 Number digits: 7 9
 Punctuation marks: ! ;
 Special-purpose characters: $ &
Four standards for representing letters (alpha) and
numbers
 BCD – Binary-coded decimal
 EBCDIC – Extended binary-coded decimal interchange code
 ASCII – American standard code for information interchange
 Unicode
COMPUTER CODES
❑A computer is a digital system that stores and processes different
types of data in the form of 0s and 1s.
❑The different types of data handled by a computer system
include numbers, alphabets and some special characters.
❑Therefore, there is a need to change the data entered by the
users into a form that the computer system can understand and
process.
❑Different types of codes have been developed and used to
represent the data entered by the users in the binary format.
❑The binary system represents each type of data in terms of
binary digits, 0s and 1s.
❑Since these codes convert the data into the binary form, the
computer codes are also referred as binary codes.
BINARY SYSTEM TERMS
The following are some of the technical terms used in binary system:
Bit: It is the smallest unit of information used in a computer system. It can
either have the value 0 or 1. Derived from the words Binary ditIT.
Nibble: It is a combination of 4 bits.
Byte: It is a combination of 8 bits.
Word: It is a combination of 16 bits.
Double word: It is a combination of 32 bits.
Kilobyte (KB): It is used to represent the 1024 bytes of information.
Megabyte (MB): It is used to represent the 1024 KBs of information.
Gigabyte (GB): It is used to represent the 1024 MBs of information.
BINARY CODED DECIMAL (BCD)
SYSTEMS
4-BIT BINARY CODED DECIMAL
(BCD) SYSTEMS
4-BIT BINARY CODED DECIMAL
(BCD) SYSTEMS
The BCD system is employed by computer systems to
encode the decimal number into its equivalent binary
number.
This is generally accomplished by encoding each digit of
the decimal number into its equivalent binary sequence.
The main advantage of BCD system is that it is a fast and
efficient system to convert the decimal numbers into binary
numbers as compared to the pure binary system.
4-BIT BINARY CODED DECIMAL
(BCD) SYSTEMS
The 4-bit BCD system is usually employed by the computer
systems to represent and process numerical data only. In
the 4-bit BCD system, each digit of the decimal number is
encoded to its corresponding 4-bit binary sequence. The
two most popular 4-bit BCD systems are:

•Weighted 4-bit BCD code


•Excess-3 (XS-3) BCD code
WEIGHTED 4-BIT BCD CODE
❑ The weighted 4-bit BCD code is more commonly known as
8421 weighted code.

❑ It is called weighted code because it encodes the decimal


system into binary system by using the concept of positional
weighting into consideration.

❑ In this code, each decimal digit is encoded into its 4-bit


binary number in which the bits from left to right have the
weights 8, 4, 2, and 1, respectively.
709310 = ? (in BCD)
WEIGHTED
4-BIT BCD CODE
Note: the following
bit patterns are not
used:
1010
1011
1100
1101
1110
1111
8-BIT BINARY CODED DECIMAL
(BCD) SYSTEMS
8-BIT BCD SYSTEMS
❑The 6-bit BCD systems can handle numeric as well as
non-numeric data but with few special characters.
❑The 8-bit BCD systems were developed to overcome
the limitations of 6-bit BCD systems, which can handle
numeric as well as nonnumeric data with almost all the
special characters such as +, -, *, /, @, $, etc.
❑Therefore, the various codes under the category of
8-bit BCD systems are also known as alphanumeric
codes.
8-BIT BCD SYSTEMS

The three most popular 8-bit BCD codes are:

•Extended Binary Coded Decimal Interchange Code (EBCDIC)


•American Standard Code for Information Interchange (ASCII)
•Gray Code
EBCDIC CODE
❑The EBCDIC code is an 8-bit alphanumeric code that was
developed by IBM to represent alphabets, decimal digits and
special characters, including control characters.

❑The EBCDIC codes are generally the decimal and the


hexadecimal representation of different characters.

❑This code is rarely used by non IBM-compatible computer systems.


EBCDIC CONT
Extended Binary Coded Decimal Interchange Code
developed by IBM
 Restricted mainly to IBM or IBM compatible mainframes
 Conversion software to/from ASCII available
 Common in archival data
 Character codes differ from ASCII

ASCII EBCDIC
Space 2016 4016
A 4116 C116
b 6216 8216
ASCII CODE
❑The ASCII code is pronounced as ASKEE and is used for the
same purpose for which the EBCDIC code is used. However, this
code is more popular than EBCDIC code as unlike the EBCDIC
code this code can be implemented by most of the non-IBM
computer systems.

❑Initially, this code was developed as a 7-bit BCD code to handle


128 characters but later it was modified to an 8-bit code.
ASCII
ASCII
Developed by ANSI (American National
Standards Institute)
Represents
Latin alphabet, Arabic numerals, standard
punctuation characters
Plus small set of accents and other European special
characters
ASCII REFERENCE TABLE
MSD
LSD 0 1 2 3 4 5 6 7
0 NUL DLE SP 0 @ P p
1 SOH DC1 ! 1 A Q a W
2 STX DC2 “ 2 B R b r
3 ETX DC3 # 3 C S c s
4 EOT DC4 $ 4 D T d t
5 ENQ NAK % 5 E U e u
7416
6 ACJ SYN & 6 F V f v
111 0100
7 BEL ETB ‘ 7 G W g w
8 BS CAN ( 8 H X h x
9 HT EM ) 9 I Y i y
A LF SUB * : J Z j z
B VT ESC + ; K [ k {

C FF FS , < L \ l |
D CR GS - = M ] m }
E SO RS . > N ^ n ~
F SI US / ? O _ o DEL
WHAT IS MSD & LSD?

You can easily see that a change in the MSD will


increase or decrease the value of the number the
greatest amount. Changes in the LSD will have the
smallest effect on the value.
RADIX POINT

In a whole number the LSD will always be the digit immediately to the
left of the radix point.
HOW ?
UNICODE

Most common 16-bit form represents 65,536


characters
Encoding Forms : UTF-8 , UTF-16 , UTF-32
Multilingual: defines codes for
 Nearly every character-based alphabet
 Large set of ideographs for Chinese, Japanese and
Korean
 Composite characters for vowels and syllabic clusters
required by some languages
UNICODE

Most common 16-bit form represents 65,536


characters
Encoding Forms : UTF-8 , UTF-16 , UTF-32
Multilingual: defines codes for
 Nearly every character-based alphabet
 Large set of ideographs for Chinese, Japanese and
Korean
 Composite characters for vowels and syllabic clusters
required by some languages
UTF - 8

UTF-8 (8-bit Unicode Transformation


Format) is a fixed-length encoding
used to encode Unicode code points
that uses exactly 8 bits (ONE byte) per
code point
UTF - 32

UTF-32 (32-bit Unicode Transformation Format) is


a fixed-length encoding used to encode Unicode
code points that uses exactly 32 bits (four bytes)
per code point
UTF – 32
COLLATING SEQUENCE
SORTING IN EBCDIC
SORTING IN ASCII

You might also like