Quote:
Originally Posted by jhersh
BTW, you can get the same results that you get with your algorithm by simply adding 1 to the distance if direction is false with the built-in counter and you don't need any of that fancy stuff.
-Joe
|
This is along the lines I was thinking. But it seems that we have to capture the complete register array before we start using the results or at least temporarily halt the interrupts while we do multiple register reads.
I.E Wouldn't this be a possible problem?
Code:
*/
INT32 Counter::Chris_Get()
{ INT32 value ;
INT32 cnt = m_counter->readOutput_Value(&status);
bool dir = m_counter->readOutput_Direction(&status);
//Couldn't the registers be different when we read dir vs the cnt read ??
if(dir ) // Assume dir = 0 decrements count
{ return value ; } // if we haven't reversed then update count
else
{ return value +1; } // else keep the count at last value
}
Beauty is in the eye of the beholder. I'm pretty happy with the money I'm saving with my hysteresis thermostat even thought the temperature varies a little. All I have to do is figure out a way to connect an encoder to a bi-metalic coil and then hook it to my heater control
