Dont be disheartened. It sure looks like you have the general idea to make it work. Now, what you can try to do is to take interrupts on Receive and Timer.
In the Timer ISR, you can take care of the LEDs. In the Receive ISR, you grab the serial port character and either buffer it for the mainline code to see it (circular buffer) or signal it to the mainline if the data rate is very slow. This will help you decide on the Led states.
You will definitely get better results with this method. If possible, try to keep the ISR code as short as possible and if you can do it, use assember in there. You got to try; may seem difficult at first, but once done, you'll wonder why you didnt do it before.
Bookmarks