A single chip, self-contained computer with main components: CPU, RAM, ROM, I/O, Timer, Interrupt circuitry, Buses, Oscillatory circuits, A/D Converters
Microprocessor (μP)
A general-purpose processor that needs external components to interact
Microcontrollers are
Optimized to control electronic devices
Microcontrollers are usually used for
Controlling industrial equipment and machinery
Microcontrollers
Have special instructions like bit manipulation instructions
Addedfeatures of a microcontroller over a microprocessor
Nonvolatile Program and Data Memories
Internal SRAM
A/D
Analog Comparator
Internal Calibrated RC Oscillator
Timers/Counters
External and Internal Interrupt Sources
Sleep Modes
Serial Peripheral Interface (SPI), USART, Two-wire Serial Interface
Watchdog
RISC (Reduced Instruction Set Computer)
Simple with fixed length instruction set, executes one instruction per clock cycle, requires very fast memory systems
CISC (Complex Instruction Set Computer)
Very powerful but complex instruction set, accesses memory less frequently, instructions take more than one cycle to execute, slower speed
Pipelining in RISC architectures
1. Allows the processor to work on different steps of instruction like fetch, decode and execute simultaneously
2. Each instruction is executed in number of stages simultaneously
3. When the first stage of first instruction is completed, next instruction enters the first stage
4. This process continues until all instructions are executed
Embedded system
A computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints, embedded as part of a complete device often including hardware and mechanical parts
Embedded systems
Have minimal requirements for memory and program size, need to communicate with simple inputs and outputs, rarely need keyboards, screens, disks, printers but simple displays, microcontrollers are usually dedicated to one task and run one specific program
Advantages of embedded systems
Cheap
Very small in size
Programming of microcontrollers is simple to learn (C language or Assembly)
Ability to simulate project before implementation
Embedded systems solutions
System-on-Chip (SoC)
Microcontroller
Arduino
Raspberry Pi
AVR microcontroller
A family of microcontrollers developed by Atmel Corporation, focused on embedded systems, conceived by two students at the Norwegian Institute of Technology
AVR microcontroller families
Tiny AVR (8-32 pin, 16 members)
Mega AVR (32-100 pin, 23 members)
Xmega AVR (32-100 pin)
AVR UC3 (32-bit, DSP support, dual port SRAM)
ATmega16 microcontroller
Harvard architecture, 8-bit, 16MIPS @ 16MHz, EEPROM, Two 8-bit and One 16-bit timer with 4 PWM channels, On-chip 10-bit ADC, 8 channels, UART, I2C, SPI protocol support
Microcontroller building blocks
Processor Core (CPU)
Memory (Registers, Data/Instruction Memory)
AVR
Alf and Vegard's RISC processor
AVR families
Tiny AVR
Mega AVR
Xmega AVR
AVR UC3
Tiny AVR family
8 -32 pin
16 family members
Mega AVR family
32 -100 pin
23 family members
Xmega AVR family
32 -100 pin
AVR UC3
32-bit
DSP support
Dual port SRAM
ATmega16
Harvard architecture
8 bit Microcontroller
High performance - 16MIPS @ 16MHz
EEPROM – non volatile memory
Two 8 bit, One 16 bit timer with total 4 PWM channels
On chip 10 bit ADC, 8 channels
UART, I2C, SPI protocol support
Processor Core
The main part of any microcontroller, often taken from an existing processor
Microcontroller building blocks
Processor Core
Memory
Buses
Register
A temporary (internal) storage element
Data/Instruction Memory
External memory to a CPU, different members in a MCU family usually provide different amounts
Data Bus
Allows data to be passed from a register or an input to the ALU at one instant and from the ALU to a register or to an output at another instant
System buses
Address bus
Data bus
Control lines
Address bus
Unidirectional, carries Memory and I/O Addresses
Data bus
Bidirectional, transfers Binary Data and Instructions
Control lines
Carry Read and Write timing signals
Port
Group of 8 pins, or set of pins used for exchanging data with external world
Width of almost all registers : 8 bits (some 16 bits)
In port related registers, every bit corresponds to one pin of the port. Bit 0 corresponds to Pin 0, Bit 1 corresponds to Pin 1 .. Etc
There is a direct one to one correspondence between HEX and BINARY numbers.
Pin types
GND
VCC
AVCC
AREF
Reset
Pull Up Resistor
Used to ensure that tri-stated input always reads HIGH (1) when it is not driven by any external entity
General Purpose IO
Data Direction Input or Output, Internal Pullup can be used for Input Pins, Output driver can source 20mA current