BRX Technical Training

Slides:



Advertisements
Similar presentations
More fun with Timer/Counters
Advertisements

68HC11 Polling and Interrupts
Debouncing Switches Mechanical switches are one of the most common interfaces to a uC. Switch inputs are asynchronous to the uC and are not electrically.
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Fall 2007 L16: Memory Elements LECTURE 16: Clocks Sequential circuit design The basic memory element: a latch Flip Flops.
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
T IMERS - 2. O UTPUT U NIT Each capture/compare block contains an output unit. The output unit is used to generate output signals such as PWM signals.
16-Bit Timer/Counter 1 and 3 Counter/Timer 1,3 (TCNT1, TCNT3) are identical in function. Three separate comparison registers exist. Thus, three separate.
System Clocks.
Industrial Process Control System Simon Hui Engineer Control and Informatics, Industrial Centre.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
Microprocessors 1 MCS-51 Interrupts.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
Timers and Counters by Dr. Amin Danial Asham. References  Programmable Controllers-Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
CS-280 Dr. Mark L. Hornick 1 Atmel Timer/Counter System Most microcontrollers include some type of timer system Facilitates real-time monitoring and control.
Processor Architecture
TIMERS AND INTERRUPTS AVI SINGH KEVIN JOSE PIYUSH AWASTHI.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Time Management.  Time management is concerned with OS facilities and services which measure real time.  These services include:  Keeping track of.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Chapter 5.
BRX Technical Training
A walk through interrupts on the PPC 823
BRX Technical Training
Why are Timer Functions Important?
Timers and Event Counters
Do-more Technical Training
Basic Computer Organization and Design
ECE 3430 – Intro to Microcomputer Systems
BRX Technical Training
Registers and Counters
68HC11 Interrupts & Resets.
MIPS I/O and Interrupt.
Clocks A clock is a free-running signal with a cycle time.
Timer and Interrupts.
Do-more Technical Training
Computer Architecture
8086 Microprocessor.
BRX Technical Training
Chapter 10 © 2011, The McGraw-Hill Companies, Inc.
Programmable Interval Timer
AVR Addressing Modes Subject: Microcontoller & Interfacing
Introduction of microprocessor
Computer System Overview
BRX Technical Training
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
Do-more Technical Training
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
Timer/Counter Modified from Dr. Lam Phung’s Slides.
MIPS I/O and Interrupt.
ECE 3430 – Intro to Microcomputer Systems
GE Counters and Order of Operation
* * * * * * * 8051 Interrupts Programming.
Interrupts, Tasks and Timers
Programmable Interval timer 8253 / 8254
BRX Technical Training
Programmable Interval timer 8253 / 8254
BRX Technical Training
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Programmable Logic Controllers (PLCs)
ECE 3430 – Intro to Microcomputer Systems
Flip-Flops.
Computer System Overview
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

BRX Technical Training Interrupts

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

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

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

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

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

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, 47.483647 sec) Name of ISR that is called

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

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

Interrupts (Timer Example) ENTASK (enables Toggle_Y1)

Interrupts (Timer Example) Toggle_Y1 Task

Interrupts (Timer Example) $t1Second

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

Interrupts (Timer Example) ISR Toggle_Y3

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!

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

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

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

Interrupts (Match Registers Example) Configuration

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

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

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

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

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

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

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

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