uint8 adcVal=0;
adcVal = HalAdcRead(HAL_ADC_CHANNEL_7, HAL_ADC_RESOLUTION_8); //read values from the potentiometer from 0 to 127
HalLcdWriteStringValue ("Temperature:", adcVal, 10, 1); print read values adcVal
adcVal=adcVal-67; //Read the value subtract the value of 67
HalLcdWriteStringValue ("Temperature:", adcVal, 10, 2); print read values adcVal-67
If you read the value of 127 works OK, adcVal will be 60, but when I read the value that is less than 67, does not work as expected.
Example: If you read the value of 40, adcVal will be 228? How? 40-67=-27, so 255-27=228
If you read the value of 27, adcVal will be 215? 27-67=-40, so 255-40=215,
If you read the value of , adcVal will be 188? 0-67=-67, so 255-67=188
Whenever you read a value less than the value of 67, adcVal subtracted from the value of 255, why, please, do you know someone?
How to solve the problem?
Thanks on advance