TP DSP
TP DSP
TP – N° 1
Présentation et prise en mains
de l’outil de développement
CCS V 5.3 et
Utilisation des Entrées / Sorties
GPIO DSP TMS320F28335
BUT DE TP
Le but de cette manipulation :
CODE
//##################################################
#########################
//
// FILE: TP1.c
//
//##################################################
#########################
#include "DSP2833x_Device.h"
void Gpio_select(void);
void InitSystem(void);
void delay_loop(long);
//##################################################
#########################
// main code
//##################################################
#########################
void main(void)
// to 4 LEDs at Peripheral
Explorer)
while(1)
counter++;
if(counter&1) GpioDataRegs.GPASET.bit.GPIO9
= 1;
else GpioDataRegs.GPACLEAR.bit.GPIO9 =
1;
if(counter&2)
GpioDataRegs.GPASET.bit.GPIO11 = 1;
else GpioDataRegs.GPACLEAR.bit.GPIO11
= 1;
if(counter&4)
GpioDataRegs.GPBSET.bit.GPIO34 = 1;
else GpioDataRegs.GPBCLEAR.bit.GPIO34
= 1;
if(counter&8)
GpioDataRegs.GPBSET.bit.GPIO49 = 1;
else GpioDataRegs.GPBCLEAR.bit.GPIO49
= 1;
delay_loop(1000000);
long i;
for (i = 0; i < end; i++)
asm(" NOP");
EALLOW;
SysCtrlRegs.WDKEY = 0x55;
SysCtrlRegs.WDKEY = 0xAA;
EDIS;
void Gpio_select(void)
EALLOW;
GpioCtrlRegs.GPADIR.all = 0;
GpioCtrlRegs.GPADIR.bit.GPIO9 = 1; // peripheral
explorer: LED LD1 at GPIO9
GpioCtrlRegs.GPADIR.bit.GPIO11 = 1; // peripheral
explorer: LED LD2 at GPIO11
GpioCtrlRegs.GPBDIR.all = 0; // GPIO63-32 as
inputs
GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1; // peripheral
explorer: LED LD3 at GPIO34
GpioCtrlRegs.GPBDIR.bit.GPIO49 = 1; // peripheral
explorer: LED LD4 at GPIO49
GpioCtrlRegs.GPCDIR.all = 0; // GPIO87-64 as
inputs
EDIS;
void InitSystem(void)
EALLOW;
SysCtrlRegs.WDCR = 0x0028; // Watchdog
enabled, 4.3 milliseconds
SysCtrlRegs.PLLSTS.bit.DIVSEL = 2;
SysCtrlRegs.PCLKCR0.all = 0x0000;
SysCtrlRegs.PCLKCR1.all = 0x0000;
SysCtrlRegs.PCLKCR3.all = 0x0000;
SysCtrlRegs.PCLKCR3.bit.GPIOINENCLK = 1;
EDIS;
//==================================================
=========================
// End of SourceCode.
//==================================================
=========================
Explication de code
333677597_5901368253309423_7587352664576263690_n.mp4
Pour un temps de plus entre l’allumation des leds on ajoute un
0 en delay_loop(10000000)
Utilisation d’une fonction de temps pour allumer les leds une
par une
pour allumer les leds une par une (une s’allume l’autre s’éteint)
on utilise une fonction de temps pour allumer les leds avec un
temps bien précisé on choisit la périphérique RTC , on travaille
avec son clock et avec l’instruction tempol
code ajouter :
Explication de code
Caractéristiques
Caractéristiques matérielles
Fonctionnalités du logiciel