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

Post on 04-Jan-2022

2 views 0 download

transcript

AdvancedAdvanced MicrocontrollersMicrocontrollers

Grzegorz BudzyGrzegorz Budzyńń

LLectureecture 4:4:1616--bit bit microcontrollersmicrocontrollers

Plan

• MSP430 family

• PIC24 family

Introduction – MSP430

TI microcontrollers portfolio

Sourc

e: [1

]

TI microcontrollers portfolio

Sourc

e: [1

]

Introduction

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

Introduction – block diagram

Sourc

e: [2

]

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

MSP430X – block

diagram

Sourc

e: [2

]

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.

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

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

MSP430X Core - Registers

• Registers R4-R15 are 20-bit wide

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

MSP430X Core - Addressing modes

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

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

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

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

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

Symbolic addressing mode

• Example:

– Before operation: XPT=A002h Location

YPT=050Ah

– Operation: MOV XPT, YPT

– After operation: XPT= A002h Location YPT=A002h

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

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)

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

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

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

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

MSP430 Core - Instructions formats

MSP430 Core - Instructions formats

MSP430X Core - Instructions formats

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

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

Flexible Clocking System

Sourc

e: [2

]

Low Power Modes

Sourc

e: [2

]

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

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.

Peripherals – types 1/3

• ADC 10b, ADC 12b

• Analog Comparator

• DAC 12b

• DMA

• Hardware Multiplier

• Operation Amplifiers!

• Timers

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

Peripherals – types 3/3• AES

• USB

• SPI

• I2C

• LIN/IrDA

• SCAN_IF

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

• LCD

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

]

MSP430 – families

MSP430 – Power consumption

MSP430 – Power consumption

Sourc

e: [3

]

MSP430 – Power consumption vs PIC16

Sourc

e: [3

]

MSP430 – MPY32

Sourc

e: [4

]

MSP430 – MPY32

• Main features:

– Hardware multiplier 16x16

– Signed and unsigned MAC operations

– Integer and fractional operations

– 64-bit results

MSP430 – MPY32

• Result availability:

MSP430 – USB

Sourc

e: [4

]

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)

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

MSP430FG4619 - OpAmp

Sourc

e: [4

]

MSP430 – OpAmp

Modes of operation:

MSP430 – OpAmp

With more than one OpAmp block there is

possibility to form more complicated circuits

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).

MSP430 – ScanIF

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

MSP430FG4619 – ScanIF

PIC24

Introduction

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)

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

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

Sourc

e: [1

]

Sourc

e: [1

]

Peripheral Pin Select

Sourc

e: [1

]

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

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

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

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

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)

Thank you for your attention

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