Introduction au dsPIC - Freetom.poub.free.fr/blog/XUFO/Pics/Cours/cours...

42
November 05 Cours MicroInfo I 1 Autonomous Systems Lab http://asl.epfl.ch Microinformatique I Introduction au dsPIC Francesco Mondada Laboratoire de systèmes autonomes I2S - STI - EPFL Cours Microinformatique I

Transcript of Introduction au dsPIC - Freetom.poub.free.fr/blog/XUFO/Pics/Cours/cours...

November 05

Cours MicroInfo I 1

Autonomous Systems Labhttp://asl.epfl.ch

Microinformatique I

Introduction au dsPIC

Francesco MondadaLaboratoire de systèmes autonomes

I2S - STI - EPFL

Cours Microinformatique I

November 05

Cours MicroInfo I 2

Autonomous Systems Labhttp://asl.epfl.ch

IntroductiondsPIC est une famille de micro-contrôleurs qui allie la structured’un micro-contrôleurs et celle d’un DSP (Digital Signal Processor)

La famille est composée de trois sous-familles

• General purpose family (codec interface)• Sensor family (petits)• Motor control family (avec contôle de PWM et encodeur)

Microinformatique I

November 05

Cours MicroInfo I 3

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Microinformatique I

November 05

Cours MicroInfo I 4

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Coeur ducontrôleur

Microinformatique I

November 05

Cours MicroInfo I 5

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Gestion desadresses

Microinformatique I

November 05

Cours MicroInfo I 6

Autonomous Systems Labhttp://asl.epfl.ch

Structure

IMPORTANT:Deux bus X et Y

Microinformatique I

November 05

Cours MicroInfo I 7

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Périphériques

Microinformatique I

November 05

Cours MicroInfo I 8

Autonomous Systems Labhttp://asl.epfl.ch

Structure: périphériques

Microinformatique I

November 05

Cours MicroInfo I 9

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Pinning

Microinformatique I

November 05

Cours MicroInfo I 10

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Pinning: partagedes fonctions

(Change NotificationModule)

Microinformatique I

November 05

Cours MicroInfo I 11

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Pinning: partagedes fonctions

Microinformatique I

November 05

Cours MicroInfo I 12

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Timer (5 x 16bit)

Microinformatique I

November 05

Cours MicroInfo I 13

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Timer (2 x 32bit)

Microinformatique I

November 05

Cours MicroInfo I 14

Autonomous Systems Labhttp://asl.epfl.ch

StructureInput capture (8x)

Microinformatique I

November 05

Cours MicroInfo I 15

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Output Compare(8x)

Microinformatique I

November 05

Cours MicroInfo I 16

Autonomous Systems Labhttp://asl.epfl.ch

StructureSerial Peripheral Interface “SPI” (concept)

Microinformatique I

November 05

Cours MicroInfo I 17

Autonomous Systems Labhttp://asl.epfl.ch

Structure

SPI(2x)

Microinformatique I

November 05

Cours MicroInfo I 18

Autonomous Systems Labhttp://asl.epfl.ch

Structure

I2C (1x)Inter-IntegratedCircuit

Microinformatique I

November 05

Cours MicroInfo I 19

Autonomous Systems Labhttp://asl.epfl.ch

StructureUniversal Asynchronous Receiver Transmitter (UART)(2x)

Microinformatique I

November 05

Cours MicroInfo I 20

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Universal Asynchronous Receiver Transmitter (UART)

Microinformatique I

November 05

Cours MicroInfo I 21

Autonomous Systems Labhttp://asl.epfl.ch

Structure

ControllerAreaNetwork (CAN)(2x)

Microinformatique I

November 05

Cours MicroInfo I 22

Autonomous Systems Labhttp://asl.epfl.ch

Structure

Data ConverterInterface (DCI)(1x)

I2S (Inter-IC Sound)

Microinformatique I

November 05

Cours MicroInfo I 23

Autonomous Systems Labhttp://asl.epfl.ch

Structure

12 bit A/D(16x)

Microinformatique I

November 05

Cours MicroInfo I 24

Autonomous Systems Labhttp://asl.epfl.ch

ProgrammationLes dsPIC ont un set d’instuctions assez important (84), dont lagrande majorité est executée en un cycle

Les instructions sont optimisées 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)

Microinformatique I

November 05

Cours MicroInfo I 25

Autonomous Systems Labhttp://asl.epfl.ch

ProgrammationModèledeprogrammation

Microinformatique I

November 05

Cours MicroInfo I 26

Autonomous Systems Labhttp://asl.epfl.ch

ProgrammationModèledeprogrammation

Microinformatique I

Do Ac

tive

Repa

t Active

Carry

Zero

Overfl

ow

Nega

tive

Digit

Carry

Satu

rate A

B

Overfl

ow A

B

Satu

rate B

Satu

rate A

Overfl

ow B

Overfl

ow A

Interru

pt Prio

rity Le

vel

November 05

Cours MicroInfo I 27

Autonomous Systems Labhttp://asl.epfl.ch

ProgrammationModèledeprogrammation

Microinformatique I

November 05

Cours MicroInfo I 28

Autonomous Systems Labhttp://asl.epfl.ch

ProgrammationMémoire programme

Microinformatique I

1M cycles

100k cycles

November 05

Cours MicroInfo I 29

Autonomous Systems Labhttp://asl.epfl.ch

ProgrammationMémoire données

Microinformatique I

(Special Function Register)

November 05

Cours MicroInfo I 30

Autonomous Systems Labhttp://asl.epfl.ch

ProgrammationInstructions:Move…

Microinformatique I

November 05

Cours MicroInfo I 31

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Math…

Microinformatique I

November 05

Cours MicroInfo I 32

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Math…(2)

Microinformatique I

November 05

Cours MicroInfo I 33

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Logique…

Microinformatique I

November 05

Cours MicroInfo I 34

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Rotation +décalage

Microinformatique I

November 05

Cours MicroInfo I 35

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Opérationssur bits

Microinformatique I

November 05

Cours MicroInfo I 36

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Tests

Microinformatique I

November 05

Cours MicroInfo I 37

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Sauts

Microinformatique I

November 05

Cours MicroInfo I 38

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Sauts (2)

Microinformatique I

November 05

Cours MicroInfo I 39

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:Stack +Shadow

Contrôle

Microinformatique I

November 05

Cours MicroInfo I 40

Autonomous Systems Labhttp://asl.epfl.ch

Instructions:DSP

Microinformatique I

November 05

Cours MicroInfo I 41

Autonomous Systems Labhttp://asl.epfl.ch

Instructions DSP

Microinformatique I

November 05

Cours MicroInfo I 42

Autonomous Systems Labhttp://asl.epfl.ch

TP de cette semaineUtilisation de l’environnement intégré MPLAB pour:

• Compilation• Observation code compilé• Simulation• Debug

Microinformatique I