Computer Data Formats:
For
programming the microprocessor understanding of different data formats. This is
necessary because in different data formats the same number is represented differently.
Following are some of the common data formats used for programming the
microprocessor.
1)
ASCII
data formats
ASCII stands for American standard code for
information interchange. It is used to represent alphanumeric characters in the
memory of computer system. The standard ASCII code is a 7 bit code with the 8th
bit is used as sign bit or parity bit. (If the ASCII data is used with printer
the MSB bit is 0 for alphanumeric printing &1 for graphics printing. In
many computer systems extended ASCII characters set is used by placing logic 1
at MSB position. This character set also contain some control characters such
as clear screen, backspace; line feed etc.)
2)
Binary
coded Decimal (BCD):-
This is another commonly used data formats in
computer systems. The range of BCD numbers is from 0 to 9. The BCD data can be
represented using either packed or unpacked format. In packed BCD format,
2digits are stored per byte. In unpacked BCD format 1 digit is stored per byte.
Table below shows some example & BCD data.
Decimal |
Packed BCD |
Unpacked BCD |
12 |
0001 0010 |
0000 0001 0000 0010 |
623 |
0000 0110 0001 0011 |
0000 0000 0000 0010 0000 0011 |
3)Byte Sized Data (BSD):-
In this data formats one digit is stored per byte.
Byte sized data is stored either as signed or unsigned form. The difference
between these two formats is that for signed integers the range is -128 to +128
& for unsigned integers it is from +128 to 0. For MSB position the range of
signed integers is from 0 to 127. In this format negative integers are
represented using 2’s compliment form. Figure below shows representation of
byte sized data.
128
64 32 16 8 4 2 1 ____________________________________________________________________ |
|||||||
|
|
|
|
|
|
|
|
Unsigned Byte
-128
64 32 16 8 4 2
1 _______________________________________________________________________ |
|||||||
|
|
|
|
|
|
|
|
Signed Byte
4)Word Sized Data:-
In this data format a word (16 bits) is formed using
2 bytes of data. An important characteristic of this format is that, when a
word is stored in computers memory LSB byte is stored in lower memory. Location
& MSB byte is stored in higher memory location.
For example word size data 1234H
is stored in computer memory as follows
The word sized data can also be signed or unsigned.
5) Real Numbers:-
Real number is also as floating point number. This
type of number contains two parts called as fraction (mantissa) & exponent
(significant). In this format 4 byte real number is called single precision
& 8086 byte number is called as double precision. Figure below shows
representation of real numbers.
0 Comments