This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSHVMTRINSPIN: Motorware lab1b PWMDAC

Part Number: TMDSHVMTRINSPIN
Other Parts Discussed in Thread: MOTORWARE

Motorware lab1b

Can you describe, does PWMDAC value depend on gain and offset? Can't find any funcs that use 

\motorware_1_01_00_18\sw\modules\hal\boards\hvkit_rev1p1\f28x\f2806x\src\hal.h

//! \brief Writes DAC data to the PWM comparators for DAC (digital-to-analog conversion) output
//! \param[in] handle The hardware abstraction layer (HAL) handle
//! \param[in] pDacData The pointer to the DAC data
static inline void HAL_writeDacData(HAL_Handle handle,HAL_DacData_t *pDacData)
{
HAL_Obj *obj = (HAL_Obj *)handle;

// convert values from _IQ to _IQ15
int16_t dacValue_1 = (int16_t)_IQtoIQ15(pDacData->value[0]);
int16_t dacValue_2 = (int16_t)_IQtoIQ15(pDacData->value[1]);
int16_t dacValue_3 = (int16_t)_IQtoIQ15(pDacData->value[2]);
int16_t dacValue_4 = (int16_t)_IQtoIQ15(pDacData->value[3]);

// write the DAC data
PWMDAC_write_CmpA(obj->pwmDacHandle[PWMDAC_Number_1],dacValue_1);
PWMDAC_write_CmpB(obj->pwmDacHandle[PWMDAC_Number_1],dacValue_2);
PWMDAC_write_CmpA(obj->pwmDacHandle[PWMDAC_Number_2],dacValue_3);
PWMDAC_write_CmpA(obj->pwmDacHandle[PWMDAC_Number_3],dacValue_4);

return;
} // end of HAL_writeDacData() function

//! \brief Writes PWM data to the PWM comparators for motor control

//! \param[in] handle The hardware abstraction layer (HAL) handle
//! \param[in] pPwmData The pointer to the PWM data
static inline void HAL_writePwmData(HAL_Handle handle,HAL_PwmData_t *pPwmData)
{
uint_least8_t cnt;
HAL_Obj *obj = (HAL_Obj *)handle;
PWM_Obj *pwm;
_iq period;
_iq pwmData_neg;
_iq pwmData_sat;
_iq pwmData_sat_dc;
_iq value;
uint16_t value_sat;

for(cnt=0;cnt<3;cnt++)
{
pwm = (PWM_Obj *)obj->pwmHandle[cnt];
period = (_iq)pwm->TBPRD;
pwmData_neg = _IQmpy(pPwmData->Tabc.value[cnt],_IQ(-1.0));
pwmData_sat = _IQsat(pwmData_neg,_IQ(0.5),_IQ(-0.5));
pwmData_sat_dc = pwmData_sat + _IQ(0.5);
value = _IQmpy(pwmData_sat_dc, period);
value_sat = (uint16_t)_IQsat(value, period, _IQ(0.0));

// write the PWM data
PWM_write_CmpA(obj->pwmHandle[cnt],value_sat);
}

return;
} // end of HAL_writePwmData() function

\motorware_1_01_00_18\sw\modules\hal\boards\hvkit_rev1p1\f28x\f2806x\src\hal.c

void HAL_setDacParameters(HAL_Handle handle, HAL_DacData_t *pDacData)
{
HAL_Obj *obj = (HAL_Obj *)handle;

pDacData->PeriodMax = PWMDAC_getPeriod(obj->pwmDacHandle[PWMDAC_Number_1]);

pDacData->offset[0] = _IQ(0.5);
pDacData->offset[1] = _IQ(0.5);
pDacData->offset[2] = _IQ(0.0);
pDacData->offset[3] = _IQ(0.0);

pDacData->gain[0] = _IQ(1.0);
pDacData->gain[1] = _IQ(1.0);
pDacData->gain[2] = _IQ(1.0);
pDacData->gain[3] = _IQ(1.0);

return;
} //end of HAL_setDacParameters() function

Can't see any differences by changing offset and gain values. And don't understand why PWMDAC values are converted by _IQtoIQ15, PWMDACs are the same as simple PWM.