Page 1 of 1

Interrupt on TMR0

Posted: Tue Feb 06, 2007 4:35 pm
by PINTO
Dear Sirs.

Is the TMR0 linked to a delay Icon in any way?
I have the following situation:
I initialised TMR0 to Internal Clock, and the prescaler to 1:128 and I call a Macro called send_code.
In the send_code Macro I have a RS232 Macro sedding "FF".
After initializing the program goes into a loop called "Waiting_comms" were I've a small routine that lights up an led on and off once a second basically wainting for an interrupt on RB1, if RB1 interrupts than the program branchs else were, all this works fine except that the RS232 transmites at the same time delay as the settings on the delay macro and not the prescaler settings.
If I remove the time delays than the the RS232 doesn't send at all, if I introduce a time delay into the Wainting_comms loop than the RS232 starts to transmitting again and if I change the timming on the delay the RS232 follows suit.
Can you throw some light on the subject?

Thanks

Pinto

Posted: Tue Feb 06, 2007 7:19 pm
by Mark
Pinto,

There is not enough information for me to help much.

However, bear in mind that RS232 comms are not instantaneous, particularly if they are waiting for a handshake routine (is there hardware handshaking used?). Also 1:128 with a low speed clock could itself give a low send rate (though 1Hz is pushing it a bit).

I suggest you set up an RS232 send loop on its own and watch with Hyprterminal on a PC to seee what happens when you make changes. RS232 is easy to get in trouble with if several other things are going on (like a recieve protocol).

Hope this helps,

Mark