72
Advanced Advanced Microcontrollers Microcontrollers Grzegorz Budzy Grzegorz Budzy ń ń L L ecture ecture 4: 4: 16 16 - - bit bit microcontrollers microcontrollers

Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

AdvancedAdvanced MicrocontrollersMicrocontrollers

Grzegorz BudzyGrzegorz Budzyńń

LLectureecture 4:4:1616--bit bit microcontrollersmicrocontrollers

Page 2: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Plan

• MSP430 family

• PIC24 family

Page 3: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Introduction – MSP430

Page 4: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

TI microcontrollers portfolio

Sourc

e: [1

]

Page 5: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

TI microcontrollers portfolio

Sourc

e: [1

]

Page 6: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Introduction

Page 7: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Introduction• MSP430 Microcontrollers (MCUs) from Texas

Instruments (TI) are:

– 16-bit RISC-based MCUs

– mixed-signal processors designed specifically for

ultra-low-power (ULP).

– MSP430 MCUs have a mix of intelligent

peripherals

– Low cost

Page 8: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Introduction – block diagram

Sourc

e: [2

]

Page 9: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Introduction - Architecture

• Main features:

– 8-MHz to 25-MHz CPU Speed

– 0.5KB to 256KB Flash

– 128B to 16KB RAM

– 14 to 113 pins;

– 22 packages

Page 10: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430X – block

diagram

Sourc

e: [2

]

Page 11: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430X Core• Main features:

– RISC architecture

– Orthogonal architecture

– Full register access including program counter (PC), status register (SR), and stack pointer (SP)

– Single-cycle register operations

– Large register file reduces fetches to memory.

– 20-bit address bus allows direct access and branching throughout the entire memory range without paging.

Page 12: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430X Core• Main features:

– 16-bit data bus allows direct manipulation of

word-wide arguments.

– Constant generator provides the six most often

used immediate values and reduces code size.

– Direct memory-to-memory transfers without

intermediate register holding

– Byte, word, and 20-bit address-word addressing

Page 13: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430X Core - Status Register

• V – overflow, N – negative, Z-Zero, C-Carry

• SCG1, SCG0 – switching on/off system clock

generators

• OSC OFF – switching osciallator off

• CPU OFF – switching CPU off

• GIE – interrupt enable

Page 14: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430X Core - Registers

• Registers R4-R15 are 20-bit wide

• Registers can be used for 8-, 16- or 20-bit data

Page 15: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430X Core - Addressing modes

Page 16: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Register addressing mode

• Register mode operations work directly on the

processor registers, R4 through R15, or on

special function registers, such as the program

counter or status register

• They are very efficient in terms of both

instruction speed and code space

Page 17: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Register addressing mode

• Example:

– Before operation: R4=A002h R5=F50Ah PC = PCpos

– Operation: MOV R4, R5

– After operation: R4=A002h R5=A002h PC = PCpos + 2

Page 18: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Indexed addressing mode

• The Indexed mode commands are formatted

as X(Rn), where X is a constant and Rn is one

of the CPU registers

• The absolute memory location X+Rn is

addressed

• Indexed mode addressing is useful for

applications such as lookup tables

Page 19: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Indexed addressing mode

• Example:

– Before operation: R4=A002h R5=050Ah

Loc:0xF50A=0123h

– Operation: MOV F000h(R5), R4

– After operation: R4=0123h R5=050Ah

Loc:0xF50A=0123h

Page 20: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Symbolic addressing mode

• Symbolic mode allows the assignment of

labels to fixed memory locations, so that

those locations can be addressed

• Symbolic mode allows the assignment of

labels to fixed memory locations, so that

those locations can be addressed

Page 21: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Symbolic addressing mode

• Example:

– Before operation: XPT=A002h Location

YPT=050Ah

– Operation: MOV XPT, YPT

– After operation: XPT= A002h Location YPT=A002h

Page 22: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Absolute addressing mode

• Similar to Symbolic mode, with the difference

that the label is preceded by “&”

• Example:

– Before operation: Location XPT=A002h Location

YPT=050Ah

– Operation: MOV &XPT, &YPT

– After operation: Location XPT= A002h Location

YPT=A002h

Page 23: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Indirect register addressing mode

• The data word addressed is located in the

memory location pointed to by Rn

• Indirect mode is not valid for destination

operands, but can be emulated with the

indexed mode format 0(Rn)

Page 24: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Indirect register addressing mode

• Example:

– Before operation: R4=A002h R5=050Ah

Loc:0xA002=0123h

– Operation: MOV @(R4), R5

– After operation: R4= A002h R5=0123h

Loc:0xA002=0123h

Page 25: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Indirect auto increment mode

• Similar to indirect register mode, but with

indirect auto increment mode

• The operand is incremented as part of the

instruction

• The format for operands is @Rn+

• This is useful for working on blocks of data

Page 26: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Indirect auto increment mode

• Example:

– Before operation: R4=A002h R5=050Ah

Loc:0xA002=0123h

– Operation: MOV @R4+, R5

– After operation: R4= A004h R5=0123h

Loc:0xA002=0123h

Page 27: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Immediate addressing mode

• Immediate mode is used to assign constant

values to registers or memory locations

• Example:

– Before operation: R4=A002h R5=050Ah

– Operation: MOV #E2h, R5

– After operation: R4= A002h R5=00E2h

Page 28: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 Core - Instructions formats

Page 29: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 Core - Instructions formats

Page 30: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430X Core - Instructions formats

Page 31: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Introduction – Ultra Low Power

• The MSP430 MCU is designed specifically for

ultra-low-power applications.

• It has:

– flexible clocking system

– multiple low-power modes

– instant wakeup

– intelligent autonomous peripherals

Page 32: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Flexible Clocking System

• The MSP430 MCU clock system has the ability

to enable and disable various clocks and

oscillators

• This allows the device to enter various low-

power modes (LPMs)

• The flexible clocking system optimizes overall

current consumption by only enabling the

required clocks when appropriate

Page 33: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Flexible Clocking System

Sourc

e: [2

]

Page 34: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Low Power Modes

Sourc

e: [2

]

Page 35: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Instant Wakeup• The MSP430 MCU can wake-up instantly from

LPMs.

• This ultra-fast wake-up is enabled by the

MSP430 MCU’s internal digitally controlled

oscillator (DCO)

• DCO can source up to 25 MHz and be active

and stable in 1μs.

• Instant wake-up functionality is very

important in ultra-low power applications

Page 36: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Intelligent Peripherals

• The MSP430 MCU’s peripherals have been

designed to assure maximum functionality

and provide system-level interrupts, resets

and bus arbitration at the lowest power

• Many peripherals may function autonomously

thereby minimizing CPU time spent in active

mode.

Page 37: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Peripherals – types 1/3

• ADC 10b, ADC 12b

• Analog Comparator

• DAC 12b

• DMA

• Hardware Multiplier

• Operation Amplifiers!

• Timers

Page 38: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Peripherals – types 2/3• WDT

• Basic Timers

• RTC

• PMM (Power Management Module)

• BOR (Brown-out Reset)

• SVS (Supply Voltage Supervisor)

• EDI (Enhanced Data Integrity)

• RF Front End

Page 39: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Peripherals – types 3/3• AES

• USB

• SPI

• I2C

• LIN/IrDA

• SCAN_IF

• SD16 (up to seven 16-bit sigma-delta ADC)

• LCD

Page 40: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – families

• Main pins:

– RST – active high

– EA – External Access – logic „0” means execution

of program from internal ROM

– PSEN - Program Store Enable – OE for external

memory

– ALE - Address Latch Enable – signal used for

demultiplexing of data and address

Sourc

e: [2

]

Page 41: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – families

Page 42: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – Power consumption

Page 43: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – Power consumption

Sourc

e: [3

]

Page 44: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – Power consumption vs PIC16

Sourc

e: [3

]

Page 45: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – MPY32

Sourc

e: [4

]

Page 46: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – MPY32

• Main features:

– Hardware multiplier 16x16

– Signed and unsigned MAC operations

– Integer and fractional operations

– 64-bit results

Page 47: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – MPY32

• Result availability:

Page 48: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – USB

Sourc

e: [4

]

Page 49: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – USB

• Main features:

– Compatible with USB2.0 Full Speed (12 Mb/s)

– Up to 8 end points

– Internal USB clock – 48MHz (PLL)

– Independent from the rest of the controller

– 1904B of buffer RAM (usable in main program)

Page 50: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – OpAmpThe OA op amps support front-end analog signal

conditioning prior to analog-to-digital conversion.

Features of the OA include:

• Single supply, low-current operation

• Rail-to-rail output

• Software selectable rail-to-rail input

• Programmable settling time vs power consumption

• Software selectable configurations

• Software selectable feedback resistor ladder for PGA implementations

Page 51: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430FG4619 - OpAmp

Sourc

e: [4

]

Page 52: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – OpAmp

Modes of operation:

Page 53: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – OpAmp

With more than one OpAmp block there is

possibility to form more complicated circuits

Page 54: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – ScanIF

The ScanIF module is used to automatically

measure linear or rotational motion with the

lowest possible power consumption

The ScanIF module consists of:

• the analog front end (AFE),

• the processing state machine (PSM),

• the timing state machine (TSM).

Page 55: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – ScanIF

Page 56: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430 – ScanIF• Features:

– � Support for different types of LC sensors

– � Measurement of sensor signal envelope

– � Measurement of sensor signal oscillaRon amplitude

– � Support for resisRve sensors such as Hall-effect or giant

magneto-resistive (GMR) sensors

– � Direct analog input for A/D conversion

– � Direct digital input for digital sensors such as opRcal

decoders

– � Support for quadrature decoding

Page 57: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

MSP430FG4619 – ScanIF

Page 58: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

PIC24

Page 59: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Introduction

Page 60: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

PIC24 microcontrollers

• Main features:

– Family of 16-bit microcontrollers

– Two sub-families:

• PIC24F – lower performance, lower power

consumption

• PIC24H – highest performance

– Large effort put to precisely control execution

time:

• Single cycle bit manipulation

• Fast interrupt response (5 cycles)

Page 61: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

PIC24 microcontrollers

• Main features:

– Modified Harvard architecture

– 16-bit ALU

– 16 x 16b universal registers

– Up to 256kB Flash

– Up to 16 kB SRAM

– Up to 512B EEPROM

Page 62: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

PIC24 microcontrollers

• Main features:

– Up to 8 DMA channels

– 16b timer/counters

– Function Peripheral Pin Select (PPS)

– NanoWatt technology (PIC24F)

– Cases from 14 to 100 pins

Page 63: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Sourc

e: [1

]

Page 64: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Sourc

e: [1

]

Page 65: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Peripheral Pin Select

Sourc

e: [1

]

Page 66: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Peripheral Pin Select• Peripheral Pin Select (PPS) - new feature on

Microchip’s microcontrollers

• PPS multiplexes many of the digital

peripherals on the microcontroller with a

number of I/O pins

• The multiplexing effectively allows you to

choose which peripherals are allocated to the

available external pins

Page 67: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Peripheral Pin Select• PPS eliminates the peripheral blocking that

occurs when functions are multiplexed to a

small number of fixed pins

• The flexibility enabled by PPS allows to choose

a smaller, more cost-effective device, rather

than designing in a larger pin count device, in

order to access the needed peripherals

Page 68: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

PIC24 - peripherals• General Purpose Peripherals & device

features:

– ● Real-time Clock & Calendar

– ● Cyclic Redundancy Check

– ● USB

– ● 10 & 10/12-bit A/D Converters

– ● Comparator

– ● 10-bit & 16-bit D/A Converter

– ● Direct Memory Access

– ● Parallel Master Port

Page 69: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

PIC24 - peripherals• Motor Control, Lighting & 3-phase Energy Metering

Application Peripherals:

– ● Motor Control PWM

– ● Quadrature Encoder Interface

– ● 10/12-bit A/D Converter

• Switch Mode Power Supply & HID Lighting Peripherals:

– ● SMPS PWM

– ● SMPS ADC

– ● Comparators

Page 70: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

PIC24 - peripherals• Audio Peripherals:

– ● 12-bit A/D Converter

– ● 16-bit D/A Converter

– ● Output Compare PWM

– ● Data Converter Interface

• Display Graphics Peripherals:

– ● Parallel Master Port (QVGA)

– ● Charge Time Measurement Unit (touch-screen)

Page 71: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

Thank you for your attention

Page 72: Advanced Microcontrollers Grzegorz Budzyń Lecture 4: 16

References[1] www.ti.com

[2] MSP430 family documentation; www.ti.com

[3] MSP430x20 family documentation; www.ti.com

[4] MSP430F5435 documentation; www.ti.com

[5] http://cnx.org/content/m23500/latest/

[6] PIC24 family documentation; www.microchip.com

[9] http://www.allaboutcircuits.com/vol_2/chpt_13/6.html