> -----Original Message----- > From: Jonathan Starr [SMTP:JonathanS@ELECTRONIX.CO.UK] > Sent: Monday, June 10, 2002 10:23 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: Waking from sleep on ADC change? > > Hi, this is my first post to the list so I hope it's going to the right > place/formatted correctly :-) > > 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). > And, as a side note, does anyone know anything about piezo sounders? > On the sig-gen it's frequency response can only be described as pathetic, > and it appears (annoyingly) to have a sweet spot at 3KHz, the customer > wants a 'Tone' control and as I can't just vary the frequency like I was > hoping to do I'm a bit at a loss. > I think something along the lines of a complex waveform with the ADC value > being used to vary the harmonics would be the way forward, has anyone done > this before? > Common, cheap piezo sounders have a natural resonant frequency as you have found, which is why they are generaly used for single tones, as warning buzzers etc. The resonant frequency and frequency response will be determined to a large extent on how the bare piezo disk is mounted. Obviously if you have a piezo that comes pre-mounted to a plastic casing your choices are limited. I don't think the complex waveform idea is going to help much either, the piezo will only respond to the frequencies around it's resonant point, irrespective if those frequencies are a fundamental or a harmonic of the waveform you generated. You can obtain piezo's with quite a wide frequency response, designed to be used as replacements for small speakers in e.g. laptops. http://www.panasonic.com/industrial/components/pdf/card_speaker_dne.pdf is an example. I suspect they cost considerably more than the common devices used for warning beeps etc. If you could give an idea of the device being used I'm sure that you'd get some suggestions from the list for improved performance. Regards Mike -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics