예제 #1
0
__interrupt void epwm3_isr(void)
{
    static int daccounter=0;
    float wt, sinwt;
    uint16_t dacoutv;

    if (daccounter<1000) daccounter++; else daccounter=0;
    wt = daccounter / 1000.0F;
    sinwt = __sinpuf32(wt);
    dacoutv = (sinwt + 1.0F) * 4095.0F / 2.0F;
    DacaRegs.DACVALS.bit.DACVALS = dacoutv;

    EPwm3Regs.ETCLR.bit.INT = 1; //Clear INT flag for this timer
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; //Acknowledge this interrupt to receive more interrupts from group 3
}
//
// TMU_runTest - Execute SIN generation test (TMU)
//
float TMU_runTest(float *inputVector,float *tmuOutput,
                  int16_t size)
{
    int16_t i;
    float start_time = 0.0;
    float stop_time = 0.0;

    START_TIMER(start_time);
    for(i = 0; i < size ; i++)
    {
        tmuOutput[i] = __sinpuf32(inputVector[i]);
    }
    STOP_TIMER(stop_time);

    return(start_time - stop_time);
}