USART RX Interrupt

Coding and general discussion relating to user created compiler modules

Moderators: David Barker, Jerry Messina

Post Reply
Widgetman
Posts: 136
Joined: Sun Dec 16, 2007 7:39 pm
Location: Florida

USART RX Interrupt

Post by Widgetman » Mon Mar 07, 2011 1:39 pm

Hi,
I was wondering if anyone knew how the DelayMS call worked in reference to a interrupt on the USART. I have a main loop where I use the ReadSerial call then if no charcters are coming in I proceed to toggle some leds then delay 5 seconds. My question is after I drop into the DelayMS routine will a RX Interrupt pull me out to service the incoming charcters. Any insight would be greatly appreciated.
thanks

be80be
Registered User
Registered User
Posts: 90
Joined: Mon Feb 23, 2009 2:15 am
Location: tn

Post by be80be » Mon Mar 07, 2011 2:09 pm

Yes it jump to the RX code thats set for interrupt

Jerry Messina
Swordfish Developer
Posts: 1470
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Post by Jerry Messina » Mon Mar 07, 2011 4:03 pm

It will assuming you use an interrupt-driven module like ISRRX.BAS, since the regular USART.BAS module by itself doesn't use interrupts.

gramo
Registered User
Registered User
Posts: 200
Joined: Tue Mar 20, 2007 6:55 am
Location: Australia
Contact:

Re: USART RX Interrupt

Post by gramo » Tue Mar 08, 2011 9:37 am

Hi Widgetman,

I understand you're coming from the viewpoint of using interrupts, although I was a little confused by your example:
Widgetman wrote:I have a main loop where I use the ReadSerial call then if no charcters are coming in I proceed to toggle some leds then delay 5 seconds.
I interpret that as a quick status flag check of RCIF, without the use of an interrupt driven event...

In any case; if an interrupt was configured for USART then an incoming byte would interrupt the code while in the DelaymS call. When complete, it would return to where-ever it left off.

A caveat - the interrupt is disabled before the 5 second delay. Although you may land yourself buffer overruns or lost data with this tact. Just putting it out there :)
digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.

Australian distributor for the Swordfish Compiler

Post Reply