0% found this document useful (0 votes)
20 views33 pages

002 Vomputervvv 7

Unsigned numbers contain only the magnitude and no sign. All unsigned binary numbers are therefore positive. Signed numbers contain both a sign and magnitude, with the most significant bit used as the sign bit where 0 indicates positive and 1 indicates negative. There are three common representations for signed binary numbers: sign-magnitude, 1's complement, and 2's complement. Characters are represented using character encoding schemes like ASCII which maps 7-bit binary codes to letters, numbers and symbols. Extended ASCII and EBCDIC are 8-bit extensions of the ASCII encoding standard.

Uploaded by

loljhg
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)
20 views33 pages

002 Vomputervvv 7

Unsigned numbers contain only the magnitude and no sign. All unsigned binary numbers are therefore positive. Signed numbers contain both a sign and magnitude, with the most significant bit used as the sign bit where 0 indicates positive and 1 indicates negative. There are three common representations for signed binary numbers: sign-magnitude, 1's complement, and 2's complement. Characters are represented using character encoding schemes like ASCII which maps 7-bit binary codes to letters, numbers and symbols. Extended ASCII and EBCDIC are 8-bit extensions of the ASCII encoding standard.

Uploaded by

loljhg
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/ 33

Signed and

unsigned number
unSigned number
Unsigned numbers contain only magnitude of the number. They don’t have
any sign. That means all unsigned binary numbers are positive. As in
decimal number system, the placing of positive sign in front of the number is
optional for representing positive numbers. Therefore, all positive numbers
including zero can be treated as unsigned numbers if positive sign is not
assigned in front of the number.
Representation of unsigned binary numbers
The bits present in the un-signed binary number holds the magnitude of a
number. That means, if the un-signed binary number contains ‘N’ bits, then
all N bits represent the magnitude of the number, since it doesn’t have any
sign bit.
Example:
Consider the decimal number 108. The binary equivalent of this number is
1101100. This is the representation of unsigned binary number.
10810 = 11011002
Signed number
Signed numbers contain both sign and magnitude of the number. Generally,
the sign is placed in front of number. So, we have to consider the positive
sign for positive numbers and negative sign for negative numbers.
Therefore, all numbers can be treated as signed numbers if the
corresponding sign is assigned in front of the number.
If sign bit is zero, which indicates the binary number is positive. Similarly, if
sign bit is one, which indicates the binary number is negative.
Representation of signed binary number
The Most Significant Bit (MSB) of signed binary numbers is used to indicate the
sign of the numbers. Hence, it is also called as sign bit. The positive sign is
represented by placing ‘0’ in the sign bit. Similarly, the negative sign is represented
by placing ‘1’ in the sign bit.

If the signed binary number contains ‘N’ bits, then N−1 bits only represent the
magnitude of the number since one bit MSB is reserved for representing sign of
the number.There are three types of representations for signed binary numbers

● Sign-Magnitude form
● 1’s complement form
● 2’s complement form
Representation of a positive number in all these 3 forms is same. But, only the
representation of negative number will differ in each form.
Example:
Consider the positive decimal number +108. The binary equivalent of magnitude of this
number is 1101100. These 7 bits represent the magnitude of the number 108. Since it is
positive number, consider the sign bit as zero, which is placed on left most side of
magnitude.
+10810 = 011011002

Therefore, the signed binary representation of positive decimal number +108 is 𝟎𝟏𝟏𝟎𝟏𝟏𝟎𝟎.
So, the same representation is valid in sign-magnitude form, 1’s complement form and 2’s
complement form for positive decimal number +108.
Sign-Magnitude form
In sign-magnitude form, the MSB is used for representing sign of the number and the
remaining bits represent the magnitude of the number. So, just include sign bit at the
left most side of unsigned binary number. This representation is similar to the signed
decimal numbers representation.
Example:
Consider the negative decimal number -108. The magnitude of this number is 108.
We know the unsigned binary representation of 108 is 1101100. It is having 7 bits. All
these bits represent the magnitude.
Since the given number is negative, consider the sign bit as one, which is placed on
left most side of magnitude.
−10810 = 111011002

Therefore, the sign-magnitude representation of -108 is 11101100.


1’s complement form
The 1’s complement of a number is obtained by complementing all the bits of signed binary
number. So, 1’s complement of positive number gives a negative number. Similarly, 1’s
complement of negative number gives a positive number.
That means, if you perform two times 1’s complement of a binary number including sign bit,
then you will get the original signed binary number.
Example:
Consider the negative decimal number -108. The magnitude of this number is 108. We
know the signed binary representation of 108 is 01101100.
It is having 8 bits. The MSB of this number is zero, which indicates positive number.
Complement of zero is one and vice-versa. So, replace zeros by ones and ones by zeros in
order to get the negative number.
−10810 = 100100112

Therefore, the 1’s complement of 10810 is 100100112.


2’s complement form
The 2’s complement of a binary number is obtained by adding one to the 1’s complement
of signed binary number. So, 2’s complement of positive number gives a negative number.
Similarly, 2’s complement of negative number gives a positive number.
That means, if you perform two times 2’s complement of a binary number including sign
bit, then you will get the original signed binary number.
Example:
Consider the negative decimal number -108.
We know the 1’s complement of (108)10 is (10010011)2
2’s complement of 10810 = 1’s complement of 10810 + 1 = 10010011 + 1

= 10010100
Therefore, the 2’s complement of 10810 is 100101002.
Character
representation
04. CHARACTER REPRESENTATION
So far we have discussed how to represent numbers (0 and positive
integers, negative and real numbers), but as well as numbers,
computers often need to represent characters and textual
information, such as text displayed on a screen or printer, word
processor files, HTML, programming language source code, and
much more.
● Data refers to the symbols that represent people, events, things,
and ideas. Data can be a name, a number, the colors in a
photograph, or the notes in a musical composition.
● As a result, all characters, whether they are letters, punctuation
or digits, are stored as binary numbers. All of the characters that
a computer can use are called a character set.
● Character representation is how numbers and letters are
represented by a specific group of symbols. This process is
called encoding.
Decimal encoding
BCD
In Binary-Coded Decimal (BCD), 4 bits are used to encode each decimal digit.
The names 8-4-2-1, 4-2-2-1 and 7-4-2-1 come from the denary value
represented by a binary 1 in the corresponding column.
Decimal Digit 8421 BCD 4221 BCD 7421 BCD

0 0000 0000 0000

1 0001 0001 0001

2 0010 0100 or 0010 0010

3 0011 0101 or 0011 0011

4 0100 1000 or 0110 0100

5 0101 1001 or 0111 0101

6 0110 1100 or 1010 0110

7 0111 1101 or 1011 1000 or 0111

8 1000 1110 1001

9 1001 1111 1010


COnversion of decimal number to bcd
(i) (17)10 = 0001 0111 BCD
100012
0001 0111

(ii) (156)10 = 0001 0101 0110 BCD


Conversion of BCD to decimal
10100 BCD =
0001 0100
1410
character encoding
ASCII
● Historically, and possibly still today, the most common standard for
character encoding is ASCII (pronounced "as key") which stands for the
American Standard Code for Information Interchange, which was
originally created in 1963.
● ASCII was originally developed in the United States, it was subsequently
adapted for use in many other countries. The original and primary variant is
sometimes referred to as US-ASCII as it includes the characters needed US
English and US typographical symbols.
ASCII cont.

● ASCII is a 7-bit code, which means that 7 binary digits are used to
represent each character. This allows for 128 different characters (27),
from 0000000 binary (0 decimal, 0 hexadecimal) to 1111111 binary (127
decimal 7F hexadecimal).
● 95 of the 128 characters in ASCII are printable characters. In
US-ASCII, this includes the letters A to Z in both upper and lower case,
the digits 0 to 9, and a variety of punctuation and typographic symbols.
As already mentioned, non-US variants of ASCII may substitute some
country-specific characters, generally for some of the US punctuation
characters or typographic symbols.
● 33 of the 128 characters are non-printable control codes that were
originally intended for a variety of functions
Extended ASCIIs
● Also known as ASCII 8
● As we have already mentioned ASCII is a 7-bit character-encoding, but the many
computers are based around 8-bit bytes.
● Using 8-bits per character allows up to 256 different characters, from 0000000
binary (0 denary, 0 hexadecimal) to 1111111 binary (127 decimal, 7F hexadecimal).
NOTE
● The character codes are grouped and run in sequence; i.e. If A is 65 then C must
be 67.
● The pattern applies to other groupings such as digits and lowercase letters, so you
can say that since 7 is 55, 9 must be 57.
● Notice that the ASCII code value for 5 (0011 0101) is different from the pure
binary value for 5 (0000 0101). That's why you cannot calculate with
numbers which are input as strings.
● Another example, the ASCII value 0011 0100 will print the character 4, the
binary value is actually equal to the decimal number 52.
EBCDIC
● The character encoding that IBM developed was called EBCDIC (pronounced
“ebb-see-dik”) which stands for Extended Binary-Coded Decimal Interchange
Code.
● EBCDIC is an 8-bit code, which means that 8 binary digits are used to represent
each character. This potentially allows for 256 different characters, from 0000000
binary (0 decimal, 0 hexadecimal) to 11111111 binary (255 decimal, FF
hexadecimal). However, in EBCDIC not all combinations are considered valid or
used.
● As is the case with ASCII, EBCDIC includes both printable characters and
non-printable control characters.
● The ordering of the characters in EBCDIC can be somewhat surprising. For example,
in ASCII the 26 letters of the alphabet have consecutive character codes (from 65
denary to 90 denary for uppercase letters, and from 97 denary to 122 denary for
lowercase letters). In contrast in EBCDIC, the letters do not have consecutive codes.
● The EBCDIC character set does not include several of the characters commonly
used in programming and network communications such as curly braces { }.
UNICODE
The biggest limitation with ASCII and EBCDIC is the relatively small number of
different characters available. While enough characters are available for English
text, neither has nearly enough characters available to support the full range of
widely used typographical and mathematical symbols, let alone all accented
Latin characters, national currency symbols, and the various alphabets and
symbols used in languages such as Chinese, Korean, Japanese,
Greek,Russian, Arabic and Hebrew.
The solution to this issue was the development of Unicode (also known as the
Universal Coded Character Standard or UCS which potentially allows for up
to 1,114,112 different characters (although only 149,186 have been defined as of
September 2022 in the Unicode 15.0.0 standard)
● Provides a consistent way of encoding multilingual text
● Defines codes for characters used in all major languages of the world
● Defines codes for special characters, mathematical symbols, technical
symbols etc.
● Capacity to encode as many as a million characters
● Assigns each character a unique numeric
● Affords simplicity and consistency of ASCII, even corresponding characters
have same code
● Some Unicode character encodings include: UTF-8, UTF-16, UTF-32
Error detection &
correction
Error detection
In the case of digital systems set up, error occurrence is a common
phenomenon. And for that the first step is to detect the error and after that
errors are corrected.The most common cause for errors is that the noise
creeps into the bit stream during the course of transmission from the
transmitter to the receiver. And if these errors are not detected and
corrected the result could be disastrous as the digital systems are very
much sensitive to errors and will malfunction due to the slightest of errors in
transmitted codes.

We will discuss the use Parity checking method for error detection and
correction such as the addition of extra bits which are also called check
bits, sometimes they are also called redundant bits as they don’t have any
information in them.
Parity checking
PARITY BIT
A parity bit is added to the transmitted strings of bits during transmission from
transmitters to detect any error in the data when they are received at the
receiver end. Basically, a parity code is nothing but an extra bit added to the
string of data. Now there are two types of parity these are even parity and odd
parity.

In even parity, the total number of bits which are set to 1 in the data is counted:
if the total is odd then the parity bit is set to 1, but if the total is even then the
parity bit is set to 0. Thus, in even parity, the total number of bits set to 1
(including both the data and the parity bit itself) will always
be even.
Here are some examples of even parity:

If we need to generate a parity bit, using an even parity protocol, for the
data 1010011, the parity bit would be 0 (as there are already four 1s, an
even number of 1s, in the data). The byte would hold 01010011.

If we need to generate a parity bit, using an even parity protocol, for the
data 1010010, the parity bit would be 1 (as there are three 1s, an odd
number of 1s, in the data, and we need one more 1 to get an even number
of 1s). The byte would hold 11010010.
In odd parity, the total number of bits which are set to 1 in the data is counted: if
the total is odd then the parity bit is set to 0, but if the total is even then the parity
bit is set to 1. Thus, in odd parity, the total number of bits set to 1 (including both
the data and the parity bit itself) will always be odd.

Here are some examples of odd parity:

If we need to generate a parity bit, using an odd parity protocol, for the
data 1010011, the parity bit would be 1 (as there are four 1s, an even
number of 1s, in the data, and we need one more 1 to get an odd number
of 1s). The byte would hold 11010011.
If we need to generate a parity bit, using an odd parity protocol, for the
data 1010010, the parity bit would be 0 (as there are already three 1s, an
odd number of 1s, in the data). The byte would hold 01010010.

You might also like