Вы находитесь на странице: 1из 58

Computer Hardware Requirements for

Real-Time Applications

Real-Time Systems, ١
Lecture Outline:
➢ Features of microcomputers and microcontrollers.
➢ Standard interfacing techniques.
➢ Digital input/output interface.
➢ Analog input/output interface.
➢ Pulse input/output interface.
➢ Data acquisition system design.
➢ Management of data acquisition system.

Real-Time Systems, Prof. Kasim Al-Aubidy ٢


Microcomputers & Microcontrollers:
•General purpose microprocessors include the Intel xx86 series, Motorola 680xx
series, National 32xxx series, and the Zilog Z8000 series.
•The ALU together with control unit and the general purpose registers make up the
CPU.
•The CPU, memory and input/output units represent a microcomputer. The CPU in a
single chip microcomputer or a microcomputer board is called microprocessor.

Real-Time Systems, Prof. Kasim Al-Aubidy %


Computer Architecture:
1. The Von Neumann System.
2. The Harvard System.

Real-Time Systems, Prof. Kasim Al-Aubidy 7


GENERAL PURPOSE COMPUTER

Schematic of a General Purpose Computer


General-Purpose Computer :
1. CPU : Features :
– Word length. - Instruction set .
– Addressing methods. - No. of registers.
– Information transfer rates. - Interrupt structure.
2. Storage:
– RAM, ROM, EPROM and auxiliary storage unit .
– DMA for fast I/O information transfer.
3. Input and Output:
– Process I/O
– Operator I/O
– Computer I/O
4. Bus structure:
– Mechanical (physical) structure
– Electrical
– Functional

Real-Time Systems, Prof. Kasim Al-Aubidy <


Single Chip Microcomputers & Microcontrollers

• A microcomputer is a small, relatively inexpensive computer with a microprocessor


as its central processing unit (CPU).
• It includes a microprocessor, memory, and minimal input/output (I/O) circuitry
mounted on a single printed circuit board.
• A microcontroller is a small computer on a single integrated circuit containing a
processor core, memory, and programmable input/output peripheral.
• The main difference between the two is that the former will have on board the chip of a
multiplexed ADC & some form of processed outputs like for e.g. Pulse width
modulator unit.
• The chip may also contain a real-time clock generator & a watch dog timer.
• A watchdog timer (sometimes called a computer operating properly or COP timer, or
simply a watchdog) is an electronic timer that is used to detect and recover from
computer malfunctions.
• During normal operation, the computer regularly restarts the watchdog timer to
prevent it from elapsing, or "timing out". If, due to a hardware fault or program error,
the computer fails to restart the watchdog, the timer will elapse and generate a timeout
signal..
• The timeout signal is used to initiate corrective action or actions. The corrective
actions typically include placing the computer system in a safe state and restoring
normal system operation.
• Watchdog timers are commonly found in embedded systems and other computer-
controlled equipment where humans cannot easily access the equipment or would
be unable to react to faults in a timely manner. In such systems, the computer
cannot depend on a human to reboot it if it hangs; it must be self-reliant.
• For example, remote embedded systems such as space probes are not physically
accessible to human operators; these could become permanently disabled if they
were unable to autonomously recover from faults.
• Small amount of RAM and EPROM , it can be extended .
• Instruction set .
• DAC and ADC
• Interrupt structure
• I/O lines .
• Timers.
Oscillator

Real-Time Systems, Prof. Kasim Al-Aubidy E


Specialised Processor
• Specialized processors have been developed for two main purposes:
– Safety-critical applications.
– Increased computation speed .
• For safety-critical applications , use RISC computers.
• The advantage of simplifying the instruction set is:
1. The possibility of formal verification (using math. proofs) that the logic of
the processor is correct.
2. It is easier to write assemblers and compilers for simple instruction set.
3. Eg: VIPER which is a low power compatible single board computer .
The main features are:
1. Formal Mathematical Description of the Processor Logic.
2. Integer Arithmetic(32-bit) and no floating point operations.

Real-Time Systems, Prof. Kasim Al-Aubidy C


3. No interrupts- i.e all event handling is done by using
polling.
4. No dynamic memory allocation.
• Increasing the processor speed can increase the
throughput thus leading the system to eventually reach a
physical level because of the fundamental limitation on
the speed at which an electronic signal can travel.
Parallel Computers
• Many different forms of parallel computer architecture
have been used SIMD, MISD, and MIMD .
• Eg: Inmos transputer:
Which is a pioneering microprocessor architecture of the
1980s, featuring integrated memory and serial
communication links, intended for parallel computing.
• Each transputer chip has a CPU, on-board memory, an
external memory interface and communication links for
direct point-point connection to other transputer chips.
Process Related Interfaces

• They are particularly four various types of process related


interfaces:
1. Digital Quantities: Can be either binary or a switch or a relay
or a generalized digital quantity.
2. Analog Quantities: These are continuous variables and have to
be both sampled and converted to a digital value.
3. Pulse Interfaces: A number of measuring instruments provide
output in the form of pulse trains
4. Telemetry: They are used in plants with a hierarchy of
computer systems instead of connecting the computers by
some form of network
Digital Signal Processors
• In applications such as speech processing, telecommunications,
radar and hi-fi systems, analog techniques are used for modifying
the signal characteristics.
• The advantages of using DSPs are that digital devices are more
reliable and they are not subject to any drift.
• They also use special purpose ICs which use the Havard
Architecture in which separate paths are provided for data and for
instructions.
• The disadvantages rely on the fact that the bandwidth of the signals
demand very high speed of processing.
• Moreover, they are difficult to program as they typically use fixed
point arithmetic due to which limited high-level languages are
available for compiling.
Digital Signal Interfaces
Pulse Interfaces
Analog Interface
Differnce Between Analog and Digital Input/Output Interfacing:

Real-Time Systems, Prof. Kasim Al-Aubidy ١7


• So, the operation of a simple plant using a computer
requires that the software be provided to support:
1.Monitoring: Involves information about the current state of
the plant.
2.Control: Involves not only the digital and position
controlling of the plant but it also has to handle automatic
change over from simply tracking the manual control
operations to controlling the systems whenever the
operator requests a change from manual to automatic
control.
3.Actuation: Involves driving the plant.
Example of a Simple Computer Control
Generalized Computer Control Showing Hardware and Software
Interface
Computer Control Showing Communication Tasks
Real Time Clock
• A real-time clock (RTC) is a computer clock (most often in the form of
an integrated circuit) that keeps track of the current time.
• Although the term often refers to the devices in personal
computers, servers and embedded systems, RTCs are present in almost any
electronic device which needs to keep accurate time.
• It is used to avoid confusion with ordinary hardware clocks which are
only signals that govern digital electronics, and do not count time in human units.
• It serves 3 main purposes:
• Low power consumption (important when running from alternate power)
• Frees the main system for time-critical tasks
• Sometimes more accurate than other methods
• RTCs often have an alternate source of power, so they can continue to keep time
while the primary source of power is off or unavailable. This alternate source of
power is normally a lithium battery in older systems, but some newer systems use
a supercapacitor, because they are rechargeable and can be soldered. The
alternate power source can also supply power to battery backed RAM.
Data Transfer Techniques

• Based on timing constraints, they are divided as:


• Unconditional Transfer: Under program Transfer, the computer
can read or write at any time to a device. Eg: DACs, switches &
indicator lights.
• Conditional Transfer: Here the computer must be sure that the
device is ready to accept the next item of data. Eg: printers &
communication Channels.
• Based on process they are divided as:
• Polling
• Interrupts
• Direct Memory Access
Polling
Interrupts:
• An Interrupt is a mechanism by which the flow of the program can be temporally
stopped to allow a special piece of software – an interrupt service routine handler
– to run.
• When this routine has finished, the program which was temporarily suspended is
resumed.
• Interrupts are essential for correct operation of most RTCs. They can be used in
numerous ways as:
• Real Time Clock: The external Hard ware provides a signal at regular intervals of
time & an ISR counts the signal and keeps a clock
• Alarm Inputs: Various Sensors can be used to provide a logic change in the event
of an alarm. Since alarms are infrequent and need rapid response times, interrupt
provides an effective and efficient solution
• Manual Override: here interrupt can be used in external control of a system to
allow for maintenance and repair
• Hardware Failure Indication: failure of external h/w or of interface units can be
signalled to the processor through the use of an interrupt
• Debugging Aids: Interrupts are frequently used to insert breakpoints or traces in
the program during program testing
• Operating System: they are used to force entry to the OS before the end of the
time slice
• Power Failure Warning: Used to detect loss of power in the system quickly&
provides a warning some milliseconds before the loss.
Saving and Restoring Registers
• Since an interrupt can occur at any point of time, precautions should
be taken to prevent the loss of informations by automatically saving
all the informations in registers. The methods commonly used are:
• Storing the contents of the register in a specified area of memory.
• Storing the register on the memory stack which might lead to stack
overflow
• Use of an auxiliary set of registers where a designated memory area
is used as working registers and then an interrupt requires a pointer
to be changed to change the working register set
• An example of the framework of an ISR is shown
below:
• INT1: CALL SAVREG ; SAVREG is a routine which
saves working registers
;
;code for interrupt handling is inserted here
;
CALL RESREG ; RESREG is a routine which restores
working registers
EI ; enable interrupts
RETI ; return from interrupt routine
• By using EI/RETI combination, a pending interrupt
cannot take effect until after the return from the
previous one has been completed.
Interrupt Input Mechanisms

• In between each interrupt,


the CPU checks the IRQ
line.
• If it is active, an interrupt
is present and ISR is
entered.
• If it is not active, the next
instruction is fetched and
the cycle repeats.
• Here a latch should also
be used.
Typical Basic Interrupt System
Interrupt Response Mechanisms
• The CPU may respond to the in a number of ways which are illustrated as
follows:
1. Transfer control to a specified address-usually in the form of ‘call’ or instruction
2. Load the PC with a new value from a specified register or a memory location
3. Execute a ‘call’ instruction but to an address supplied from the external system
4. Use an output signal- An Interrupt Acknowledge- to fetch an instruction from an
external device
• Methods 1 &2 are software based whereas methods 3 & 4are hardware based.
• In method 2, the address of the interrupt response routine is stored in the
specified memory locations and the address stored here is c/a interrupt vector or
interrupt response vector.
• It can take variety of forms: may be an instruction or the address of an ISR, or
the address of a pointer to an ISR or a part of the address of the ISR or pointer.
Hardware Vectored Interrupts
Interrupt Vectoring using priority encoding circuit
Multilevel Interrupts
Interrupt Masking
Communications:

• Level (1): parallel analog/digital transmission (High speed, frequent transfer)


• Level(2): Asynchronous direct or synchronous network (Medium speed)
• Level (3): Synchronous (High speed , intermittent)
• At high levels, it is more usual to use serial communication methods due to the
distances between computers (few hundred meters).
• At plant level , parallel analog and digital signal transmission techniques are
involved, since the distances are small.
• Serial communication techniques can be characterized in several ways:
1. Mode: Synchronous and Asynchronous .
2. Quantity: Character by character and block .
3. Distance: Local and remote (Wide area).
4. Code: ASCII and others.
Asynchronous and Synchronous Transmission
Synchronous Transmission

• There are 2 main standards for synchronous transmission


systems:
• BISYNC(Binary Synchronous Communication): A half-duplex link
protocol which is an older version used in IBM equipment and is
obsolescent
• HDLC(High-Level Data Link Control): A bit-oriented code-transparent
synchronous data link layer protocol developed by the International
Organization for Standardization (ISO). Used mostly in new equipments
LAN & WAN
LAN & WAN
• WAN is a telecommunications network or computer network that
operates over a very wide area at moderate speeds.
• A local area network (LAN) is a computer network that interconnects
computers within a limited area such as a residence, school, laboratory,
university campus or office building and has its network equipment and
interconnects locally managed.
• LAN use a range of different topologies:
• DATA Bus: A bus network is a network topology in which nodes are
directly connected to a common linear (or branched) half-duplex link or
a cable called a bus.
• Advantages:
• 1) It is easy to set-up and extend bus network.
• 2) Cable length required for this topology is the least compared to other
networks.
• 3) Bus topology costs very less.
• 4) Linear Bus network is mostly used in small networks.
• Disadvantages
• 1) There is a limit on central cable length and number of nodes that can be connected.
2) Dependency on central cable in this topology has its disadvantages. If the main cable
(i.e. bus ) encounters some problem, whole network breaks down.
3) Proper termination is required to dump signals. Use of terminators is must.
4) It is difficult to detect and troubleshoot fault at individual station.
5) Maintenance costs can get higher with time.
6) Efficiency of Bus network reduces, as the number of devices connected to it increases.
7) It is not suitable for networks with heavy traffic.
8) Security is very low because all the computers receive the sent signal from the source.
• STAR: A star topology is a topology for a Local Area Network (LAN) in which all
nodes are individually connected to a central connection point, like a hub or a switch.
A star takes more cable than e.g. a bus, but the benefit is that if a cable fails, only one node
will be brought down.
• ADVANTAGES:
• 1) As compared to Bus topology it gives far much better performance, signals don’t
necessarily get transmitted to all the workstations. A sent signal reaches the intended
destination after passing through no more than 3-4 devices and 2-3 links. Performance of
the network is dependent on the capacity of central hub.
• 2) Easy to connect new nodes or devices. In star topology new nodes can be
added easily without affecting rest of the network. Similarly components can also
be removed easily.
3) Centralized management. It helps in monitoring the network.
4) Failure of one node or link doesn’t affect the rest of network. At the same time
its easy to detect the failure and troubleshoot it.
• DISADVANTAGES:
• 1) Too much dependency on central device has its own drawbacks. If it fails
whole network goes down.
2) The use of hub, a router or a switch as central device increases the overall cost
of the network.
3) Performance and as well number of nodes which can be added in such
topology is depended on capacity of central device.
HIERARCHY:
• Also called as Tree Topology
• the number of Star networks are connected using Bus. This main cable seems
like a main stem of a tree, and other star networks as the branches. It is also
called Expanded Star Topology.
• Advantages:
• 1. It is an extension of Star and bus Topologies, so in
networks where these topologies can't be
implemented individually for reasons related to
scalability, tree topology is the best alternative.
2. Expansion of Network is possible and easy.
3. Here, we divide the whole network into segments
(star networks), which can be easily managed and
maintained.
4. Error detection and correction is easy.
5. Each segment is provided with dedicated point-to-
point wiring to the central hub.
6. If one segment is damaged, other segments are not
affected.

• Disadvantages:
• 1. Because of its basic structure, tree topology, relies
heavily on the main bus cable, if it breaks whole
network is crippled.
2. As more and more nodes and segments are added,
the maintenance becomes difficult.
3. Scalability of the network depends on the type of
cable used.
• In Ring Topology, all the nodes are connected to each-other in such a way that
they make a closed loop. Each workstation is connected to two other components on either
side, and it communicates with these two adjacent neighbours. Data travels around the
network, in one direction. Sending and receiving of data takes place by the help of
TOKEN.
• Token contains a piece of information which along with data is sent by the source
computer. This token then passes to next node, which checks if the signal is intended to it.
If yes, it receives it and passes the empty token into the network, otherwise passes token
along with the data to next node. This process continues until the signal reaches its
intended destination.
The nodes with token are the ones only allowed to send data. Other nodes have to wait for
an empty token to reach them. This network is usually found in offices, schools and small
buildings.
• Advantages:
• 1) This type of network topology is very organized. Each node gets to send the
data when it receives an empty token. This helps to reduces chances of collision.
Also in ring topology all the traffic flows in only one direction at very high
speed.
2) Even when the load on the network increases, its performance is better than
that of Bus topology.
3) There is no need for network server to control the connectivity between
workstations.
4) Additional components do not affect the performance of network.
5) Each computer has equal access to resources.

Disadvantages of Ring Topology



1) Each packet of data must pass through all the computers between source and
destination. This makes it slower than Star topology.
2) If one workstation or port goes down, the entire network gets affected.
3) Network is highly dependent on the wire which connects different
components.
• In a mesh network topology, each of the network node, computer and other
devices, are interconnected with one another. Every node not only sends its own
signals but also relays data from other nodes. In fact a true mesh topology is the
one where every node is connected to every other node in the network. This type
of topology is very expensive as there are many redundant connections, thus it is
not mostly used in computer networks. It is commonly used in wireless networks.
Flooding or routing technique is used in mesh topology.


• Advantages of Mesh topology
• 1) Data can be transmitted from different devices simultaneously.
This topology can withstand high traffic.
2) Even if one of the components fails there is always an alternative
present. So data transfer doesn’t get affected.
3) Expansion and modification in topology can be done without
disrupting other nodes.

Disadvantages of Mesh topology


• 1) There are high chances of redundancy in many of the network
connections.
2) Overall cost of this network is way too high as compared to other
network topologies.
3) Set-up and maintenance of this topology is very difficult. Even
administration of the network is tough.
Standard Interfaces
(Open System Interconnection Model)
Process Related Interface:
• Instruments and actuators connected to
the plant can take a wide variety of
forms; they may be used for measuring
a variable, they could be used to
control an actuator.
• There is a need to convert a digital
quantity to a physical quantity, or an
analog signal generated from a sensor
into a digital quantity.
• Most devices can be allocated to one of
the following categories;
1. Digital quantities.
2. Analog quantities.
3. Pulses and pulse rates.
4. Telemetry.

Real-Time Systems, Prof. Kasim Al-Aubidy ١١


Pulse Input/Output Interfacing:
- Reading sequence of pulses generated from a sensor.
- Reading the width of a pulse width modulated signal.
- Generating number of pulses with fixed frequency.
- Generating a controllable pulse width modulated signal.
➢ Several design circuits will be considered during lecture.

Real-Time Systems, Prof. Kasim Al-Aubidy ١<