Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
hi,
In my program I need to set a PI controller. the error signal, difference of reference signal and current signal is finely calculated. As I want to multiply this value with proportional term, e.g. #define P_gain 0x0005, I face difficulties. How is the multiplying rule of two 16 bit values and saving it in a 32 bit variable?
Uint32 eRROR_COPM_SIG_P;// proportional error sig.
eRROR_COPM_SIG_P=eRROR_COPM_SIG*P_gain;
//EPwm1Regs.CMPA.bit.CMPA = eRROR_COPM_SIG_P >> 16; shifting 16 bits,is right?
EPwm1Regs.CMPA.bit.CMPA = (int)(eRROR_COPM_SIG_P ); can I use int, to select only 16 upper value?
I am working with a fixed-point mode. (I did not use DCL, Digital Controller Library)
Do I need to choose floating point mode of working?
Can you help me further please?
thank you in advanced.