Microcontroller_1_1707724463354
Microcontroller_1_1707724463354
Department of E &TC
S.Y.BTech- A (A.Y.2023-24, Sem II)
Harvard architecture is named after the “Harvard Mark I” relay based computer, which was an
IBM computer in the University of Harvard. In the Harvard architecture, there are two separate
memory spaces: one for programs and another for data. The CPU in a Harvard architecture
system is enabled to fetch data and instructions simultaneously, due to the architecture having
separate buses for data transfers and instruction fetches.
The Harvard architecture is a modern computer architecture based on the Harvard Mark I
relay-based computer model.
The Harvard architecture has separate memory space for instructions and data which
physically separates signals and storage code and data memory, which in turn makes
it possible to access each of the memory system simultaneously.
In the Harvard architecture, the processing unit can complete an instruction in one cycle
if appropriate pipelining plans have been set.
Sr RISC CISC
No
1 RISC stands for Reduced Instruction Set CISC stands for Complex Instruction Set
Computer. Computer.
2 RISC processors have simple instructions CSIC processor has complex instructions
taking about one clock cycle. The average that take up multiple clocks for execution.
clock cycle per instruction (CPI) is 1.5 The average clock cycle per instruction
(CPI) is in the range of 2 and 15.
3 Performance is optimized with more focus Performance is optimized with more focus
on software on hardware.
4 It has no memory unit and uses separate It has a memory unit to implement complex
hardware to implement instructions.. instructions.
5 It has a hard-wired unit of programming. It has a microprogramming unit
6 The instruction set has a variety of CISC has many different addressing modes
different instructions that can be used for and can thus be used to represent higher-
complex operations level programming language statements
more efficiently.
7 Multiple register sets are present Only has a single register set
8 fixed (32-bit) format Varying formats (16-64 bits for each
instruction).
9 Complex and variable-length instructions Simple, standardized instructions
10 Fewer addressing modes More addressing modes
11 RISC processors are highly pipelined They are normally not pipelined or less
pipelined
12 The complexity of RISC lies with the The complexity lies in the microprogram
compiler that executes the program
13 Execution time is very less Execution time is very high
14 The most common RISC microprocessors Examples of CISC processors are the
are Alpha, ARC, ARM, AVR, MIPS, PA- System/360, VAX, PDP-11, Motorola
RISC, PIC, Power Architecture, and 68000 family, AMD, and Intel x86 CPUs.
SPARC.
15 RISC architecture is used in high-end CISC architecture is used in low-end
applications such as video processing, applications such as security systems, home
telecommunications, and image processing. automation, etc.
16 Separate data and instruction cache. Unified cache for instructions and data.
Definition of embedded system and its characteristics
An embedded system is a system that has software embedded into hardware, which
makes a system dedicated for an application (s) or specific part of an application or
product or part of a larger system
OR
ESs do a very specific task, and cannot be programmed to do different things. They do
the same task repeatedly /continuously over their lifetime. An mp3 player will function
only as an mp3 player.
ESs have to work against some deadlines. Embedded systems are created to perform the
task within a certain time frame. It must therefore perform fast enough. A car’s brake
system, if exceeds the time limit, may cause accidents.
Some embedded systems are designed to react to external stimuli and react accordingly.
A thermometer, a GPS tracking device.
Embedded systems are built to achieve certain efficiency levels. They are small sized,
can work with less power and are not too expensive.
Embedded systems cannot be changed or upgraded by the users. Hence, they must rank
high on reliability and stability. They are expected to function for long durations without
the user experiencing any difficulties.
Role of microcontroller in embedded System
RS232 port is a standard serial communication transmission of data. In RS 232, the term RS
stands for recommended slandered and the number 232 specifies the latest version. The RS232 is
a communication cable, generally used to transfer and receive the serial data between two
devices This cable supports both synchronous and asynchronous data transmissions.Interfacing
standard RS232 was set by the Electronics Industries Association (EIA) in 1960.
In RS232, a 1 is represented by -3 ~ -25 V, while a 0 bit is +3 ~ +25 V. The most of the serial
cable connectors are DB-9 (9-pin connector) and B-25 (25-pin connector). These cables may be
male or female type. Nowadays, most of the PCs use DB9 cable for the exchange of
asynchronous data.
A line driver such as the MAX232 chip is required to convert RS232 voltage levels to TTL
levels, and vice versa.
RS232 Communication
: a RS232 communication b) RS232 connection
1. MAX232 also called as line driver or voltage converter, uses +5V power supply which is
same as the controller or modem.
2. The IC MAX232 comprises of a transmitter – receiver arrangement so that two serial
ports can be connected using the IC.
3. 5 Capacitors each of 1 microFarad are used to generate the necessary RS232 voltage
from the TTL/CMOS voltage.
4. The transmitter section converts the TTL level to RS232 level, and the receiver
section receives the input of the RS232 and converts them to TTL level.
5. Basically, it is a 16-pin IC where the transmitter pins are connected to the
microcontroller and the input of the transmitter pin gets TTL i/p from the microcontroller
and the o/p of the transmitter pin supply o/p to the RS232 port.
6. The receiver pins attach to the RS 232 port such that the receiver’s i/p receives RS232
input from the personal computer port and the o/p receiver pin supplies the TTL i/p to the
microcontroller.
7. So, the transmitter receives I/p from the microcontroller and gives o/p to the RS232
port while the receiver takes i/p from the RS232 port and gives o/p to the
microcontroller.
: Example of RS232 and MAX 232
1.8. RS 485
1. One of the main problems with RS232 is the lack of immunity for noise on the signal
lines.
2. Noise is easily picked up and limits both the maximum distance and
communication speed.
3. The RS485 standard is used when high speed serial data communications of 10 Mbps is
needed.
4. RS485 is able to provide a headline data rate of 10 Mbps at distances up to 50 feet,
but distances can be extended to 4000 feet with a lower speed of 100 kbps.
5. RS485 proved to be a robust standard and able to provide reliable data
communications over extended distances.
6. RS485 proved to be a robust standard and able to provide reliable data
communications over extended distances.
7. RS-485 allows multiple devices (up to 32) to communicate at half-duplex on a single
pair of wires, plus a ground wire
8. Using RS-485, it is possible to construct a multi-point data communications network.
9. The standard specifies that up to 32 drivers or transmitters along with 32 receivers can
be used on a system. This means that there can be 32 nodes capable to both transmit and
receive.
10. RS485 is the only of the interfaces capable of internetworking multiple transmitters
and receivers in the same network.
11. When using the default RS485 receivers with an input resistance of 12 kΩ it is possible to
connect 32 devices to the network.
12. RS485 repeaters are also available which make it possible to increase the number
of nodes to several thousands, spanning multiple kilometers.
13. In most higher-level protocols, one of the nodes is defined as a master which
sends queries or commands over the RS485 bus.
14. All other nodes receive these data. Depending of the information in the sent data, zero
or more nodes on the line respond to the master.
15. In this situation, bandwidth can be used for almost 100%. There are other
implementations of RS485 networks where every node can start a data session on its
own.
Timing diagram
1. Data transfer is initiated with a start bit (S) signaled by SDA being pulled low while SCL
stays high.
2. SCL is pulled low, and SDA sets the first data bit level while keeping SCL low
3. The data are sampled (received) when SCL rises for the first bit (B1). For a bit to be
valid, SDA must not change between a rising edge of SCL and the subsequent falling
edge
4. This process repeats, SDA transitioning while SCL is low, and the data being read while
SCL is high (B2, ...Bn).
5. The final bit is followed by a clock pulse, during which SDA is pulled low in preparation
for the stop bit.
6. A stop bit (P) is signaled when SCL rises, followed by SDA rising.
Fig 1.9.2 a) Timing diagram b) Frame format
The block diagram of the digital storage oscilloscope consists of an amplifier, digitizer, memory,
analyzer circuitry. Waveform reconstruction, vertical plates, horizontal plates, cathode ray tube
(CRT), horizontal amplifier, time base circuitry, trigger, and clock. The block diagram of the
digital storage oscilloscope is shown in the below figure.
Fig 1.11.1: Block diagram of DSO
As seen in the above figure, at first digital storage oscilloscope digitizes the analog input signal,
then the analog input signal is amplified by amplifier if it has any weak signal. After
amplification, the signal is digitized by the digitizer and that digitized signal stores in memory.
The analyzer circuit process the digital signal after that the waveform is reconstructed (again the
digital signal is converted into an analog form) and then that signal is applied to vertical plates of
the cathode ray tube (CRT).
The cathode ray tube has two inputs they are vertical input and horizontal input. The vertical
input signal is the ‘Y’ axis and the horizontal input signal is the ‘X’ axis. The time base circuit is
triggered by the trigger and clock input signal, so it is going to generate the time base signal
which is a ramp signal. Then the ramp signal is amplified by the horizontal amplifier, and this
horizontal amplifier will provide input to the horizontal plate. On the CRT screen, we will get the
waveform of the input signal versus time.
The digitizing occurs by taking a sample of the input waveform at periodic intervals. At the
periodic time interval means, when half of the time cycle is completed then we are taking the
samples of the signal. The process of digitizing or sampling should follow the sampling theorem.
The sampling theorem says that the rate at which the samples are taken should be greater than
twice the highest frequency present in the input signal. When the analog signal is not properly
converted into digital then there occurs an aliasing effect.
When the analog signal is properly converted into digital then the resolution of the A/D
converter will be decreased. When the input signals stored in analog store registers can be read
out at a much slower rate by the A/D converter, then the digital output of the A/D converter
stored in the digital store, and it allows operation up to 100 mega samples per second. This is the
working principle of a digital storage oscilloscope.
The digital storage oscilloscope works in three modes of operations they are roll mode, store
mode, and hold or save mode.
Roll Mode: In roll mode, very fast varying signals are displayed on the display screen.
Store Mode: In the store mode the signals stores in memory.
Hold or Save Mode: In hold or save mode, some part of the signal will hold for some time and
then they will be stored in memory.
Applications
Operation
There are four steps to using a logic analyzer:
The block numbers correspond to the four steps just listed. The acquisition probes connect to the
SUT. The probe’s internal comparator is where input voltage comparison occurs against the
threshold voltage and the signal’s logic state (l or 0) is determined. You set the threshold value,
ranging from TTL levels to CMOS, ECL, or your own user-definable ones.
Probe impedance (capacitance, resistance, and inductance) becomes part of the overall load
on the SUT. All probes exhibit loading characteristics. The logic analyzer probe should
introduce minimal loading on the SUT, and provide an accurate signal to the logic analyzer.
This roll-off slows down the edge transition by an amount of time represented as “t” in the
figure. Remember, slower edges cross the logic threshold of the circuit later, introducing timing
errors in the SUT. This problem becomes more severe as clock rates increase.
In high speed systems, excessive probe capacitance can potentially prevent the SUT from
working. It is always critical to choose a probe with the lowest possible total capacitance. It’s
also important to note that probe clips and lead sets increase capacitive loading on the SUT. Use
a properly compensated adapter whenever possible. The impedance of the logic analyzer’s probe
affects signal rise times and timing relationships.
Logic analyzers capture data from multi-pin devices and buses. The term “capture rate” refers to
how often the logic analyzer samples the inputs. It is the same function as the time base in an
oscilloscope. Logic analyzer literature interchangeably uses the terms “sample,” “acquire,” and
“capture.”
Timing acquisition captures signal timing information. In this mode, an internal clock samples
data. The faster it samples data, the higher the resolution of the resulting measurement. There is
no fixed timing relationship between the target device and the data the logic analyzer acquires.
Use this acquisition mode when you are concerned with the timing relationship between SUT
signals.
The acquisition mode acquires the “state” of the SUT. A signal from the SUT defines the sample
point (when and how often data is required). The clock signal you use in the acquisition mode
may be:
Software development tools are basically computer programs, and they usually run
on personal computers, helping the programmer (or system developer) to create
and/or modify or test applications programs. Some of the commonly used software
development tools are the following:
Text editors
Assemblers/compilers
Simulators
Assemblers:
The function of an assembler is to convert a code written in assembly language into machine
language.
An assembler is a program that takes basic computer instructions (called as assembly language)
and converts them into a pattern of bits that the computer's processor can use to perform its
basic operations.
Assemblers generate executable code from assembly language programs. The generated code is
usually loaded into the flash program memory of the target microcontroller.
Debugging tools in embedded system
Debugging is a methodical process to find and reduce the number of bugs in a computer
program or a piece of electronic hardware, so that it works as expected. Debugging is difficult
when subsystems are tightly coupled, because a small change in one subsystem can create bugs
in another. The debugging tools used in embedded systems differ greatly in terms of their
development time and debugging features.
Simulators
Code is tested for the MCU / system by simulating it on the host computer used for code
development. Simulators try to model the behavior of the complete microcontroller in software.
Functions of Simulators
A simulator performs the following functions −
Defines the processor or processing device family as well as its various versions for the
target system.
Monitors the detailed information of a source code part with labels and symbolic
arguments as the execution goes on for each single step.
Provides the status of RAM and simulated ports of the target system for each single step
execution.
Monitors system response and determines throughput.
Provides trace of the output of contents of program counter versus the processor
registers.
Provides the detailed meaning of the present command.
Monitors the detailed information of the simulator commands as these are entered from
the keyboard or selected from the menu.
Supports the conditions (up to 8 or 16 or 32 conditions) and unconditional breakpoints.
Provides breakpoints and the trace which are together the important testing and
debugging tool.
Facilitates synchronizing the internal peripherals and delays.
Emulators
An emulator is a hardware kit or a software program or can be both which emulates the
functions of one computer system (the guest) in another computer system (the host), different
from the first one, so that the emulated behavior closely resembles the behavior of the real
system (the guest).
Emulation refers to the ability of a computer program in an electronic device to emulate
(imitate) another program or device.
Emulation focuses on recreating an original computer environment. Emulators have the ability
to maintain a closer connection to the authenticity of the digital object.
An emulator helps the user to work on any kind of application or operating system on a
platform in a similar way as the software runs as in its original environment.
Compilers
A compiler is a computer program (or a set of programs) that transforms the source code written
in a programming language (the source language) into another computer language (normally
binary format). The most common reason for conversion is to create an executable program.
The name "compiler" is primarily used for programs that translate the source code from a high-
level programming language to a low-level language (e.g., assembly language or machine
code).
Debugger
A debugger is a tool used to debug your code.It is important to test whether the code you have
written is free from errors or not. So, a debugger is used for this testing.
Debugger goes through the whole code and tests it for errors and bugs.
It tests your code for different types of errors for example a run time error or a syntax error and
The line number or location of error is shown by debugger so you can go ahead and rectify it.
Integrated development Environment
An Integrated Development Environment is software that contains all the necessary tools
required for embedded software development.
So it is very helpful to have software that can provide all of the necessary tools from writing to
testing of your code, in one package.