This commit is contained in:
105042004
2019-08-29 16:52:16 +08:00
parent dc32d4fb13
commit 0909855fbb
@@ -269,12 +269,12 @@ static void ADC_overflow(uint8_t gain, uint8_t *rawdata){
// this function should turn 0~50000 into DACcode which output the exactly voltage user want
static uint16_t Usercode_Correction_to_DAC(uint16_t usercode)
{
int32_t usercode_32;
uint32_t usercode_32;
uint16_t DACcode = 0;
usercode_32 = (int32_t)(usercode);
usercode_32 = (uint32_t)(usercode);
DACcode = (uint16_t) ((Correction.Usercode2DAC.coeff * usercode_32 + Correction.Usercode2DAC.offset)/10e3);
DACcode = (uint16_t) ((Correction.Usercode2DAC.coeff * usercode_32 + Correction.Usercode2DAC.offset)/1000);
return DACcode;
}
@@ -287,7 +287,7 @@ static int32_t DAC_to_realV(uint16_t DACcode)
volt_32 = (int32_t)(DACcode);
RealV = (Correction.DAC2RealV.coeff * volt_32 + Correction.DAC2RealV.offset)/10e3; //(mV)
RealV = (Correction.DAC2RealV.coeff * volt_32 + Correction.DAC2RealV.offset)/1000; //(mV)
return RealV;
}