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

Number system conversation_class

number system

Uploaded by

amsini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Number system conversation_class

number system

Uploaded by

amsini
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Unit 1

Serial Communication

Serial communication is a method of transmitting data one bit at a time,


sequentially, over a communication channel or bus. It is commonly used in
Input/Output (I/O) organization for devices that need to send or receive data over
long distances or with limited data lines.

Key Characteristics of Serial Communication

1. Sequential Data Transfer:


o Data is transmitted bit by bit in a sequence.
o Compared to parallel communication, it requires fewer wires, making
it cost-effective and simpler to implement over long distances.
2. Transmission Modes:
o Asynchronous: Data is sent without a common clock signal. Start
and stop bits are used to frame the data, and devices must agree on a
baud rate (bits per second).
o Synchronous: Data is transmitted with a clock signal that
synchronizes the sending and receiving devices, allowing continuous
data flow.
3. Protocols:
o Serial communication often uses specific protocols to ensure data
integrity and compatibility between devices, such as RS-232, RS-485,
UART, SPI, and I2C.
4. Speed:
o Typically slower than parallel communication due to the sequential
nature of data transfer.
o The speed depends on the baud rate, with typical values ranging from
9600 to several megabits per second.

Components in Serial Communication

1. Transmitter (Tx): Converts parallel data into a serial bitstream for


transmission.
2. Receiver (Rx): Converts the received serial bitstream back into parallel data.
3. Clock Signal: (In synchronous communication) Ensures timing
synchronization between devices.

Advantages

 Reduced Complexity: Fewer wires reduce hardware complexity and cost.


 Long-Distance Communication: Less susceptible to crosstalk and signal
degradation compared to parallel communication.
 Flexibility: Can be used for a wide variety of devices, including
microcontrollers, sensors, and computers.
Disadvantages

 Slower Speed: Limited data transfer rate compared to parallel


communication.
 Increased Latency: The time taken to transmit a single bit increases overall
data transfer time.

Applications in Input/Output Organization

1. Microcontrollers and Microprocessors:


o Used to communicate with peripherals like sensors, displays, and
storage devices.
o Common protocols include UART and I2C.
2. Computers:
o USB (Universal Serial Bus) is a widely used serial communication
standard for connecting devices like keyboards, mice, and external
drives.
3. Networking:
o Ethernet and fiber-optic systems use serial communication for
transmitting data over long distances.
4. Embedded Systems:
o Widely used in embedded systems for inter-device communication due
to its simplicity and reliability.

Comparison with Parallel Communication


Feature Serial Communication Parallel Communication

Data Transmission Bit by bit Multiple bits simultaneously

Wiring Fewer wires More wires

Cost Low High

Speed Slower Faster

Distance Suitable for long distances Limited to short distances

Serial communication is a fundamental concept in I/O organization, balancing


simplicity and cost-effectiveness for many applications.
Concept of Interrupts in I/O

An interrupt is a signal sent to the processor to indicate that an I/O device


requires attention. Instead of the processor continuously polling the device for its
status (polling method), the device sends an interrupt signal when it is ready to
send or receive data.

Types of Interrupts

1. Input Interrupt:
o Triggered when an input device has data ready for the processor.
o Example: A keyboard sending an interrupt when a key is pressed.
2. Output Interrupt:
o Triggered when an output device is ready to accept more data.
o Example: A printer sending an interrupt when it is ready for the next
character to print.

Interrupt Process

1. Interrupt Request:
o The I/O device sends an interrupt signal to the processor.
2. Interrupt Detection:
o The processor detects the interrupt signal while executing
instructions.
3. Interrupt Acknowledgment:
o The processor stops its current task and acknowledges the interrupt.
4. Interrupt Service Routine (ISR):
o The processor jumps to a predefined memory location containing the
ISR, which handles the specific interrupt.
5. Resuming Execution:
o Once the ISR is complete, the processor resumes the interrupted task.

Advantages of Interrupts

1. Efficient CPU Utilization:


o The processor can perform other tasks instead of waiting for the I/O
device.
2. Asynchronous Operation:
o I/O devices operate independently, notifying the processor only when
needed.
3. Reduced Latency:
o Immediate attention to high-priority tasks, improving system
responsiveness.
Types of Interrupt Handling

1. Vectored Interrupts:
o The interrupting device provides a specific address for the ISR.
o Example: Devices with unique interrupt vector numbers.
2. Non-Vectored Interrupts:
o The ISR address is fixed and not device-specific.
o Example: A generic ISR for multiple devices.

Hardware Implementation

1. Interrupt Request Line (IRQ):


o A dedicated line in the control bus for sending interrupt signals.
2. Interrupt Enable Bit:
o A control bit in the processor to enable or disable interrupts.
3. Interrupt Priority:
o If multiple devices can send interrupts, priority schemes determine
the order of servicing.

Input and Output Handling

Input Devices:

 Keyboard Example:
1. A key press generates an interrupt.
2. The processor reads the ASCII value of the key from the input port.
3. An ISR processes the key input, storing it in memory.

Output Devices:

 Printer Example:
1. The printer sends an interrupt when it is ready to accept data.
2. The processor sends a character to the printer port.
3. The ISR ensures that the next character is ready for transmission.

Polling vs. Interrupts


Feature Polling Interrupts

Continuously checks device


Processor Role Waits for device signal
status

Efficient, CPU does other


Efficiency Inefficient, CPU remains busy
tasks
Feature Polling Interrupts

Latency High latency Low latency

Implementation Simpler to implement Requires interrupt hardware

Applications in Basic Computer Design

1. Input Devices:
o Keyboards, mouse, barcode scanners, etc.
2. Output Devices:
o Printers, monitors, actuators, etc.
3. Hybrid Devices:
o Communication ports like USB, serial ports, etc., use interrupts for
both input and output operations.

By enabling asynchronous I/O operations, interrupts optimize the interaction


between the processor and I/O devices, ensuring better performance and
responsiveness.

Number systems are foundational to computer systems because they represent and
process data in a form that machines can understand and manipulate. Computers
operate using electrical signals, and number systems provide a structured way to
represent these signals as numbers, characters, and operations.

Key Number Systems Used in Computers

1. Binary (Base-2):
o Digits: 0 and 1.
o Usage: Core representation of data in computers.
o Why?:
 Computers use binary because they operate using two voltage
levels, typically represented as 0 (low/off) and 1 (high/on).
o Examples:
 Storing data in memory.
 Machine-level instructions.
 Representing logic gates' operations (AND, OR, NOT).
2. Decimal (Base-10):
o Digits: 0 to 9.
o Usage:
 Human-readable format for input/output.
 Often used in software for user interfaces and displaying
results.
o Conversion:
 Computers convert decimal numbers into binary for internal
processing.
3. Octal (Base-8):
o Digits: 0 to 7.
o Usage:
 Compact representation of binary numbers.
 Used in older systems and some programming languages for
grouping binary data (e.g., UNIX file permissions).
o Example:
 Binary: 11011011 → Octal: 333.
4. Hexadecimal (Base-16):
o Digits: 0 to 9, A to F (where A = 10, B = 11, ..., F = 15).
o Usage:
 Efficient representation of large binary numbers.
 Widely used in programming, debugging, and memory
addressing.
o Example:
 Binary: 11111111 → Hexadecimal: FF.

How Number Systems Are Used in Computer Systems

1. Data Representation:
o Binary is used to represent all types of data, including text, images,
and audio, by encoding them into sequences of 0s and 1s.
o ASCII and Unicode use binary codes for characters.
2. Arithmetic and Logic Operations:
o Computers perform calculations and logical decisions using binary
arithmetic and Boolean logic.
3. Memory Addressing:
o Memory locations are often represented using hexadecimal for
convenience due to its compactness.
4. Programming:
o Binary, octal, and hexadecimal numbers are used in low-level
programming (e.g., assembly language) and debugging.
o For example, bitwise operations (shifting, masking) often involve
binary or hexadecimal representations.
5. Networking:
o IP addresses and subnet masks are represented in binary or
hexadecimal formats.
6. Color Representation:
o RGB color codes in graphics and web development are often expressed
in hexadecimal (e.g., #FF5733).
7. Error Detection and Correction:
o Parity bits and cyclic redundancy checks (CRC) use binary operations
for error detection and correction.

Advantages of Using Number Systems

1. Efficiency:
o Binary representation simplifies circuit design and operations.
2. Compactness:
o Hexadecimal and octal make binary data easier to read and debug.
3. Universality:
o Standardized number systems facilitate communication and
processing across platforms.

Example in Practice

 Suppose a computer stores the number 10 in memory. Internally:


o Decimal Input: 101010.
o Binary Storage: 101021010_210102.
o Hexadecimal Representation for Memory Address: A16A_{16}A16.
o Display Output: 101010 (converted back to decimal for the user).

Number systems form the backbone of data representation and processing in


computer systems, enabling efficient computation and communication between
hardware and software.

Number system conversation


Decimal Number – Base 10 – N10
Binary Number – Base 2 – N2
Octal Number – Base 8 – N8
Hexadecimal Number – Base 16 – N16

Number System Conversion Table


Binary Octal Decimal Hexadecimal
Numbers Numbers Numbers Numbers
0000 0 0 0
0001 1 1 1
0010 2 2 2
0011 3 3 3
0100 4 4 4
0101 5 5 5
0110 6 6 6
0111 7 7 7
1000 10 8 8
1001 11 9 9
1010 12 10 A
1011 13 11 B
1100 14 12 C
1101 15 13 D
1110 16 14 E
1111 17 15 F
Decimal to Binary Conversion

Converting a decimal number to binary involves dividing the decimal number by 2 and
recording the remainders. The binary number is then formed by arranging these remainders in
reverse order.

Steps for Conversion

1. Divide the Decimal Number by 2:


o Record the remainder (either 0 or 1). This will represent a binary digit.
2. Repeat the Division:
o Divide the quotient by 2, recording the remainder each time, until the quotient
becomes 0.
3. Write the Remainders in Reverse Order:
o The first remainder is the least significant bit (LSB), and the last remainder is the
most significant bit (MSB).
Binary in Computer Systems

1. Core Representation:
o Computers store all data in binary because they operate using two states: ON (1)
and OFF (0).
2. Applications:
o Memory Addressing: Binary numbers identify specific locations in memory.
o Machine Code: Instructions to the CPU are in binary.
o Logic Gates: Binary inputs determine the output of logical operations.

Decimal to binary conversion is a crucial skill in understanding computer systems, as binary


is the fundamental language of computers.
Before converting the numbers from decimal to hexadecimal, first, understand
the meaning of the decimal and hexadecimal number system. The base of a decimal
number system is 10 and is also called a radix. Hence, it has ten symbols, more
precisely the numbers from 0 to 9, i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
The base or radix of a hexadecimal number system is 16. Being a base-16 numeral
system, it uses 16 symbols.
These include ten decimal digits, i.e., 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and the first six
letters of the English alphabet, i.e. A, B, C, D, E, F.
However, these letters are used to represent the values 10, 11, 12, 13, 14 and 15
respectively in one single figure.

Convert Decimal to Hexadecimal


The conversion of decimal numbers to hexadecimal numbers is a very easy task. It
can be done with the help of a conversion table. If one memorizes this table, he/she
can easily convert a decimal number to a hexadecimal number. For the decimal
numbers from 1 to 15, there is an equivalent hexadecimal number. But how to
convert the decimal number if it is more than 15. Then we need to follow a different
procedure.
If any given number is more than 15, then we have to divide the decimal number
by 16 and consider the remainder to get the equivalent hexadecimal number. The
complete procedure we have explained here step by step. But before learning the
steps let us see the table, where for each value of the decimal number from 0 to 15,
there is an equivalent hexadecimal number given.

Decimal to Hexadecimal Table


To convert the decimal number system to hex, students have to remember the table
given below, to solve the problems in a quick way.

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Number

Equivalent 0123456789A B C D E F
Hexadecimal

Decimal to Hexadecimal Example Problems


To convert decimal to octal, we have to learn about both the number systems
first. A number with base 8 is the octal number and a number with base 10 is the
decimal number. Here we will convert a decimal number to an equivalent octal
number. It is the same as converting any decimal number to binary or decimal to
hexadecimal.
In decimal to binary, we divide the number by 2, in decimal to hexadecimal we
divide the number by 16. In case of decimal to octal, we divide the number by 8
and write the remainders in the reverse order to get the equivalent octal number.
Decimal Number: All the numbers to the base ten are called decimal numbers.
These are the commonly used numbers, which are 0-9. It has both integer part and
the decimal part. It is separated by a decimal point (.). Numbers on the left of the
decimal are integers and numbers on the right of the decimal is the decimal part.
Example: (236.89)10, (54.2)10, etc.
Octal number: These are the numbers with base 8.
Convert Decimal to Octal with Steps

Decimal to Octal Conversion

Converting a decimal number to octal involves dividing the decimal number by 8 and
recording the remainders. The octal number is then formed by arranging these remainders in
reverse order.

Steps for Conversion

1. Divide the Decimal Number by 8:


o Record the remainder (ranging from 0 to 7).
2. Repeat the Division:
o Divide the quotient by 8, recording the remainder each time, until the quotient
becomes 0.
3. Write the Remainders in Reverse Order:
o The first remainder is the least significant digit (rightmost), and the last remainder is
the most significant digit (leftmost).
Applications of Octal in Computer Systems

1. Compact Binary Representation:


o Octal is used as a shorthand for binary numbers, where each octal digit corresponds
to three binary bits.
2. Programming:
o Octal literals are used in some programming languages (e.g., file permissions in
UNIX: chmod 755).
3. Error Checking:
o Easier to read and debug than binary for certain low-level tasks.

Decimal to octal conversion is particularly useful in scenarios requiring compact


representation of binary data.

You might also like