Presentation is loading. Please wait.

Presentation is loading. Please wait.

BRX Technical Training

Similar presentations


Presentation on theme: "BRX Technical Training"— Presentation transcript:

1 BRX Technical Training
Interrupts

2 Interrupts BX10 BX10E 6 discrete IN (all high-speed)
4 discrete OUT (2 high-speed) No analog IN No analog OUT No Ethernet port BX10E 1 analog IN 1 analog OUT Ethernet port

3 Interrupts BX18 BX18E 10 discrete IN (all high-speed)
8 discrete OUT (4 high-speed) No analog IN No analog OUT No Ethernet port BX18E 1 analog IN 1 analog OUT Ethernet port

4 Interrupts BX36 BX36E 20 discrete IN (10 high-speed)
16 discrete OUT (8 high-speed) No analog IN No analog OUT No Ethernet port BX36E 4 analog IN 2 analog OUT Ethernet port

5 Interrupts (Why?) Inputs are normally read at top of scan
Outputs are normally written to at bottom of scan If input changes during scan, it is not seen by logic until the next scan Most of the time this is OK because scan times are so fast for industrial world Interrupts allow an input to be seen during scan Interrupts allow an output to be changed during scan 3 types of triggers for generating interrupts: Events (up to 4) Timers (up to 4) Match registers (up to 4) Each interrupt calls an ISR Only on-board inputs can be used Doesn’t have to be high-speed inputs Read Inputs Code Blocks Write Outputs

6 Interrupts (Input Events)
Uses onboard input(s) to trigger interrupt Expansion I/O cannot be used Input Event: Prequalifiers Levels High Low None or up to 19 Levels are AND’d (i.e. all have to be true) Event Edges Rising Falling Either 1 or up to 20 Edges are OR’d (i.e. any one will trigger interrupt) Name of ISR that is called LEVELS (all must be true): If X13 is LOW AND X14 is HIGH AND X15 is HIGH AND X19 is HIGH …THEN… Read as: MyISR gets invoked if X13 is low (!X13) and X14 is high AND X15 is high and X19 is high and then either a rising edge is seen on X0 (pX0), or a falling edge on X1 (nX1) or either edge on X2 (nX2 | pX2) If all LEVELS are true then… EDGES (any is true) If there’s a rising edge on X0 OR there’s a falling edge on X1 OR there’s any edge on X2 … THEN… Call MyISR

7 Interrupts (Timer) Uses hardware 1µsec timer Timer Mode Timer Duration
Recurrent One Shot Timer Duration 1 to 2,147,483,647 µsec (35 min, sec) Name of ISR that is called

8 Interrupts (Timer Example)
Test example to compare between 4 ways of doing a 1-second timer that toggles an output Each method will utilize Tickus() function in MATH to calculate the ON time of the toggle TMR Instruction to toggle Y0 D1 = current measured time in µsec D2 = current difference from 1 second D3 = maximum difference from 1 second ENTASK instruction to toggle Y1 D5 = current measured time in µsec D6 = current difference from 1 second D7 = maximum difference from 1 second t$1Second to toggle Y2 D9 = current measured time in µsec D10 = current difference from 1 second D11 = maximum difference from 1 second Interrupt Timer to toggle Y3 D13 = current measured time in µsec D14 = current difference from 1 second D15 = maximum difference from 1 second

9 Interrupts (Timer Example)
1-sec TMR Instruction = $Main T0 resets itself Calculate the difference from 1 second (1,000,000 µsec), store in D2 PONOFF toggles Y0 every 1 second When Y0 comes ON store TICKus() in D0 When Y0 goes OFF store difference between TICKus() in D0 into D1 Store the maximum difference into D3

10 Interrupts (Timer Example)
ENTASK (enables Toggle_Y1)

11 Interrupts (Timer Example)
Toggle_Y1 Task

12 Interrupts (Timer Example)
$t1Second

13 Interrupts (Timer Example)
Configuration Recurrent Timer with a duration of 1 second (1,000,000 µsec) that executes Toggle_Y3 ISR

14 Interrupts (Timer Example)
ISR Toggle_Y3

15 Interrupts (Timer Example)
Typical Accuracy TMR varies by 583µsec User Task varies by 579µsec $t1Second varies by 578µsec Timed Interrupt varies only 2µsec!

16 Interrupts (Timer Example)
D14 gray line’s standard deviation is negligible

17 Interrupts (Match Registers)
Monitors high-speed I/O register values Ctr/Tmr Accumulator (1, 2, 3) Pulse Output Position (1, 2, 3) Comparison =, !=, >, >=, <, <= …to an integer value (signed double-word) Name of ISR that is called

18 Interrupts (Match Registers Example)
Will compare the ability of ladder logic comparative contact VS Match Register interrupt, to see a specific (=; equal to) value in a high-speed position count Axis1 = virtual axis D0 = random new position (0 to 1,500,000) 1,000,000 = position in which to toggle output Y6 = output for Match Register Interrupt to toggle Y7 = output for ladder logic comparative contact to toggle

19 Interrupts (Match Registers Example)
Configuration

20 Interrupts (Match Registers Example)
$Main Ladder comparative Configures Axis1 as a virtual axis Calculate a random new position Move to the new position which might cross position 1,000,000

21 Interrupts (Match Registers Example)
ISR = MyMatch Toggles Y6 immediately

22 Interrupts (Match Registers Example)
Position 1,000,000 in Green Typical Results Ladder logic Y7 never toggles Match Register Interrupt always happens when current position exactly equals 1,000,000 Ladder logic compare never happens

23 Interrupts (Instructions)
INTSUSPEND “Suspend Interrupts” Edge triggered – suspend interrupts when input leg goes from OFF to ON Power flow enabled – suspend interrupts while the input leg is ON INTRESUME “Resume Interrupts” Clear any Pending interrupts If multiple interrupts occur during suspension, they “want” to run after resumption & will run in priority order; this selection makes sure they don’t run at all Edge triggered Power flow enabled Code Blocks No Interrupts

24 Interrupts (Instructions)
INTCONFIG “Configure Interrupt” Allows interrupts to be configured just like the System Configuration dialog 3 tabs for configuring (Input Event, Timer, Match Register) Edge triggered or Power flow enabled Can use <Load from System Config> button to pull data in from what is already configured there Can use variables in the instruction whereas variables cannot be used in the System Configuration

25 Interrupts (INTCONFIG Example)
Will generate a pulse with a 3-second period but with a variable duty cycle: D0 = Duty Cycle in percent D1 = ON time of pulse D2 = OFF time of pulse

26 Interrupts (INTCONFIG Example)
Configuration & the ISR (MyPulse) D0 = DutyCycle (in percent) Based on Duty Cycle (D0) ON & OFF times are calculated When Y6 is OFF reconfigure Timer interrupt for ON time When Y6 is ON reconfigure Timer interrupt for OFF time Timer Interrupt configuration just kicks things off 2 seconds (2,000,000 µsec) after Program-to-Run transition Toggle Y6 immediately

27 Interrupts (INTCONFIG Example)
Results D0 = DutyCycle 10% Duty Cycle (D0) 3-second period ON time = 0.3 sec OFF time = 2.7 sec


Download ppt "BRX Technical Training"

Similar presentations


Ads by Google