Other Parts Discussed in Thread: DRV8312
I am working with the DRV8312 EVM kit. It uses the 2803x control card. I am trying to add a calculation to the code and am having difficulty related to the IQ math. I have the following variables.
POLES is a #define in a header file
BASE_FREQ is a #define in a header file
SpeedRef is an _iq variable and is a per unit variable (0-1 value)
SpeedRefRPM is a variable for the desired speed in RPM. I am unsure what variable type is best to assign to it. It will likely be whole numbers between -10,000 and 10,000.
I want to do the following calculation
SpeedRef = (SpeedRefRPM * POLES) / (120 * BASE_FREQ)
I have been unable to figure out what syntax gets me the right answer. Please tell me what I have to code to get the correct results.
Thank you.