Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CCS/TMS320F28379D: Configure GPIOXX general purpose output

$
0
0

Part Number:TMS320F28379D

Tool/software: Code Composer Studio

Hello

i want measure the ISR loop exqution time by using some i/o pin

so i Configure GPIO52 is like this is it correct or not.

EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO1 = 1; // Disable pull-up on GPIO2 (EPWM1A)
GpioCtrlRegs.GPAPUD.bit.GPIO2 = 1; // Disable pull-up on GPIO2 (EPWM2A)
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // Configure GPIO2 as EPWM1A
GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 1; // Configure GPIO2 as EPWM2A
GpioCtrlRegs.GPDATA.bit.GPIO52 = 1;
EDIS;

......

...

__interrupt void epwm1_isr(void)
{
//*Here my code assign a new sin value into compare reg. but negative side of sin wave pwm //logic is invertered.*/

a1=sin(PI*0.02*i1);
GpioDataRegs.GPBDAT.bit.GPIO52 = 0;
if (a1>=0)
{
EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR; // Set PWM1A on event A, up
EPwm1Regs.AQCTLA.bit.CAD =AQ_SET; // Clear PWM1A on event B, down
EPwm1Regs.CMPA.bit.CMPA =b1[i1];
}
else
{
EPwm1Regs.AQCTLA.bit.CAU =AQ_SET; // Set PWM1A on event A, up
EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM1A on event B, down
EPwm1Regs.CMPA.bit.CMPA =b1[i1];
}
i1++;
if (i1==401)
{
i1=0;
}
EPwm1Regs.ETCLR.bit.INT = 1;

PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
}

__interrupt void epwm2_isr(void)
{
//*Here my code assign a new sin value into compare reg. but negative side of sin wave pwm //logic is invertered.*/

a2=sin(PI*0.02*i2);
if (a2>=0)
{
EPwm2Regs.AQCTLA.bit.CAU = AQ_CLEAR; // Set PWM2A on event A, up
EPwm2Regs.AQCTLA.bit.CAD =AQ_SET; // Clear PWM2A on event B, down
EPwm2Regs.CMPA.bit.CMPA =b2[i2];
}
else
{
EPwm2Regs.AQCTLA.bit.CAU =AQ_SET; // Set PWM2A on event A, up
EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear PWM2A on event B, down
EPwm2Regs.CMPA.bit.CMPA =b2[i2];
}
i2++;
if (i2==401)
{
i2=0;
}
EPwm2Regs.ETCLR.bit.INT = 1;

PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
GpioDataRegs.GPBDAT.bit.GPIO52 = 1;
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>