Other Parts Discussed in Thread: MOTORWARE
I am not clear on using the IQ library but if someone can give me a checkpoint hopefully it will clear it up. I am running the Instaspin FOC and one of the values that is measured in the motor calibration is the series resistance of the BLDC motor I am using. The value comes in for most of the motors at about 0.01479 ohms. I take this value and:
myvalue = _IQ(gMotorVars.Rs_Ohm)
Which gives me a hex value of 0x0003c322.
I take this value and put it in an array
mtuResponse = (uint16_t)(offsetRs >> 24) & 0xFF;
mtuResponse = (uint16_t)(offsetRs >> 16) & 0xFF;
mtuResponse = (uint16_t)(offsetRs >> 8) & 0xFF;
mtuResponse = (uint16_t)(offsetRs) & 0xFF;
I then send this out on the serial port to my host laptop.
The default in the motorware is IQ(24) which means the resolution is 0.000000060
I take the 0x0003c322, convert to decimal and then multiply by 0.000000060 to arrive at a readable display value for our test set. It is very close to the value I can read on the Code Composer Studio display but it is consistently higher value. If I right click in CCS and ask it to display the value by translating the IQ value it is almost perfectly the same value so I am guessing I am missing something in the conversion. Can someone point me to what I am doing wrong?
If I am trying to make this hard for getting values out of the serial port I would love to know a better way also.