??? 12/09/05 22:07 Read: times |
#105015 - interrupt examples Responding to: ???'s previous message |
Hi Jeff,
It's common to use a timer interrupt to start an ADC, then have the ADC interrupt let the main loop know that a new sample is available for processing. For example, on one project I had a timer interrupt set up to give me a tick every 277.77us, and that interrupt started the ADC which was sampling AC line voltage. Collect the data, look at the data to determine zero crossings, and then use that data calculate the RMS voltage present. The sample rate was set for 60 samples per 60Hz cycle, and the number of samples I collected between zero crossings could also be used to determine line frequency. Another example is serial communications. Configure the UART to give an interrupt when a new data byte is present, so you can do something useful while waiting for data...instead of polling for new data. Make use of the hardware available in the peripherals you've got to make things more efficient. Once you get used to using interrupts, you'll wonder how you lived without them. Dennis |
Topic | Author | Date |
interrupt questions | 01/01/70 00:00 | |
the first interrupt you need to use is t | 01/01/70 00:00 | |
interrupt examples | 01/01/70 00:00 | |
C or ASM | 01/01/70 00:00 | |
I don't think it does! | 01/01/70 00:00 | |
Two questions in one | 01/01/70 00:00 | |
flexible or efficient | 01/01/70 00:00 | |
It's all relative.![]() | 01/01/70 00:00 |