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.
老师您好:
关于这段程序我还有一个不懂的地方,恳请您不吝赐教,就是为什么DatQ15 = (AdcRegs.ADCRESULT0>>1)&0x7FFF要右移一位后才相与呢??以及这个程序有什么用呢?下面附录部分程序,感谢您的回复!!
DatQ15 = (AdcRegs.ADCRESULT0>>1)&0x7FFF; // Convert raw result to Q15 (unipolar signal)
Tmp = (int32)p->Ch1Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch1Out = (int16)(Tmp>>13); // Convert Q28 to Q15
DatQ15 = (AdcRegs.ADCRESULT1>>1)&0x7FFF; // Convert raw result to Q15 (unipolar signal)
Tmp = (int32)p->Ch2Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch2Out = (int16)(Tmp>>13); // Convert Q28 to Q15
DatQ15 = (AdcRegs.ADCRESULT2>>1)&0x7FFF; // Convert raw result to Q15 (unipolar signal)
Tmp = (int32)p->Ch3Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch3Out = (int16)(Tmp>>13); // Convert Q28 to Q15
DatQ15 = (AdcRegs.ADCRESULT3>>1)&0x7FFF; // Convert raw result to Q15 (unipolar signal)
Tmp = (int32)p->Ch4Gain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15
p->Ch4Out = (int16)(Tmp>>13); // Convert Q28 to Q15
AdcRegs.ADCTRL2.all |= 0x4040; // Reset the sequence
想关帖子 请查看
http://www.deyisupport.com/question_answer/microcontrollers/c2000/f/56/t/17740.aspx