Module 4 - Asynchronous and Synchronous Serial Communications, Periodic Interrupts, Waveform Generation, Time Measurement (New)
Module 4 - Asynchronous and Synchronous Serial Communications, Periodic Interrupts, Waveform Generation, Time Measurement (New)
Serial Communications,
Periodic Interrupts, Waveform
Generation, Time Measurement
CPE112: Embedded Systems
Serial Communication
❑ Serial Transfer
❑ serial communication is the process of sending/receiving data in one bit
at a time
Parallel Communication
❑ Parallel Transfer
❑ Parallel communication is the
process of sending/receiving
multiple data bits at a time
through parallel channels.
Serial vs Parallel Communication
5. Universal serial bus (USB): This is the most popular of all. Is used for
virtually all type of connections. The bus has 4 lines: VCC, Ground, Data+, and
Data-.
Serial Communication Protocols
6. Recommended Standard 232 (RS-232) : The RS-232 is typically connected
using a DB9 connector, which has 9 pins, out of which 5 are input, 3 are
output, and one is Ground. You can still find this so-called “Serial” port in
some old PCs. In our upcoming posts, we will discuss mainly about RS232 and
USART of AVR microcontrollers.
Timers and Counters
Timers/Counters are used generally for:
1. Time reference
2. Creating delay
3. Wave form properties measurement
4. Periodic interrupt generation
5. Waveform generation
Interrupts
Interrupt
❑ a signal which has highest priority from hardware or software which
processor should process its signal immediately.
Interrupt
❑ Polling method
▪ In early years of computing processor has to wait for the signal for processing,
so processor has to check each and every hardware and software program in
the system if it has any signal to process. In this method the problem
processor has to waste number of clock cycles just for checking the signal in
the system, by this processor will become busy unnecessarily. If any signal
came for the process, processor will take some time to process the signal due
to the polling process in action. So system performance also will be degraded
and response time of the system will also decrease.
Interrupt
❑ Interrupt-driven method
▪ It will not check for any signal from hardware or software but instead
hardware/software will only send the signal to the processor for processing.
The signal from hardware or software should have highest priority because
processor should leave the current process and process the signal of
hardware or software.
Types of Interrupts
1. Hardware Interrupts: If the signal for the processor is from external
device or hardware is called hardware interrupts. Example: from
keyboard we will press the key to do some action this pressing of
key in keyboard will generate a signal which is given to the
processor to do action, such interrupts are called hardware
interrupts.
▪ Hardware interrupts can be classified into two types they are
▪ Maskable Interrupt: The hardware interrupts which can be delayed when a much
highest priority interrupt has occurred to the processor.
▪ Non Maskable Interrupt: The hardware which cannot be delayed and should process by
the processor immediately
Types of Interrupts
2. Software Interrupts:
▪ Software interrupts can be classified into two types they are
▪ Normal Interrupts: the interrupts which are caused by the software instructions are
called software instructions.
▪ Exception: unplanned interrupts while executing a program is called Exception. For
example: while executing a program if we got a value which should be divided by zero is
called a exception.
Classification of Interrupts According to
Periodicity of Occurrence
1. Periodic Interrupt: If the interrupts occurred at fixed interval in
timeline then that interrupts are called periodic interrupts
▪ useful for real-time clocks, data acquisition systems, and control systems
Digital TDC
Time Measurements In Digital
❑ However, increasing the clock frequency raises two other issues;
first of all the power consumption increases and secondly, there is a
limit to the maximum oscillator frequency that can be implemented
in CMOS technology (Henzler, 2010).
❑ Vernier time measurements - improve the resolution by
interpolating in between the clock cycle pulses (without increasing
the clock frequency)
▪ Pierre Vernier (1580-1637), inventor of the metric caliper, perform a
mechanical interpolation between the millimeter markers of a ruler.
Time Measurements In Digital
❑ Vernier time measurements can be implemented in several different
ways, both in hardware and in software.
❑ In fact, according to Henzel (2010), the engine that performs this
subdivision of the reference clock cycles is what distinguishes a TDC
from a counter; the counter only provides the “coarse” quantization
value while the TDC provides the interpolated “fine-structure”.
Time measurement in embedded controllers
❑ The second generation time measurement units in microcontrollers
included an Input Capture feature, where the content of a running
timer is automatically latched into a “capture” register at the
occurrence of an external “event”. This is a great help in time
measurements since external events are automatically time
stamped by hardware.
Input Capture
Time measurement in embedded controllers
❑ Charge Time Measurement Unit (CTMU) – Microchip’s next
generation of embedded time measurement units
▪ consists first of all of a very accurate current source and it is used with an
internal ADC to measure either capacitance or time
Uncertainties in basic counting Time-to-
Digital Converter (TDC)
1. Quantization error
2. Trigger error
3. Time-base error
4. Systematic error
Uncertainties in microcontroller-based
Time-to-Digital Converter (TDC)
❑ In microcontroller-based TDCs, the quantization is not necessarily
limited to the ±1 count inherently found in counter-based TDCs; it
depends on the firmware algorithm and also on the hardware
resources used.
❑ For microcontrollers, internally generated threshold noise is rarely
specified in the data sheet.
Microcontroller-implementation of vernier TDC