??? 02/04/09 10:22 Read: times |
#162036 - Timer + conditional loop. Responding to: ???'s previous message |
Instead of implementing a delay that counts turns through a loop, configure and use a timer.
Then write a loop that continuously checks if the timer is "ringing" or if you have received any characters on the serial port. If you have received characters - parse them and decide if they represents a command to break your delay. If not, wait until the timer has ticked long enough - or overflowed enough number of times - that your delay should time out. You may also process the serial data in an interrupt, and let the interrupt set an abort flag if it receives a specific character. |