Thank you for the code. I haven't written any yet. I've got the PICBasic compiler from MicroEngineering, the ePIC programmer and several 16F616 microcontrollers. The whole thing is new to me so it may take awhile to get it. The requirement is to sample an analog voltage at power up, convert it to a digital value and display it as 00 on a two-digit LED display, and reassign a momentary "on" button to an "off" button so one button turns the thing on and off, and provide some sort of interrupt so you can always turn it off by pushing the momentary "off" button. The analog voltage comes from a sensor amplified by an instrumentation amplifier. The firmware would have to "zero" the display and convert the input voltage to a pre-determined display range. So, for example, if the range of the sensor is 20mV to 120mV, the display would read, let's say, 00 to 60. But if the sensor voltage were 31mV to 97mV the display still has to read 00 to 60. Since the MCU would know the lower limit (and set it to zero on power-up) that's fine. But how am I going to let the MCU know the upper limit? I'm thinking it might be possible to come up with a calculation that when given the low number would provide the high number. Then the MCU would know how to scale the voltage over 00 to 60. Does anyone think this is reasonably accomplished with a PIC16F616? Has someone already done something like this? Would someone be interested in writing code that would do the above? I may be able to offer some sort of incentive. I'm rather afraid my analog mind has a lot of trouble with the digital side of things...
Thank You.