On Mon, 10 Jun 2002, Michael Rigby-Jones wrote: > > I'm working on a (commercial) project that involves a 16C73, most of the > > other circuit functions are done but I still need to read ADC channel one > > (RA0), process the value and create a signal that gets sent to a piezo > > sounder. > > The ADC is my main problem, I have it reading values, thanks to the > > Piclist FAQ, but I need the PIC to sleep for as much of the time as > > possible, it's currently sleeping while it converts then it wakes up and I > > send its value to the piezo code, but I need then to put it back into > > sleep and wait until ADC channel one or RA1 changes (circuit power use is > > critical). > > I think I can work out how to wake from sleep on RA1 changing, but I don't > > even think it's possible to wake from sleep on a change in the analog > > input? > > > You have a problem in both cases. RA1 has no interrupt on change facility, > unless this is a typo and you meant RB1? There is no way to wake up from a > change in analog value as you suspected, the only wakeup ascociated with the > A/D converter is the end of conversion interrupt. The ADC module itself > raises power consumption, so depending on how often you need to sample, you > might be better off using a timer interrupt to enable the ADC module and > the ADC interrupt to disable the module, the aim being to keep the ADC > module disabled for as much time as possible. The timer interrupt could be > used to check pin RA1 as well (assuming it wasn't a typo). > or to use interrupt on RB0 ( or any other interrupt on change) with a comparator. If the analog input exceed the reference then an interrupt will wake up the whole mess, perform the measurement and go back to sleep again after it finished. A time delay will be necessary from the wake up moment to measurement(s). Vasile -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads