Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE
Tool/software: Code Composer Studio
Dear all,
I am developing a speed control for two motors. I use the LAUNCHXL-f28069m with two BOOSTXL-DRV8305EVM. The program that I use is the proj_lab06e of motorware.
The goal is to adjust external the speed by an analog input voltage 0 – 3.3V. The max. speed is 5krpm.
In the source code “proj_lab06e” there are several function given.
Extract of the program code:
(With this code the resolution that I get is 1krpm. i.e. I have only 5 speeds: 1krpm, 2krpm, 3krpm, 4krpm and 5krpm.)
value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_14); //reading the ADC set value
pAdcData->dcBus = value; // save ADC value
value = _IQmpy(gAdcData[HAL_MTR2].dcBus, _IQ(0.0012820512820513)); // max. speed= 5krpm, max. ADC value 3900 -> 5 / 3900 = 0.00128205...
gMotorVars[HAL_MTR1].SpeedRef_krpm = _IQ(value);
With another code script it was possible to get a resolution of 40rpm. But this resolution is also too low. (But I think it is not a correct notation)
value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_14);
refvalue = _IQmpy(value,_IQ(8));
pAdcData->dcBus = _IQmpy(refvalue,_IQ(0.004));
refValue = _IQmpy(_IQ(1),gAdcData[HAL_MTR2].dcBus);
gMotorVars[HAL_MTR1].SpeedRef_krpm = _IQmpy(_IQ(refValue),gSpeed_hz_to_krpm_sf[HAL_MTR1]*1.31);
gMotorVars[HAL_MTR1].SpeedRef_krpm = calculated value;
I know the “value” is a _iq type and has a range of 127.999.. -128 with a resolution of around 0.000 000 060.
But my suspicion is, that I’m only able to calculate “integers”:
127 = 5krpm
126 = 4.96krpm
125 = 4.92krpm
because I can’t realize e.g. 125.5 = 4.941krpm. What am I doing wrong?
What do I need to do to get a higher resolution (e.g. 5rpm)? Could you please give me an advice to solve this problem?
I use completely the proj_lab06e and basically I changed:
proj_lab06e.c > lines 713 – 749
hal_2mtr.h > lines 681 – 710
The files are attached.
Moreover, the motor is my own motor - no standard motor. In fact there are two motors connected. Only one motor will be observed/measured and the other gets the same parameters and values as the observed one. So this works well.
Thanks in advance to all.