Use ISRRX and ISRTimer in the same program

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Use ISRRX and ISRTimer in the same program

Post by Coccoliso » Thu Jun 26, 2014 2:01 pm

Hello,
is there a way to use modules Timer and ISRRX in the same code ?
The problem is to read the USART while running a state display routine cyclically called by timer.

Thanks.

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

Re: Use ISRRX and ISRTimer in the same program

Post by Jerry Messina » Thu Jun 26, 2014 2:56 pm

The easiest way is to use different interrupt priorities for the two modules.

By default, they both use the same priority (ipHigh). By changing the timer to use the low-priority interrupt, the USART will be able to interrupt it.

Code: Select all

#option RX_PRIORITY = ipHigh
#option TIMER_PRIORITY = ipLow

include "ISRRX.bas"
include "ISRTimer.bas"

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: Use ISRRX and ISRTimer in the same program

Post by Coccoliso » Thu Jun 26, 2014 3:09 pm

Plain and simple :wink: .

Post Reply