your task is either simple and somewhat complicated. If you do not bother power consumption, you can use a timebase counter that overflows every ms or two. Some ST7, I mean ST7FLITE3x family, can even cascade the timebase counter with the auto-reload timer to measure long time periods. From the overflow interrupt handler you can acquire the analog input and store it into the eeprom. This simple algorithm can be improved: - acquire more samples and average the samples to reduce noise. - stop the micro between the ADC conversions to reduce power consumption. The former is an easy task when you take 256 samples (to divide by 256 all you need is to discard the lower byte), whilst the latter one needs the Auto-Wakeup Timer to be calibrated and programmed. Please, keep in mind that, while you are writing a byte to EEPROM (it may take some ms), the counter can overflow, so you must pay attention to what you do in the interrupt handler. Ciao EtaPhi
if you have some questions, I'll reply to them if I can. The aim of this forum is to share knowledge between ST7 users, so if your questions are worth a reply, why do you not share them with the others? I know, English is not our mothertoungue, but the translation effort overpays the information value that you may receive... Ciao EtaPhi
the application note AN1605 shows how a microcontroller can be waked-up from the halt state without the need of an internal auto wakeup oscillator. The strategy to minimize power consumption depends however on the requirements of your application. If some time error is tolerated, you can halt the microcontroller and wake it up by some method; otherwise it is better to use the active-wait state where the CPU is stopped but the periferals work. Ciao EtaPhi