0% found this document useful (0 votes)
13 views17 pages

L4 MicroControllers

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views17 pages

L4 MicroControllers

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Microcontrollers

Topics
• Microcontrollers vs. Microprocessors
• Microcontroller selection and features
• Common microcontrollers
• AVR Features
• AVR members
Microcontroller (μC) versus Microprocessor
(μP)
Microprocessor (μP) application
General purpose computer
Access + process data → data output
Computational power
Programming generality
Execution speed
Multiple processors for parallel processing
Each μP handles thread

Microcontroller (μC) application


Embedded system
Control external hardware operations
Cost efficiency
Small number of program tasks stored in permanent memory
Lowest possible cost
Multiple controllers for concurrent control problems
Each μC applied to small group of tasks
Microcontroller (μC) versus Microprocessor (μP)
• General Purpose Microprocessors
Data BUS

General Serial
IO
Purpose RAM ROM Timer COM
Port
Micro Port
processor Address BUS

Control BUS

• Microcontrollers

CPU RAM ROM

Serial
Timer I/O
Port
Some Microcontroller companies

Microchip acquired Atmel in 2016 Texas Instruments Freescale

Intel

Maxim

NXP SILICON LABS


Choosing a Microcontroller – Generic Requirements
Optimum device for given application
Device family
Uniform ISA
Different hardware resources, speed
Internal resources
Interrupts
Type + number of I/O lines (analog and digital)
Size of program and data memory
Space optimization
Smallest footprint at reasonable cost, packaging
Low power consumption
Battery powers applications using microcontrollers
Sleep state while microcontroller idle
Cost – cost per unit
Copy protection
Stored program protected against user reading
Wide availability and reliable source
Availability of hardware and software dev tools
Such as compiler, assembler, debugger and emulator
Microcontroller Components
Microprocessor core
Typically RISC-type μP
Memory
ROM holds program (FIRMWARE)
RAM / registers for data + configuration
Usually RAM < ROM
Timers
Time internal / external events
Watchdog — timeout resets system if code loop fails
Controller I/O
Interrupt controller — external event grabs processor attention
Analog ↔ digital converters (A/D and D/A)
Digital signal processor (DSP)
Serial ↔ parallel converters (UART)
Oscillator Generates clock signal to synchronize all internal operations
Special Purpose Registers
Special Purpose Registers
Instruction register
Holds executing instruction
Program counter
Points to next instruction
Accumulator
Associated with ALU operations
One operand must be in ACC
Result stored in ACC
Status register (flags)
Set configuration
Results of ALU operations
Data address register (DAR)
Stores data memory addresses
Stack pointer
Points to last element pushed to stack
Reset
Initializes microcontroller
Sets PC to preset value (init address)
Microcontroller starts executing commands from init address
Causes of reset
Power up
Controller resets at startup
Manual reset
Press reset button
Power-glitch reset
Detect spike on power supply
Brown-out reset
Input voltage drops below threshold
Watchdog timer (WDT)
Power Consumption
Low power consumption
Most microcontroller applications on battery power
Low power chip technology
Complementary metal-oxide semiconductor (CMOS)
Clock frequency
Power consumed only on logic transition 1 ↔ 0
Higher clock frequency ⇒ more transitions /second ⇒ more pow
Supply voltage
Higher supply voltage ⇒ faster + higher power
Sleep state
Stop clock ⇒ 0 transitions /second ⇒ no power
Leave low-power mode by external interrupt or reset
Key press
Interrupt
Most common microcontrollers
• 8-bit microcontrollers
• AVR
• PIC
• HCS12
• 8051
• 32-bit microcontrollers
• ARM
• PIC32
AVR internal architecture
40 PIN DIP
(XCK/T0) PB0 1 40 PA0 (ADC0)
(T1) PB1 2 RAM 39 EEPROM
PA1 (ADC1) Timers
(INT2/AIN0) PB2 3 38 PA2 (ADC2)
(OC0/AIN1) PB3 4 MEGA32 37 PA3 (ADC3)
PROGRAM (SS) PB4 5 36 PA4 (ADC4)
ROM (MOSI) PB5 6 35 PA5 (ADC5)
(MISO) PB6 7 34 PA6 (ADC6)
Program (SCK) PB7 8 33 PA7 (ADC7)
RESET 9 32 AREF
Bus Bus
VCC 10 31 AGND
CPU GND 11 30 AVCC
XTAL2 12 29 PC7 (TOSC2)
XTAL1 13 28 PC6 (TOSC1)
(RXD) PD0 14 27 PC5 (TDI)
(TXD) PD1 15 26 PC4 (TDO)
(INT0) PD2 16 25 PC3 (TMS)
(INT1) PD3 17 24 PC2 (TCK)
(OC1B) PD4 18
Interrupt 23 PC1 (SDA)
Other
OSC (OC1A) PD5 19 22 Ports
PC0 (SCL)
(ICP) PD6 20 Unit 21 PD7 (OC2) Peripherals

I/O
PINS
AVR different groups
• Classic AVR – Original chip, has been replaced now
• e.g. AT90S2313, AT90S4433
• Mega – Powerful, More than 120 instruction set
• e.g. ATmega8, ATmega32, ATmega128
• XMEGA - Extended performance and peripherals
• Tiny
• e.g. ATtiny13, ATtiny25
• Special Purpose AVR
• e.g. AT90PWM216,AT90USB1287
ATtiny25 block diagram
Let’s get familiar with the AVR part numbers
ATmega128

Atmel group
Flash =128K

ATtiny44 AT90S4433

Atmel
Tiny Flash =4K Atmel Classic
Flash =4K
group group
Watchdog Timer

The watchdog timer watches over the operation of the system. This
may include preventing runaway code or in our C example, a lost
communications link.
The watchdog timer operates independent of the CPU, peripheral
subsystems, and even the clock of the MCU.
The Watchdog always on (WDTON) fuse, if programmed, will force the Watchdog Timer to System Reset
mode. With the fuse programmed (WDTON = 0) the System Reset mode bit (WDE) and mode bit (WDIE) are
locked to 1 and 0 respectively.

Configuration bits are found in the WDTCSR – Watchdog Timer Control Register. Before you can change the WDE
and/or prescaler bits (WDP3:0), the WDCE – Watchdog Change Enable bit must be set.

You might also like