I think I got it.
My sensor is read at channel 0. So:
the problem is how to manage the sensor*1023 since the result might be more than a word and I'd prefer not to use LONG.Code:offset var word sensor var word offset_store: 'offset processing adcin 0,offset write 0,word offset return read_pressure: adcin 0,sensor sensor=sensor-offset sensor=sensor*1023/(1023-offset) return
But the 1023/(1023-offset) ends up in a small number like 1.62 or similar. It is not known untill the offset is measured and cannot be substituted as a constant and use */ operator.
Ioannis




Bookmarks