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^0x8000; 的问题

DatQ15 = AdcRegs.ADCRESULT0^0x8000; // Convert raw result to Q15 (bipolar signal) Tmp = (int32)p->ImeasAGain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15 p->ImeasA = (int16)(Tmp>>13); // Convert Q28 to Q15 p->ImeasA += p->ImeasAOffset; // Add offset p->ImeasA *= -1; // Positive direction, current flows to motor DatQ15 = AdcRegs.ADCRESULT0^0x8000; 双极性的一般异或0x8000,来减去1.5V的偏移量 比如ADCRESULT 高12位是9000,异或后变为0x1000,IQ15(0.001) 但是在ADCRESULT 为0x0000~0x7fff范围,异或0x8000不就变成加上1.5V偏置了吗?比如0x6000,异或后变为0xE000,考虑符号位,变为IQ15(-0.11),这样数据就不对了啊。