Microcontroller and Embedded
Microcontroller and Embedded
INTERFACING DIAGRAM
V0=Vref
Ex.
1. IF data = 00H[00000000], Vref =10 V
V0 = 10[
Therefore V0 = 0 V.
Interfacing Diagram
DAC0808 is a D/A convertor IC and this is used for converting 8 bit
digital data input to analog signal output . It is monolithic IC featuring a
full scale output current settling time of 150 ns while dissipating only
33mW with ±5V supplies. The chip accuracy of conversion is good and
power consumption is also low to make it proper.The power supply
current of the DAC0808 are independent of bit codes , and exhibit
essentially constant device characterstics over the entire supply voltage
range.
IC =
Applications
Analog to digital circuits.
Electrical measurement.
Audio conversion
Hobbyist application
INC A
CJNE A#FF,start
@MOV P,A
DEC A
CJNE ,#00,@
SJMP start
A stepper motor is a widely used device that translates electrical pulses into mechanical movement. In
applications such as disk drives, dot matrix printers, and robotics, the stepper motor is used for position
control. Stepper motors commonly have a permanent magnet rotor (also called the shaft) surrounded by
a stator There are also steppers called variable reluctance stepper motors that do not have a PM rotor. The
most common stepper motors have four stator windings that are paired with a center-tapped common.
This type of stepper motor is commonly referred to as a. four-phase or unipolar stepper motor. The center
tap allows a change of current direction in each of
two coils when a winding is grounded, thereby resulting in a polarity change of the stator. Notice that
while a conventional motor shaft runs freely, the stepper motor shaft moves in a fixed repeat-able
increment, which allows one to move it to a precise position. This repeatable fixed movement is
possible as a result of basic magnetic theory
sequence.
How much movement is associated with a single step? This depends on the internal construction of
the motor, in particular the number of teeth on the stator and the rotor. The step angle is the
minimum degree of rotation associated with a single step. Various motors have different step angles.
Table 17-4 shows some step angles for various motors. In Table 17-4, notice the term steps per
revolution. This is the total number of steps needed to rotate one complete rotation or 360 degrees
(e.g., 180 steps x 2 degrees = 360).
It must be noted that perhaps contrary to one‟s initial impression, a stepper motor does not need
more ter-
minal leads for the stator to achieve smaller steps. All the stepper motors discussed in this section
have 4 leads for the stator winding and 2 COM wires for the center tap. Although some
manufacturers set aside only one lead for the common signal instead of two, they always have 4
leads for the stators. Next we discuss some associated terminology in order to understand the
stepper motor further.
Example 17-1
Describe the 8051 connection to the stepper motor of Figure 17-9 and code a program to rotate it
continuously.
The relation between rpm (revolutions per minute), steps per revolution, and steps per second is as
follows.
The switching sequence shown earlier in Table 17-3 is called the 4-step switching sequence since
after four steps the same two windings will be “ON” How much movement is associated with these
four steps? After completing every four steps, the rotor moves only one tooth pitch. Therefore, in a
stepper motor with 200 steps per revolution, the rotor has 50 teeth since 4×50 = 200 steps are
needed to complete one revolution. This leads to the conclusion that the minimum step angle is
always a function of the number of teeth
There are three common types of stepper motor interfacing: universal, unipolar, and bipolar. They
can be identified by the number of connections to the motor. A universal stepper motor has eight,
while the unipolar has six and the bipolar has four. The universal stepper motor can be configured
for all three modes, while the unipolar can be either unipolar or bipolar. Obviously the bipolar cannot
be configured for universal nor unipolar mode. Table 17-7 shows selected stepper motor
characteristics. Figure 17-10 shows the basic internal connections of all three type of configurations.
Unipolar stepper motors can be controlled using the basic interfacing shown in Figure 17-11,
whereas the bipolar stepper requires H-Bridge circuitry. Bipolar stepper motors require a higher
operational current than the unipolar; the advantage of this is a higher holding torque.
TIMER / COUNTER PROGRAMMING
The microcontroller 8051 has two 16 bit timer / controller
register namely Timer 0 and Timer 1. Both these register
can be configured independently to operate as timer or an
event.
When used as “Timer” the register is programmed to
count the internal clock pulse. The internal clock pulses
are generated from a constant clock generator, the count
loaded in the register gives constant time. The register is
incremented every machine cycle. One machine cycle
consists of 12 oscillator period and so the counting rate is
1/12 of the oscillator frequency.
When used as “counter”, the microcontroller is
programmed to count external pulses. The register is
incremented in response to a high to lo transition * ]
of the corresponding external input pin, T0 and T1. The
external input does not have a constant frequency and
hence it is not used for timing reference.
The T0 and T1 pins are sampled during S5P2 of every
machine cycle. When the processor finds it to be ‘0’ in one
machine cycle and ‘1’ in another machine cycle, then it
increments the Timer/ Counter register in S3P1of next
machine cycle.
Hence, in the order to recognize the high-low transition
the microcontroller requires two machine cycle i.e. 24
oscillator periods. The maximum count rate is 1/24 of the
oscillator frequency.
The timer mode can also be for pulse width measurement.
When the gate bit is kept ‘1’, the timer runs until the INTx
pin is high. Hence the timer is counting the number of
internal clock pulse for which the pulse on INTx pin is at
logic ‘1’. For e.g. if the timer counts 1 to 10 and the cystal
is of 12MHx (i.e. one machine cycle is 1µsec),it indicates
the pulse on INTx pin as at logic ‘1’ for 10µsec.
The counter/timer register are divided into 8 bit register
called the timer low (TL0 and TL1)and timer high (TH0 and
TH1). TL0 and TH0 together form the 16 bit timer 0 and
TL1and TH1 forms the 16 bit timer 1.
The counter action is controlled by the bits in the timer
mode control register (TCON) and some instruction.
TIMER 1 TIMER 0
Timer 1 Timer 0
GATE – Getting control hen set timer/counter “x” is
enabled only hile ‘INTx’, pin is high and ‘TRx’ control
pin is set. When cleared, Timer ‘x’ is enabled henever
‘TRx’ control bit is set. It is used for pulse idth
measurement (PWM) of the pulse on INTx pin.
C/T – Timer or Counter selector. Cleared for timer operation
(input from internal system clock). Set for Counter
operation (input from “Tx” input pin).
M1 M0 Operating Mode
0 0 MODE-00 8 bit timer /counter ‘THx’ ith ‘TLx’ as 5
bit prescalar.
0 1 MODE-01,8 bit timer /counter ‘THx’ and ‘TLx’ are
cascaded, there is no prescaler.
1 0 MODE-02,8 bit auto reloaded. Timer / counter ‘TLx’
holds a value hich is to be reloaded into ‘TLx’ each
time it overflows.
1 1 MODE-03, (Timer 0) TL0 is an 8 bit timer/counter
controlled by the standard timer 0 control bits
controlled by timer 1 control bits.
(MSB) (LSB)
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
Mode 1 of Timer/Counter
The Mode 1 operation is the 16-bit timer or counter. In the following
diagram, we are using Mode 1 for Timer0.
In this case every event for counter operations or machine cycles for
timer operation, the TH0– TL0 register-pair will be incremented by 1.
When the register pair overflows from FFFFH to 0000H, then the TF0 of
TCON register will be high, and it stops the timer/counter. So for an
example, we can say that if the TH0 – TL0 register pair is holding
FFF0H, and it is in timer mode, then TF0 will be high after 10H = 16
machine cycles. When the clock frequency is 12MHz, then the following
instructions generate an interrupt 16 µs after Timer0 starts running.
MOVTMOD, #01H
MOVTL0, #0F0H
MOVTH0, #0FFH
MOVIE, #82H
SETB TR0
In this case every event for counter operations or machine cycles for
timer operation, the TL1register will be incremented by 1. When the
register pair overflows from FFH to 00H, then the TF1 of TCON register
will be high, also theTL1 will be reloaded with the content of TH1 and
starts the operation again.
So for an example, we can say that if the TH1 and TL1 register both are
holding F0H and it is in timer mode, then TF1 will be high after 10H= 16
machine cycles. When the clock frequency is 12MHz this happens after
16 µs, then the following instructions generate an interrupt once every 16
µs after Timer1 starts running.
MOVTMOD, #20H
MOVTL1, #0F0H
MOVTH1, #0F0H
MOVIE, #88H
SETBTR1
In the above program, the Timer1 is configured as timer mode 2. In this
case Gate = 0. Then the TL1 and TH1 are loaded with F0H. then enable
the Timer1 interrupt. At last set the TR1 of TCON register, and start the
timer.
Timer1 in mode 2 generates the desired baud rate when the serial port is
working on Mode 1 or 3.
Mode 3 of Timer/Counter
Mode 3 is different for Timer0 and Timer1. When the Timer0 is working
in mode 3, the TL0 will be used as an 8-bit timer/counter. It will be
controlled by the standard Timer0 control bits, T0 and INT0 inputs. The
TH0 is used as an 8-bit timer but not the counter. This is controlled by
Timer1 Control bit TR1. When the TH0 overflows from FFH to 00H, then
TF1 is set to 1. In the following diagram, we can Timer0 in Mode 3.
When the Timer1 is working in Mode 3, it simply holds the count but
does not run. When Timer0 is in mode 3, the Timer1 is configured in one
of the mode 0, 1 and 2. In this case, the Timer1 cannot interrupt the
microcontroller. When the TF1 is used by TH0 timer, the Timer1 is used
as Baud Rate Generator.
The meaning of gate bit in Timer0 and Timer1 for mode 3 is as follows
It controls the running of 8-bit timer/counter TL0 as like Mode 0, 1, or 2.
The running of TH0 is controlled by TR1 bit only. So the gate bit in this
mode for Timer0 has no specific role.
The mode 3 is present for applications requiring an extra 8-bit
timer/counter. In Mode 3 of Timer0, the 8051 has three timers. One 8-bit
timer by TH0, another8-bit timer/counter by TL0, and one 16-bit
timer/counter by Timer1.
If the Timer0 is in mode3, and Timer1 is working on either 0, 1 or 2, then
the gun control of the Timer1 is activated when the gate bit is low
or INT1 is high. The run control is deactivated when the gate is high
and INT1 is low.
GATE
The other bit of the TMOD register is the GATE bit. Notice in the TMOD
register of Figure 9-3 that both Timers 0 and 1 have the GATE bit. What
is its purpose? Every timer has a means of starting and stopping. Some
timers do this by software, some by hardware, and some have both
software and hardware controls. The timers in the 8051 have both. The
start and stop of the timer are controlled by way of software by the TR
(timer start) bits TRO and TR1. This is achieved by the instructions
“SETB TR1″ and “CLR TR1″ for Timer 1, and “SETB TRO” and “CLR
TRO” for Timer 0. The SETB instruction starts it, and it is stopped by the
CLR instruction. These instructions start and stop the timers as long as
GATE = 0 in the TMOD register. The hardware way of starting and
stopping the timer by an external source is achieved by making GATE =
1 in the TMOD register. However, to avoid further confusion for now, we
will make GATE = 0, meaning that no external hardware is needed to
start and stop the timers. In using software to start and stop the timer
where GATE = 0. all we need are the instructions “SETB TRx” and “CLR
TRx”. The use of external hardware to stop or start the timer is
discussed in Chapter 11 when interrupts are discussed.
Indicate which mode and which timer are selected for each of the
following.
(a) MOV TMOD,#01H (b) MOV TMOD,#20H (c) MOV TMOD,#12H
1. TMOD = 00000001, mode 1 of Timer 0 is selected.
2. TMOD = 00100000, mode 2 of Timer 1 is selected.
1. TMOD = 00010010, mode 2 of Timer 0, and mode 1 of
Timer 1 are selected.
Making TH and TL both zero means that the timer will count from 0000
to FFFFH, and then roll over to raise the TF flag. As a result, it goes
through a total of 65536 states. Therefore, we have delay = (65536 – 0)
x 1.085 us = 71.1065 ms.
Example 9-7
Find the delay generated by Timer 0 in the following code, using both of
the methods of Figure 9-4. Do not include the overhead due to
instructions.
1. (FFFF-B83E + 1) = 47C2H= 18370 in decimal and 18370 x 1.085 fis=
19.93145ms.
2. Since TH – TL = B83EH = 47166 (in decimal) we have 65536 – 47166
= 18370.
This means that the timer counts from B83EH to FFFFH.. This plus
rolling over to
0 goes through a total of 18370 clock cycles, where each clock is
1.085 \ls in dura
tion. Therefore, we have 18370 x 1.085 (is = 19.93145 ms as the
width of the pulse.
SERIAL COMMUNICATION IN 8051
8051 UART
Introduction
Asynchronous communication
Asynchronous serial communication is widely used for byte-oriented
transmission.
Frame structure in Asynchronous communication:
Common Ground Zero reference voltage level for all the control signals.
DCD (Data carrier DCE accepts a carrier from a DTE located at remote location.
Detect)
DSR (Data Set Ready) DCE is prepared to send and receive the information.
RI (Ring Indicator) Detects the incoming ring tone on the telephone line.
Signal Name Function
RTS (Request to Send) DTE call for DCE to send the data.
RTR (Ready to Receive) DTE is geared up to receive data coming from DCE.
CTS (Clear To Send) DCE is in a ready state to accept data coming from DTE.
8096 Microcontroller :
• Intel MSC-96 family easily handles high speed calculations and fast input/out operations.
• All of the MCS-96 components share a common instruction set and architecture. However the
CHMOS components have enhancements to provide higher performance with lower power
consumption.
• These microcontroller contains dedicated I/O subsystem and perform 16-bit arithmetic
instructions including multiply and divide operations.
CPU: The major components of the MCS-96 CPU are the Register File and the Register /
Arithmetic Logic Unit (RALU).
• Location 00H through 17H are the I/O control registers or Special function registers (SFR).
• Locations 18H and 19H contains the stack pointer, which can serve as general purpose RAM
when not performing stack operations.
• The remaining bytes of the register file serve as general purpose RAM, accessible as bytes,
words or double-words.
• Calculations performed by the CPU take place in the RALU. The RALU contains a 17bit ALU,
the program status word (PSW), the program Counter (PC), a loop counter and three temporary
registers.
• The RALU operates directly on the Register Files, thus eliminating accumulator bottleneck and
providing for direct control of I/O operations through the SFR.
8096 Peripherals
• Standard I/O Ports – The 8096 has five 8 bit I/O ports.
• Port 0 is an input port that is also the analog input for the A/D converter.
• Quasi-Bidirectional input and output. Other functions on the 8096 share the input and output
lines with Port 2.
• Port 3 and 4 are open-drain bidirectional ports that share their pins with the address/data bus.
• Timers – The 8096 has two 16 bit timers. Timer 1and Timer 2.
• An internal clock increments the Timer 1 value every 8 state times. (A state time is 3
oscillator periods)
• This two timers can generate an interrupt when crossing the 0FFFFH/0000H boundary.
• The 8096 includes separate, dedicated timers for serial port baud rate generator and watchdog
timer.
• The watchdog Timer is an internal timer that resets the system if the software fails to operate
properly.
• High Speed Input Unit (HSI) – The 8096 HIS unit can record times of external events with a
9 state time resolution. It can monitor four independently configurable HSI lines and captures the
value of timer 1 when events takes place.
• The four types of events that can trigger captures include: rising edge only, falling edge only,
rising or falling edges, or every eight rising edge.
• Reading the HSI holding register unloads the earliest entry placed in the FIFO.
• The HSI unit can generate an interrupt when loading an entry into the HSI holding register or
loading the sixth entry into the FIFO.
• High Speed Output Unit (HSO) – The 8096 HSO unit can trigger events at specified
times based on Timer1 or Timer2.
• These programmable events include: starting an A/D conversion, resetting Timer2, generating
upto four software time delays, and setting or clearing one or more of the six HSO output lines.
• The HSO unit stores pending event and specified times in a Content Addressable Memory
(CAM) file. This file stores upto 8 commands.
• Each command specifies the action time, the nature of the action, whether an interrupt is to
occur, and whether Timer1 or Timer2 is the reference timer.
• Every 8 state times the HSO compares the CAM locations for time matches. The HSO unit
triggers the specified event when it finds a time match.
• Serial Port – The serial port on the 8096 has one synchronous (Mode 0) and three
asynchronous modes (Modes 1, 2 and 3).
• Mode 0, the synchronous mode, is to expand the I/O capability of the 8096 using shift register.
• Mode 1 is the standard asynchronous mode used for normal serial communication.
• Pulse Width Modulator (PWM) – The PWM output waveform is a variable duty cycle pulse
that repeats every 256 state times.
• The PWM output can perform digital to analog conversions and drive several types of motors
that require a PWM waveform for more efficient operation.
• A/D Converter – The 8096 A/D converts an analog input to a 10 bit digital equivalent.
• The main components of the A/D Converter are: 8 analog inputs, an 8 to 1 multiplexer, a
sample and hold capacitor and resistor ladder.
• The A/D Converter can start a conversion immediately or the High Speed Output unit can
trigger a conversion at a pre-programmed time.
• The A/D converter performs a conversion in 88 state times. Upon completion of each
conversion the converter can generate a conversion complete interrupt.
• The 8X9X provides separate VREF and ANGND supply pins to isolate noise on the Vcc or
Vss lines. •
SP → Stack Pointer.
The addressable memory space of the 8096-memory space consists of 64KB, most
of which is available to the user program for data memory.
Factory reset: - This port will simply delete all data from your device as well
as any applications. Then it’s going to return your device back to its factory
state.
SRF: -Out of 256 locations. The first 24 memory locations, SRF, are used to
control on chip input output section. For example, timer 1,2 Port 0,1,2;
SBUF; HSo, HS, etc.
RALU: - The remaining 232 locations are the RAM location. This location
can be accessed as byte Band or double band, since each of these locations
can be used by RALU.
Power down RAM: - The upper 16 byte of RAM is called power down RAM
because this location receives their power from the VPD pin, in the power
down mode. Hence in power down, only these locations are alike. Power
down mode is used to save power in microcontroller
LDWD, WS -> load a word from direct source address to destination address.
ADD WD, [WS] -> Add16 bit word at operand from direct address WD with a
address finded by WS.
5. Indexed short: -
ADD WD, WS1 offset [WS2]: - Operant from direct address ws1 with direct
address find it by ws2 after adding it by offset.
6. Indexed long: -
ADD WS, WS1, Display [WS2] -> Add operant from direct address WS1 with
address pointer WS2 after adding it by displacement.
7. Implicit: -
(pre-defined instruction) SETC, POPF, PUSHF.
INTRODUCTION :-
A system is a method of working, organizing or doing one or many tasks according to a fixed plan,
program or set of rules. It is an arrangement in which all its units asseurable and work together
according to the plan or program.
Consider a watch. It is a TIME DISPLAY SYSTEM. It comprises of hardware, needles and battery, a dial,
and strap. These parts organize to shaw the real time every second. The system program update the
display after each second.
EMBEDDED SYSTEM
A computer is a system that consists of a microprocessors (CPU) , a large memory comprising the
“ An Embedded system is a system that has computer hard are ith soft are embedded in it as one of
its most important component. ”
I. HARDWARE – The following figure shows the hardware units of an embedded system.
II. APPLICSTION SOFTWARE – that may perform a series of tasks or multiple tasks at the same
time.
III. HARDWARE UNIT OF EMBEDDED SYSTEM
INPUT DEVICE
INTERFACING/
POWER DRIVER CIRCUIT SYSTEM
SUPPLY
APPLICA
RESET PROCESSORS PROGRM TION
MEMORY AND
OSCILLAT DATA MEMORY SPECIFIC
OR
CIRCUIT
CIRCUIT TIMER SERIAL
COMMUNICATION
PORTS
INTRRUPT PARALLEL
CONROLLER PORTS
OUTPUT
INTERFACING /
DRIVER
It has a real time operating system (RTOS) that supervisesthw application software. It provides a
mechanism to allow the processor to run a process as per scheduling and do the context switch
between the various processes (tasks).
ROLE OF RTOS—
RTOS organizes access to a resource in sequence of the series of tasks of the system. It
schedules their working and execution by—
Following a plan to control the latencies and to meet the deadlines (latency refers to
the waiting period between running the codes of a task and the instance at which the
need for task arises )
RTOS sets the rules during the execution of the application software.
An embedded system has software designated to keep in view following three constraints :-
For example –
Examples:-
1. TELECOMMUNICATION system employs embedded systems from TELEPHONE SWITCH for the
network to CELL PHONE at the end user. Computer networking uses dedicated ROUTER and
NETWORK BRIDGE to route data.
2. CONSUMER ELECTRONICS include MP3 player, mobile phones, video game consoles, GPS
receivers and printer.
3. HOUSEHOLD APPLICATION – such as microwaves oven, washing machine and dishwasher.
4. HOME AUTOMATION -- uses wireless networking that can be used to control lights, climate,
security, audio/visual surveillance etc. all of these uses embedded devices for sensing and
controlling.
5. TRANSPORTATION SYSTEM from flight to automobiles increasing use embedded system. New
airplanes contain advanced AVIONICS such as Inertial guidance system and GPS receivers that
also have considerable safety requirement.
6. VARIOUS ELECTRONIC MOTOR – brushless DC motors, induction motors and DC motors uses
electric/electronics motor controllers, automatic electric vehicles increasing use embedded
systems to minimize efficiency and reduce pollution.
7. Embedded system are used for automotive safety system which anti-lock braking system (ABS),
electronic stability control (ESC/ESP), traction control (TCS) and automatic four-wheel drive.
8. MEDICAL EQUIPMENT uses embedded system for vital sign monitoring systems, electronic
stethoscopes and medical imaging equipments.
Thus embedded system are extensively used in transportation, fire safety, and security, medical
equipment, life critical systems as these system can be isolated from hacking and thus are more reliable.
HISTORY
One of the very recognizable embedded system was the Apollo Guidance Computer developed in 1965
by Charles Stark Drapon at the MIT Instrumentation Laboratory.
An early mass produced embedded system was AUTONETICS D-17 Guigance computer for micsiles
released in 1961. When the MINUTEMAN II went into production in 1966, the D-17 was replaced with a
new computer that was the first high-volume use of integrated circuit in an embedded system.
As the cost of microprocessors and microcontroller fell ,it became feasible to replace expensive knob-
based analog component such as potentiometers and variable capacitors with up/down buttons read
out by microprocessors even in consumer products. By the early 1980s memory, input-output system
components had been integrated in the same chip as a processor forming a microcontroller’s embedded
system.
EMBEDDED SYSTEM VS GENERAL COMPUTING SYSTEM
*ATTRIBUTES – A quality or feature of a thing/person espicially yhay is impertart part of his nature.
Reliability
Maintainability
Response time
Testability
Power consumption
Ease of usage
Real time deadline adherence soft or hard
Extensibility should be able to cater new requirements
Unlike general purpose computing system, embedded system possess certain specific characteristics are
these characteristics are unique to each embedded system . Some of the important characteristics an
embedded system are :-
Processor technology involves the architecture of the computation engine used to implement a systems
desired functionality.
In general purpose processor, the system designer only reads to program the processors memory to
carry-out the required functionality. Software portion. These type are created to produce number of a
variety of application.
Usally general purpose processors are used to put in a product the first time it goes to the market
beavause of the use of code, a designer usually strirer to minimize compiled code size, rather than
maximize performance .
Advantages:-
Disadvantages :-
A single purpose processor is designed to execute one single programs. An embedded designer creates a
single processor by designing a custom digital circuit. Such processor have a single applicationfor which
they have been designed.
These processors are designed to fit a specific requirement of an end product. In the design process they
will be optimized for both power and performance.
Advantages :-
Disadvantages :-
Example
Application specific integrated circuit(ASIC)
An application specific instruction set processor (ASIP) are designed for a particular class of application
with consumer characteristics . It is an immediate courpromise between a general purpose processor
and a single purpose processor. It gives more flexibility in design than a single purpose processor and
have still better performance , low power, small size as compare to a general purpose processor.
Althought it leads to a longer design time, higher cost and also needs it own compiler.
A DSP is optimized to efficiently perform repetative and numerically intensive tasks such as matrix-
operation, convolution for real time filter design . DSPs normally run at very high clock rate and their
operating speed is measured in terms of how many millions of MAC operation they can perform per
second.
DSPs are optimized to do mathematical operations and not for supervisory application. Thus DSP based
system are integrated with the microcontrollers unit
Advantages :-
I. Optimized for computation on real time data flows as well as control oriented tasks
II. High operating speed as they work at high clock rate
III. Low power dissipation
Diasadvantages:-
Von-Neumann architecture supports simple hardware. It allows the use of a single, sequential
memory. Today's processing speeds vastly outpace memory access times, and we employ a very
fast but small amount of memory (cache) local to the processor.
Harvard Architecture
The Harvard architecture offers separate storage and signal buses for instructions and data. This
architecture has data storage entirely contained within the CPU, and there is no access to the
instruction storage as data. Computers have separate memory areas for program instructions and
data using internal data buses, allowing simultaneous access to both instructions and data.
Programs needed to be loaded by an operator; the processor could not boot itself. In a Harvard
architecture, there is no need to make the two memories share properties.
The following points distinguish the Von Neumann Architecture from the Harvard
Architecture:
Point of Harvard architecture Von Neumann Architecture
comparison
Arrangement In Harvard architecture, In Von-Neumann architecture,
the CPU is connected with there is no separate data and
both the data memory (RAM)and program memory.
program memory (ROM), separately. Instead, a single memory
connection is given to the
CPU.
Hardware It requires more hardware since it will In contrast to the Harvard
requirements be requiring separate data and address architecture, this requires less
bus for each memory. hardware since only a
common memory needs to be
reached
Space This requires more space. Von-Neumann Architecture
requirements requires less space.
Speed of Speed of execution is faster Speed of execution is slower
execution because the processor fetches data and since it cannot fetch the data
instructions simultaneously . and instructions at the same
time
Space usage It results in wastage of space since if Space is not wasted because
the space is left in the data memory the space of the data memory
then the instructions memory cannot can be utilized by the
use the space of the data memory and instructions memory and vice-
vice-versa. versa.
Controlling Controlling becomes complex since Controlling becomes simpler
data and instructions are to be fetched since either data or
simultaneously. instructions are to be fetched
at a time.
ISA (instruction set architecture):
The instruction set, also called ISA (instruction set architecture), is part of a computer that
pertains to programming, which is basically machine language. The instruction set provides
commands to the processor, to tell it what it needs to do. The instruction set consists of
addressing modes, instructions, native data types, registers, memory architecture, interrupt, and
exception handling, and external I/O.
An example of an instruction set is the x86 instruction set, which is common to find on
computers today. Different computer processors can use almost the same instruction set while
still having very different internal design. Both the Intel Pentium and AMD Athlon processors
use nearly the same x86 instruction set. An instruction set can be built into the hardware of the
processor, or it can be emulated in software, using an interpreter. The hardware design is more
efficient and faster for running programs than the emulated software version.
The CISC approach attempts to minimize the number of instructions per program, sacrificing the
number of cycles per instruction. Computers based on the CISC architecture are designed to
decrease the memory cost. Because, the large programs need more storage, thus increasing the
memory cost and large memory becomes more expensive. To solve these problems, the number
of instructions per program can be reduced by embedding the number of operations in a single
instruction, thereby making the instructions more complex.
CISC Architecture
MUL loads two values from the memory into separate registers in CISC.
CISC uses minimum possible instructions by implementing hardware and executes
operations.
Instruction Set Architecture is a medium to permit communication between the
programmer and the hardware. Data execution part, copying of data, deleting or editing is
the user commands used in the microprocessor and with this microprocessor the
Instruction set architecture is operated.
The main keywords used in the above Instruction Set Architecture are as below
CHARACTERISTIC OF CISC:-
RISC Architecture:
RISC Stands for "Reduced Instruction Set Computing" and is pronounced "risk." RISC is a type
of processor architecture that uses fewer and simpler instructions than a complex instruction set
computing (CISC) processor. RISC processors perform complex instructions by combining
several simpler ones.
Several CPUs in the 1990s and early 2000s used RISC architecture. One of the most popular was
the IBM PowerPC processor, which Apple used in its PowerMac line of computers for nearly a
decade. In 2006, Apple switched to CISC-based Intel CPUs. Nearly all personal computers now
use CISC processors made by Intel or AMD.RISC (Reduced Instruction Set Computer) is used
in portable devices due to its power efficiency. For Example, Apple iPod and Nintendo DS.
RISC is a type of microprocessor architecture that uses highly-optimized set of instructions.
RISC does the opposite; reducing the cycles per instruction at the cost of the number of
instructions per program Pipelining is one of the unique feature of RISC. It is performed by
overlapping the execution of several instructions in a pipeline fashion. It has a high performance
advantage over CISC. RISC processors take simple instructions and are executed within a clock
cycle
RISC Architecture
Characteristic of RISC –
1. Simpler instruction, hence simple instruction decoding.
2. Instruction come under size of one word.
3. Instruction take single clock cycle to get executed.
4. More number of general purpose register.
5. Simple Addressing Modes.
6. Less Data types.
7. Pipeling can be achieved.
Mostly, the performance of the RISC processors depends on the programmer or compiler
as the knowledge of the compiler plays a vital role while changing the CISC code to a
RISC code
While rearranging the CISC code to a RISC code, termed as a code expansion, will
increase the size. And, the quality of this code expansion will again depend on the
compiler, and also on the machine’s instruction set.
The first level cache of the RISC processors is also a disadvantage of the RISC, in which
these processors have large memory caches on the chip itself. For feeding the
instructions, they require very fast memory systems.
The performance of the machine slows down due to the amount of clock time taken by
different instructions will be dissimilar
Only 20% of the existing instructions is used in a typical programming event, even
though there are various specialized instructions in reality which are not even used
frequently.
The conditional codes are set by the CISC instructions as a side effect of each instruction
which takes time for this setting – and, as the subsequent instruction changes the
condition code bits – so, the compiler has to examine the condition code bits before this
happens.
CISC vs RISC
The following points differentiate a CISC from a RISC −
CISC RISC
Higher clock cycles per second. Low clock cycle per second.
ARM Processor:
The ARM architecture processor is an advanced reduced instruction set computing [RISC]
machine and it’s a 32bit reduced instruction set computer (RISC) microcontroller. This ARM is a
family of microcontroller developed by makers like ST Microelectronics, Motorola. The ARM
architecture comes with totally different versions like ARMv1, ARMv2, etc.
Architecture of ARM
The ALU has two 32-bits inputs. The primary comes from the register file, whereas the other
comes from the shifter. Status registers flags modified by the ALU outputs. The V-bit output
goes to the V flag as well as the Count goes to the C flag. Whereas the foremost significant bit
really represents theS flag, the ALU output operationis done by NO Redto get the Z flag. The
ALU has a 4-bit function bus that permits up to 16 opcodes to be implemented.
The multiplier factor has 3 ,32-bit inputs and the inputs return from the register file. The
multiplier output is barely 32-Least Significant Bits of the merchandise. The entity
representation of the multiplier factor is shown in the above block diagram. The multiplication
starts whenever the beginning 04 input goes active. Fin of the output goes high when finishing.
Booth Algorithm
Booth algorithm is a noteworthy multiplication algorithmic rule for 2’s complement numbers.
This treats positive and negative numbers uniformly. Moreover, the runs of 0’s or 1’s within the
multiplier factor are skipped over without any addition or subtraction being performed, thereby
creating possible quicker multiplication. The figure shows the simulation results for the
multiplier test bench. It’s clear that the multiplication finishes only in16 clock cycle.
Barrel Shifter
The barrel shifter features a 32-bit input to be shifted. This input is coming back from the
register file or it might be immediate data. The shifter has different control inputs coming back
from the instruction register. The Shift field within the instruction controls the operation of the
barriershifter. This field indicates the kind of shift to be performed (logical left or right,
arithmetic right or rotate right). The quantity by which the register ought to be shifted is
contained in an immediate field within the instruction or it might be the lower 6 bits of a register
within the register file.
Digital Signal Processor (DSP) is actually a special-purpose CPU used for digital signal
processing-based applications. Once a signal is converted into digital data, using multiple
different available algorithms (such as Fast Fourier Transform), its components can be isolated,
analyzed and rearranged more easily than in analogue form. It provides ultrafast instruction
sequences, such as shift and add, and multiply and add, which are commonly used in math
intensive signal processing. DSP is having versatile application in multiple different fields,
including biomedicine, sonar, radar, seismology, cell phones, fax machines, audio, digital TV,
sound cards, modems, hard disks, imaging and communications, speech and music processing. It
can also be used to create the concert hall and along with surround sound effects in stereo and
home theatre equipment.
a) Real-time digital signal processing capabilities. DSPs typically have to process data in real
time, i.e., the correctness of the operation depends heavily on the time when the data processing
is completed.
b) High throughput: DSPs can sustain processing of high-speed streaming data, such as audio
and multimedia data processing.
c) Deterministic operation: The execution time of DSP programs can be foreseen accurately, thus
guaranteeing a repeatable, desired performance.
Example:
Chapter-5
A watch dog timer (WDT) is a Hardware timer that automatically generates a system RESET if the main
program neglects to regular services.
It is often used to automatically RESET an embedded device that hangs because of software or hardware
fault.
A watchdog timer in embedded systems is a piece of hardware that can be used to automatically detect
software anomalies and RESET the processor if any fault occurs.
For those embedded systems that cannot be constantly watched by a human, Watchdog timers are the
solution.
Most embedded systems need to be self reliant. It is not usually possible to wait for someone to reboot
them if software hangs. Some embedded designs such as space probes are simply not accessible to
human operators. If their software ever hangs, such systems are permanently disabled.
A watchdog timer is a piece of hardware that can be used to automatically detect software anomalies
and RESET the processor if any occur. In general a watchdog timer is based on a timer that counts down
from some initial value to zero.
The embedded system soft are selects the counter’s initial value and periodically restarts it. If the
counter ever reaches zero before the software restarts it, the software is presumed to be
malfunctioning and processor restart signal is asserted. The processor and the embedded software its
running will be restarted as if a human operator has RESET it by cycled power.
Watchdog Timer
PROCESSOR
RESET
CLOCK
FIG : A Typical Watchdog SETUP
The figure shows a typical arrangement. As shown, the watchdog Timer is a chip external to the
processor. However it could also be included within the same chip as the CPU. The output from the
watchdog timer is tied directly to the processor is RESET signal.