SPRAC77E January 2022 – February 2022 TMS320F28379D , TMS320F28379D-Q1 , TMS320F28379S
Description
A runtime function to be called periodically for dynamically configuring and changing the pulse generation requirements as required by the application. This function must be called periodically with appropriate parameters like the number of pulses, period, duration, and more.
Definition
uint16_t pto_pulsegen_runPulseGen(
uint32_t pulseLo,
uint32_t pulseHi,
uint32_t ptoActivePeriod,
uint32_t ptoFullPeriod,
uint32_t ptoInterruptTime,
uint16_t ptoDirection,
uint16_t run
);
Parameters
Input:
Return:
Usage
In pto_pulsegen.c, a sample configuration function called pto_setOptions is provided as an example to assist with the pto_pulsegen_runPulseGen function and to perform the intermediate calculations. See the following code sample calculation that illustrates how various parameters for this function can be generated. For more details, see the pto_pulsegen.c and pto_pulsegen.h files.
uint32_t pto_setOptions(
uint32_t numPulses, //number of pulses needed to be generated in next period
uint32_t Period, // PTO period in clock cycles
uint32_t ptoInterruptTime, // Interrupt generation time
uint16_t ptoDirection, // Direction output
uint16_t run) //run-stop condition.
{
uint32_t pulseFreq, reminder;
uint32_t pulseLo;
uint32_t pulseHi;
uint32_t ptoActivePeriod;
uint32_t ptoFullPeriod;
pulseFreq = Period / numPulses;
reminder = Period - (pulseFreq * numPulses);
pulseLo = (pulseFreq/2 );
pulseHi = pulseFreq;
ptoActivePeriod = (pulseFreq * numPulses);
ptoFullPeriod = Period;
pto_pulsegen_runPulseGen(
pulseLo,
pulseHi,
ptoActivePeriod,
ptoFullPeriod,
ptoInterruptTime,
ptoDirection,
run);
return(reminder);
}