This article applies to:
Dolphin based modules performing analog measurements
What will happen with my analog measurements result value after scaling, when the value was under the negative reference or above the positive reference?
The behavior of the scaling function is that:
Overflow and underflow should be not a common application scenario, therefore please plan your references carefully so this state will not occur. Altough there might be situation where this can happen, so it is good at least detecting this situation so the application will not provide wrong measurements. In Dolphin you can detect this state by simply comparing the unscaled measurements.
sint16 s16negref; sint16 s16posref; sint16 s16adio1value; uint16 u16adio1value; io_enableAnalog(1); // configuring hardware for analog measurement no VGA, increase current to Analog current io_ulpMeasAnalog(RVDD, &s16posref); // measure positive reference against internal voltage io_ulpMeasAnalog(RVSS, &s16negref); // measure negative reference against internal voltage io_ulpMeasAnalog(GPIO1_ADIO_1, &s16adio1value); // measure ADIO_1 against internal voltage io_enableAnalog(0); // restoring previous configuration for radio functionality and reduce current to CPU current if(s16posref<s16adio1value) { // error handling for overflow } else if (s16negref>s16adio1value) { // error handling for underflow } else { // all is ok io_ulpScaleAnalog(s16posref, s16negref, s16adio1value, s16negref, 8, &u16adio1value); // scale and calculate result for ADIO_1 .... }
FAQ Single Template
Finden Sie den richtigen Händler für unsere Module, Komponenten und Endprodukte in Ihrer Region!
Der EnOcean-Newsletter informiert Sie regelmäßig über spannende Projekte aus den Bereichen IoT und Smart Building sowie über aktuelle Veranstaltungen und neue Produkte.
© 2024 EnOcean GmbH. Alle Rechte vorbehalten.