Topic: DMD0376 BRX Interrupt Triggers |
|
A PLC normally reads its inputs at the top of the scan and writes its outputs at the bottom of the scan, the ladder logic is solved after the inputs are read and the outputs are written. Because the PLC can change the amount of work it does from scan to scan, the PLC's scan time will also change accordingly, which will directly affect the frequency that inputs can be read and outputs can be written.
BRX MPU use interrupts to do work that has to occur regardless of variations in the PLC scan time. Discrete Input Interrupts can be used to respond to transitions of discrete inputs that occur during a PLC scan. Value Match Interrupts can respond to specific values in specified registers. Timed Interrupts can be used to turn discrete outputs ON or OFF at specified regular intervals or at a specified delay time.
When an interrupt occurs the BRX MPU will run a specified code block called an Interrupt Service Routine (ISR). BRX MPUs implement these interrupt events by creating an Interrupt Trigger that specifies the type of trigger, the required triggering conditions, and which Interrupt Service Routine to execute when that trigger is fired. The Setup Interrupt Triggers dialog creates the default settings for the Interrupt Triggers which are loaded each time the BRX MPU transitions from PROGRAM to RUN mode. These settings can be changed at runtime with the Interrupt Configuration Editor (INTCONFIG) instruction. Setup Interrupt Triggers
There are the following three types of Interrupt triggers:
To make sure that all of the 12 potential interrupt triggers has an equal chance to run, the interrupt processor uses a round-robin scheme to determine which interrupt will run next. The order is Event 1, Timer 1, Match 1, Event 2, Timer 2, Match 2, Event 3, Timer 3, Match 3, Event 4, Timer 4, Match 4.
|
|
Setup Input EventBRX MPUs can use their on-board discrete inputs or the inputs on BRX HSIO modules (BX-HSIO1, BX-HSIO2, HSIO4) to trigger the execution of an Interrupt Service Routine. The triggering Event is constructed from the input's current state of the selected input (a High / Low Level), and transitions between states of the selected input (a Rising / Falling / Either Edge).
The AND selections are states, and should be considered preconditions; OR selections are transitions or edges, and should be considered triggers. An Input Event must contain at least one trigger (one of the OR selections) but does NOT have to contain any preconditions (one of the AND selections). Any time all of the Level Events (AND selections) are true, any of the Edge Events (OR selections) will cause the associated Interrupt Service Routine to run.
Enable Input Event is the "master" enable for this event, enable this selection to "arm" this event.
Click OK to save the Event configuration, or Cancel to close this dialog and lose any changes that were made.
Note: the default Input Filter value of 10ms (25Hz / 750000 clocks) is not an appropriate value when the High-Speed I/O inputs are used for an interrupt signal. You will want to change the Input Filter value to a faster response time (lower filter value) to allow the interrupt signal to work as quickly as expected. Do-more Designer will display the following message box any time one of the High-Speed I/O inputs is selected for use as an interrupt without changing the default filter time.
After an Event Trigger is setup its configuration will be displayed on the main dialog in shorthand form, similar to the example below.
The leftmost group in parentheses contains the level (AND) inputs; the rightmost group contains the edge (OR) inputs. The above example shows (X0 High and X1 Low) and (rising edge X2 or falling edge X3 or either edge X4 ). The shorthand uses the following symbols:
|
|
Setup TimersBRX MPUs and BRX HSIO modules (BX-HSIO1, BX-HSIO2, HSIO4) use a hardware timer to run an Interrupt Service Routine in situations where you need an action to occur at regular intervals and not be affected by variations in the PLC scan time. For example, situations that require actions occur at precise repeating intervals, or actions that occur after a precise amount of delay time.
Enable Timer is the "master" enable for this timed event, enable this selection to allow the Timer to run.
Click OK to save the Timer configuration, or Cancel to close this dialog and lose any changes that were made.
|
|
Setup Match RegistersWhen one of the BRX CPU's on-board a High-Speed I/O inputs or one of the inputs on a BRX HSIO module (BX-HSIO1, BX-HSIO2, HSIO4) is configured for high speed counting, a register match operation can be used to generate a Match Register Event to trigger the execution of an Interrupt Service Routine. Once enabled, the ISR will be run each time the comparison operation transitions from "not a match" to "is a match".
Enable Match Register is the "master" enable for this register match event, enable this selection to allow the comparison to be made.
Click OK to save the Match Register configuration, or Cancel to close this dialog and lose any changes that were made.
|
|
See Also:
INTCONFIG - Interrupt Configuration Editor
INTDECONFIG - Deconfigure Interrupt
INTSUSPEND - Suspend Interrupts
|
|
Related Topics:
BRX Interrupt Triggers
BRX Pulse Width Modulated Outputs
|
|