Vous êtes sur la page 1sur 42

November 05

Cours Microinformatique I

Microinformatique I

Introduction au dsPIC
Francesco Mondada
Laboratoire de systmes autonomes
I2S - STI - EPFL

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 1
November 05

Microinformatique I

Introduction
dsPIC est une famille de micro-contrleurs qui allie la structure
dun micro-contrleurs et celle dun DSP (Digital Signal Processor)

La famille est compose de trois sous-familles


General purpose family (codec interface)
Sensor family (petits)
Motor control family (avec contle de PWM et encodeur)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 2
November 05

Microinformatique I

Structure

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 3
November 05

Microinformatique I

Structure

Coeur du
contrleur

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 4
November 05

Microinformatique I

Structure

Gestion des
adresses

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 5
November 05

Microinformatique I

Structure

IMPORTANT:
Deux bus X et Y

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 6
November 05

Microinformatique I

Structure

Priphriques

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 7
November 05

Microinformatique I

Structure: priphriques

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 8
November 05

Microinformatique I

Structure

Pinning

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 9
November 05

Microinformatique I

Structure

Pinning: partage
des fonctions

(Change
Notification
Module)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 10
November 05

Microinformatique I

Structure

Pinning: partage
des fonctions

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 11
November 05

Microinformatique I

Structure

Timer (5 x 16bit)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 12
November 05

Microinformatique I

Structure

Timer (2 x 32bit)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 13
November 05

Microinformatique I

Structure
Input capture (8x)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 14
November 05

Microinformatique I

Structure
Output
Compare
(8x)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 15
November 05

Microinformatique I

Structure
Serial Peripheral Interface SPI (concept)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 16
November 05

Microinformatique I

Structure
SPI
(2x)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 17
November 05

Microinformatique I

Structure
I2C (1x)
Inter-Integrated
Circuit

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 18
November 05

Microinformatique I

Structure
Universal
Asynchronous
Receiver
Transmitter
(UART)
(2x)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 19
November 05

Microinformatique I

Structure
Universal
Asynchronous
Receiver
Transmitter
(UART)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 20
November 05

Microinformatique I

Structure
Controller
Area
Network
(CAN)
(2x)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 21
November 05

Microinformatique I

Structure
Data
Converter
Interface
(DCI)
(1x)

I2S (Inter-IC Sound)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 22
November 05

Microinformatique I

Structure
12 bit A/D
(16x)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 23
November 05

Microinformatique I

Programmation
Les dsPIC ont un set dinstuctions assez important (84), dont la
grande majorit est execute en un cycle

Les instructions sont optimises pour effectuer du calcul rapide:


DEC2, INC2 en plus que DEC, INC
DISI (disable interrupt for k cycles)
DO W,address (do code to address W times)
MAC Wn,Wm,A (A=A+Wn*Wm)
ED (euclidian distance: A=A+(Wn-Wm)2)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 24
November 05

Microinformatique I

Programmation
Modle
de
programmation

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 25
November 05

Microinformatique I

Programmation
Modle
de
l
programmation eve
L
y
rit
ir o e
A B A B AB AB e rr
y P tiv
w w te te o w te tiv a upt Ac tive low
lf o lf o ra ra fl ra c C rr at a rf o y
r r u tu ver atu o A it te rr
ve ve at a ig n ep eg ve er a
O O S S O S D D I R N O Z C

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 26
November 05

Microinformatique I

Programmation
Modle
de
programmation

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 27
November 05

Microinformatique I

Programmation
Mmoire programme

100k cycles

1M cycles

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 28
November 05

Microinformatique I

Programmation
(Special Function Register)
Mmoire donnes

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 29
November 05

Microinformatique I

Programmation
Instructions:
Move

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 30
November 05

Microinformatique I

Instructions:
Math

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 31
November 05

Microinformatique I

Instructions:
Math(2)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 32
November 05

Microinformatique I

Instructions:
Logique

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 33
November 05

Microinformatique I

Instructions:
Rotation +
dcalage

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 34
November 05

Microinformatique I

Instructions:
Oprations
sur bits

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 35
November 05

Microinformatique I

Instructions:
Tests

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 36
November 05

Microinformatique I

Instructions:
Sauts

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 37
November 05

Microinformatique I

Instructions:
Sauts (2)

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 38
November 05

Microinformatique I

Instructions:
Stack +
Shadow

Contrle

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 39
November 05

Microinformatique I

Instructions:
DSP

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 40
November 05

Microinformatique I

Instructions DSP

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 41
November 05

Microinformatique I

TP de cette semaine
Utilisation de lenvironnement intgr MPLAB pour:
Compilation
Observation code compil
Simulation
Debug

http://asl.epfl.ch
Autonomous Systems Lab

Cours MicroInfo I 42