Microcontroller and Embeddes System - ARM Program Optimization 3
Microcontroller and Embeddes System - ARM Program Optimization 3
MICROCONTROLLER AND
EMBEDDED SYSTEMS
MODULE 4
Syllabus- Module 4 2
o Memory
o History of embedded systems
o Sensors,
o Classification of Embedded systems
o Actuators
o Major applications areas of embedded
o LED, 7 segment LED display
systems
o Stepper motor, Keyboard, Push button switch,
o Purpose of embedded systems. o Communication Interface (onboard and external types),
o Embedded firmware,
➢ The program memory or code storage memory of an embedded system stores the program
instructions.
➢ The code memory retains its contents even after the power is turned off. It is generally
known as non-volatile storage memory.
➢ Different mechanisms are used for the masking process of the ROM, like
Creation of an enhancement or depletion mode transistor through channel
implant.
o By creating the memory cell either using a standard transistor or a high
threshold transistor.
➢ In the high threshold mode, the supply voltage required to turn ON the
transistor is above the normal ROM IC operating voltage.
➢ This ensures that the transistor is always off and the memory cell stores
always logic 0.
Program Storage Memory ( ROM)- Programmable Read Only
7
Memory (PROM) / (OTP)
➢ One Time Programmable Memory (OTP) or PROM is not pre-programmed by the manufacturer.
o The end user is responsible for programming these devices.
➢ This memory has nichrome or polysilicon wires arranged in a matrix. These wires functionally
viewed as fuses.
o It is programmed by a PROM programmer which selectively burns the fuses according to the bit
pattern to be stored.
➢ OTP is widely used for commercial production of embedded systems whose prototyped versions
are proven and the code is finalised.
o It is a low cost solution for commercial production.
➢ EPROM stores the bit information by charging the floating gate of an FET(Field Effect
Transistor).
➢ EPROM contains a quartz crystal window for erasing the stored information.
o If the window is exposed to ultraviolet rays for a fixed duration, the entire memory will be erased.
➢ Even though the EPROM chip is flexible in terms of re-programmability, it needs to be taken
out of the circuit board and put in a UV eraser device for 20 to 30 minutes.
o It is a tedious and time-consuming process.
Program Storage Memory ( ROM)- Electrically Erasable
9
Programmable Read only Memory (EEPROM)
➢ RAM is volatile – when the power is turned off, all the contents are destroyed.
➢ RAM is a direct access memory – we can access the desired memory location directly
without the need for traversing through the entire memory locations to reach the desired
memory position (i.e. random access of memory location).
➢ This is in contrast to the Sequential Access Memory (SAM), where the desired memory
location is accessed by either traversing through the entire memory or through a 'seek'
method. Magnetic tapes, CD ROMs, etc. are examples of sequential access memories.
Read-Write Memory/Random Access Memory (RAM)
13
➢ RAM generally falls into three categories: Static RAM (SRAM), Dynamic RAM
(DRAM) and Non-Volatile RAM (NVRAM).
Random Access Memory (RAM) - Static RAM (SRAM)
14
➢ In typical implementation, an SRAM cell (bit) is realised using six transistors (or
6 MOSFETs).
o Four of the transistors are used for building the latch (flip-flop) part of the memory cell
and two for controlling the access.
➢ The major limitations of SRAM are low capacity and high cost.
Random Access Memory (RAM) - Static RAM (SRAM)
15
➢ This implementation in its simpler form can be visualised as two cross-coupled inverters
with read/write control through transistors.
➢ Special circuits called DRAM controllers are used for the refreshing
operation.
➢ The interface (connection) of memory with the processor/controller can be of various types.
o Parallel interface
➢ Serial interface is commonly used for data storage memory like EEPROM.
o The memory density of a serial memory is usually expressed in terms of kilobits, whereas that of a parallel
interface memory is expressed in terms of kilobytes.
o Atmel Corporations AT24C512 is an example for serial memory with capacity 512 kilobits and 2-wire
interface.
Memory Shadowing 21
o Usually it is read and the system is configured according to it during system boot up and
it is time consuming.
Memory Shadowing (continued) 22
➢ In memory shadowing, a RAM is included behind the logical layer of BIOS at its
same address as a shadow to the BIOS.
➢ The first step that happens during the boot up is copying the BIOS to the
shadowed RAM and write protecting the RAM then disabling the BIOS reading.
o RAM is volatile and it cannot hold the configuration data which is copied from the BIOS
when the power supply is switched off. Only a ROM can hold it permanently.
o But for high system performance it should be accessed from a RAM instead of accessing
from a ROM.
Memory Selection for Embedded Systems 23
➢ Embedded systems require a Program memory for holding the control algorithm or
embedded OS and the applications designed to run on top of it
➢ Data memory for holding variables and temporary data during task execution
➢ Memory for holding non-volatile data (like configuration data, look up table etc) which are
modifiable by the application
➢ The memory requirement for an embedded system in terms of RAM and ROM
(EEPROM/FLASH/NVRAM) is solely dependent on the type of the embedded system and
the applications for which it is designed.
➢ Lot of factors need to be considered when selecting the type and size of memory for
embedded system.
Memory Selection for Embedded Systems 24
1. Size of the memory chip – Memory density expressed in terms of number of memory bytes
per chip.
o Memory chips come in standard sizes
• like 512 bytes, 1024 bytes (1 kilobyte), 2048 bytes (2 kilobytes), 4KB, 8KB, 16KB, 32KB, 64KB, 128KB, 256KB, 512KB, 1024KB(1
megabytes), etc.
o While selecting a memory size, the address range supported by the processor must also be considered.
o The entire memory range supported by the processor/controller may not be available to the memory chip
alone. It may be shared between I/O, other ICs and memory.
2. Word size of the memory – The number of memory bits that can be read/written together at
a time.
o Word size can be 4, 8, 12, 16, 24, 32, etc.
o The word size supported by the memory chip must match with the data bus width of the
processor/controller.
Sensors and Actuators 25
➢ An embedded system is in constant interaction with the real world and the
controlling/monitoring functions executed by the embedded system is
achieved in accordance with the changes happening to the real world.
➢ The changes in system environment or variables are detected by the
sensors connected to the input port of the embedded system.
➢ If the embedded system is designed for any controlling purpose, the
system will produce some changes in the controlling variable to bring the
controlled variable to the desired value. It is achieved through an actuator
connected to the output port of the embedded system.
Sensors and Actuators 26
➢ Light Emitting Diode (LED) is an important output device for visual indication in any
embedded system.
o LED can be used as an indicator for the status of various signals or situations.
➢ Light Emitting Diode is a p-n junction diode and it contains an anode and a cathode.
o For proper functioning of the LED, the anode is connected to +ve terminal of the supply voltage and
cathode to the -ve terminal of supply voltage.
➢ The current flowing through the LED must be limited to a value below the maximum current
that it can conduct.
o In the second method, the cathode of the LED is connected to the port pin of the
processor/controller and the anode to the supply voltage through a current
limiting resistor.
• The LED is turned on when the port pin is at logic Low (Logic '0’).
➢ The 7-segment LED displays are available in two different configurations, namely; Common Anode
and Common Cathode.
➢ In the common anode configuration, the anodes of the 8 segments are connected commonly whereas
in the common cathode configuration, the cathodes of 8 LED segments are connected commonly.
➢ Based on the configuration of the 7-segment LED unit, the LED segment's anode or cathode
is connected to the port of the processor/controller in the order 'A' segment to the least
significant port pin and DP segment to the most significant port pin.
➢ The current flow through each of the LED segments should be limited to the maximum
value supported by the LED display unit.
o The typical value is 20mA.
o The current can be limited by connecting a current limiting resistor to the anode or cathode of
each segment.
➢ 7-segment LED display is used in low cost embedded applications like Public telephone call
monitoring devices, point of sale terminals, etc.
Stepper Motor 33
➢ Current in one direction flows through one coil and in the opposite direction
flows through the other coil.
➢ Similarly, B and D carry current in opposite directions for phase 2 (only one of them
will be carrying current at a time).
Stepper Motor -Bipolar 35
➢ For reversing the motor rotation, the current flow through the
➢ For detecting a key press, the keyboard uses the scanning technique, where
each row of the matrix is pulled low and the columns are read.
o After reading the status of each columns corresponding to a row, the row is
pulled high and the next row is pulled low and the status of the columns are read.
o This process is repeated until the scanning for all rows are completed.
➢ When a row is pulled low and if a key connected to the row is pressed,
reading the column to which the key is connected will give logic 0.
Keyboard 40
➢ Since keys are mechanical devices, there is a possibility for de-bounce issues, which may
give multiple key press effect for a single key press.
o To prevent this, a proper key de-bouncing technique should be applied.
o Hardware key de-bouncer circuits and software key de-bounce techniques are the key de-
bouncing techniques available.
➢ In the software de-bouncing technique, on detecting a key-press, the key is read again after a
de-bounce delay.
o If the key press is a genuine one, the state of the key will remain as ‘pressed’ on the second read
also.
➢ Pull-up resistors are connected to the column lines to limit the current that flows to the Row
line on a key press.
Push Button Switch 41
➢ It is an input device.