Difference between revisions of "Interrupt Icon Properties"
(25 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | <sidebar>Sidebar: Icon Properties</sidebar> | ||
+ | {| style="margin:auto; text-align:center;" | ||
+ | |- | ||
+ | |[[File:Btn_Interrupt.gif|border]] | ||
+ | | width="50px" |→ | ||
+ | |[[File:Gen_Interrupt_Flowchart_Icon_01.png]] | ||
+ | |width="50px" |→ | ||
+ | |[[File:Gen_Interrupt_Icon_Properties_01.png]] | ||
+ | |} | ||
+ | __NOTOC__ | ||
+ | ===Introduction to Interrupts=== | ||
− | + | Interrupts are called to react to an event such as an external stimulus, or a timing event. | |
+ | When an interrupt is activated it executes a Macro. The macro to be called is specified by the user when creating the interrupt. | ||
− | |||
− | |||
− | |||
− | |||
The number and types of interrupts available are dependent on the device used. Some devices have a number of interrupts whereas other devices may only have a few. | The number and types of interrupts available are dependent on the device used. Some devices have a number of interrupts whereas other devices may only have a few. | ||
Line 12: | Line 20: | ||
The exact details, properties and operation of an interrupt vary from interrupt to interrupt. Users will need to refer to the interrupt dialogs for exact details of any particular Interrupt. However there are four main types that Flowcode uses: | The exact details, properties and operation of an interrupt vary from interrupt to interrupt. Users will need to refer to the interrupt dialogs for exact details of any particular Interrupt. However there are four main types that Flowcode uses: | ||
− | *TMR<X>- overflow - reacts to the clocked overflow event | + | *TMR<X> - overflow - reacts to the clocked overflow event from onboard timer X. |
− | *INT - reacts to an input on | + | *INT - reacts to an input change on a specific external interrupt pin. |
− | * | + | *IOC (Interrupt On Change) - reacts to any change on a specified collection of inputs |
*Custom - defines a custom interrupt procedure. | *Custom - defines a custom interrupt procedure. | ||
Line 23: | Line 31: | ||
Details of the various interrupts can be found below, along with example of available properties. | Details of the various interrupts can be found below, along with example of available properties. | ||
+ | ====Video instructions==== | ||
+ | See the [http://www.youtube.com/watch?v=2a1UUrfxGFE&list=PLQDWBb7bxuCgg6aJgPJcfXBMzZdLILceQ Adding an Interrupt] video for an introduction of interrupts, you can learn how to use interrupts as well as what they can be used for, this video also provides a brief overview of different types of interrupts and mentions that different interrupts are available on different devices. | ||
+ | <div align="center"> | ||
+ | {{#ev:youtube|2a1UUrfxGFE|640}} | ||
+ | </div> | ||
− | |||
− | + | ===Creating an interrupt=== | |
+ | |||
+ | [[File:Gen_Interrupt_Icon_Properties_01.png]] | ||
Line 39: | Line 53: | ||
Set the properties for that event. | Set the properties for that event. | ||
− | Set the macro to call, or create a new macro. | + | Set the macro to call, or [[Creating a New Macro|create a new macro]]. |
− | + | ===Interrupt properties=== | |
− | + | [[File:Gen_Interrupt_Icon_Properties_TMR0_Properties.png]] | |
− | + | ===TMR Timer overflow Interrupt=== | |
− | + | TMR0, for example, interrupts when the timer overflows. A count is made internally based on clock inputs and the pre-scaler property (see below for details). | |
+ | When the count reaches a certain point it overflows back to 0 triggering an Overflow event. This event can then be used to call a macro. Timer overflow interrupts are called repeatedly at the Interrupt time interval making them very useful for time based events, or for frequently needed features such as display updates. | ||
− | Note: Check that the clock speed setting is correct (via the Project Options) as clock speed affects timer interrupt frequency settings. | + | |
+ | Note: Check that the clock speed setting is correct (via the [[Project Options#General Options|Project Options]]) as clock speed affects timer interrupt frequency settings. | ||
Line 66: | Line 82: | ||
− | '''Note:''' Certain Flowcode components such as the PWM and Servo consume some of the timer peripherals. For details on the hardware consumed by a component please refer to the specific component help file. | + | '''Note:''' Certain Flowcode components such as the PWM and Servo consume some of the timer peripherals. For details on the hardware consumed by a component please refer to the specific [[Component Help Files|component help file]]. |
− | + | ====Example of TMR0 properties:==== | |
'''Clock source select''' | '''Clock source select''' | ||
+ | |||
Select the clock source signal to use for the overflow timing. | Select the clock source signal to use for the overflow timing. | ||
Line 82: | Line 99: | ||
*Transition on T0CKI | *Transition on T0CKI | ||
+ | |||
'''Source edge select''' | '''Source edge select''' | ||
Line 88: | Line 106: | ||
*High-to-low transition on T0CKI | *High-to-low transition on T0CKI | ||
+ | |||
*Low-to-high transition on T0CKI | *Low-to-high transition on T0CKI | ||
Line 135: | Line 154: | ||
− | + | ===Custom=== | |
The Custom option allows the creation of custom interrupt code. | The Custom option allows the creation of custom interrupt code. | ||
Line 143: | Line 162: | ||
− | Interrupt Property page | + | '''Interrupt Property page''' |
+ | |||
+ | [[File:Gen_Interrupt_Icon_Properties_Custom.png]] | ||
− | |||
+ | '''Custom Interrupt property page''' | ||
− | + | [[File:Gen_Custom_Interrupt_Properties.png]] | |
− | |||
+ | A range of different custom interrupts are available for each chip: | ||
− | + | * [[Custom Interrupts - PICmicro|PICmicro Custom Interrupts]] | |
− | + | * [[Custom Interrupts - AVR|AVR Custom Interrupts]] | |
− | + | * [[Custom Interrupts - ARM|ARM Custom Interrupts]] | |
− | + | * [[Custom Interrupts - dsPIC/PIC24|dsPIC/PIC24 Custom Interrupts]] |
Latest revision as of 08:41, 1 October 2013
<sidebar>Sidebar: Icon Properties</sidebar>
![]() |
→ | ![]() |
→ | ![]() |
Introduction to Interrupts
Interrupts are called to react to an event such as an external stimulus, or a timing event.
When an interrupt is activated it executes a Macro. The macro to be called is specified by the user when creating the interrupt.
The number and types of interrupts available are dependent on the device used. Some devices have a number of interrupts whereas other devices may only have a few.
The exact details, properties and operation of an interrupt vary from interrupt to interrupt. Users will need to refer to the interrupt dialogs for exact details of any particular Interrupt. However there are four main types that Flowcode uses:
- TMR<X> - overflow - reacts to the clocked overflow event from onboard timer X.
- INT - reacts to an input change on a specific external interrupt pin.
- IOC (Interrupt On Change) - reacts to any change on a specified collection of inputs
- Custom - defines a custom interrupt procedure.
Other interrupts may be available depending on the target chip, such as the "Receive" interrupt for chips with a UART available.
Details of the various interrupts can be found below, along with example of available properties.
Video instructions
See the Adding an Interrupt video for an introduction of interrupts, you can learn how to use interrupts as well as what they can be used for, this video also provides a brief overview of different types of interrupts and mentions that different interrupts are available on different devices.
{{#ev:youtube|2a1UUrfxGFE|640}}
Creating an interrupt
Add an Interrupt icon to the program.
Select Enable Interrupt or Disable Interrupt to turn the interrupt on or off respectively.
Select the desired interrupt from the drop down list of interrupts available from that particular device.
Set the properties for that event.
Set the macro to call, or create a new macro.
Interrupt properties
TMR Timer overflow Interrupt
TMR0, for example, interrupts when the timer overflows. A count is made internally based on clock inputs and the pre-scaler property (see below for details).
When the count reaches a certain point it overflows back to 0 triggering an Overflow event. This event can then be used to call a macro. Timer overflow interrupts are called repeatedly at the Interrupt time interval making them very useful for time based events, or for frequently needed features such as display updates.
Note: Check that the clock speed setting is correct (via the Project Options) as clock speed affects timer interrupt frequency settings.
The exact properties available for a timer interrupt are device and timer dependent. As such the timer overflow dialogs may vary from device to device and from timer to timer. The example below is intended to give an idea of the kind of properties available for a Timer overflow interrupt.
Specific details can be found in the Interrupt dialogs, and from Device datasheets.
TMR1 on the 16F877A, for instance, has a smaller set of pre-scaler options than the TMR0 interrupt, and also no source edge settings available unlike the TMR0 interrupt.
The TMR2 interrupt has an additional setting called the rollover value. This changes the rollover value in the timer register that is responsible for triggering the interrupt which allows for much better control over interrupt frequency. This advanced timeout functionality can be replicated with the other timers by writing to the timer count registers directly using C code.
Note: Certain Flowcode components such as the PWM and Servo consume some of the timer peripherals. For details on the hardware consumed by a component please refer to the specific component help file.
Example of TMR0 properties:
Clock source select
Select the clock source signal to use for the overflow timing.
Options available are device dependent.
Examples:
- Internal clock (CLK0)
- Transition on T0CKI
Source edge select
Select the transition edge used for clock signal timing.
- High-to-low transition on T0CKI
- Low-to-high transition on T0CKI
Prescaler rate
Select a pre-scaler rate for the clock signal.
A prescaler divides down the clock signals used for the timer giving reduced overflow rates.
The rate can be set to a number of possible values. The exact values are chip dependent.
E.g. for the PIC16F877A values area a number of values are available ranging from 1:1 to 1:256.
The prescaler value is used in conjunction with the clock speed to set an overflow frequency.
E.g.
- Clock speed:- 19660800
- Prescale value:- 1:256
- Interrupt frequency 75Hz
- Clock speed:- 19660800
- Prescale value:- 1:64
- Interrupt frequency 300Hz
INT
Triggered when an external stimulus is used on an external interrupt (INT) pin (e.g. a Button press)
The interrupt can be set to trigger on the:
Falling edge of INT
Rising edge of INT
INT interrupts can be useful in setting interrupts to occur on signal on or signal off events, such as an emergency shut off switch.
Port change
Interrupts when an input signal occurs on any of a selected group of port inputs.
The Port change interrupt may have properties allowing the interrupt I/O pins to be enabled or disabled as interrupt pins.
Custom
The Custom option allows the creation of custom interrupt code.
Many of the chips available in Flowcode support hardware driven interrupts that are not provided in the standard set of Flowcode interrupts. To allow users to add their own interrupts to suit their application Flowcode has the option to add your own custom interrupt.
Interrupt Property page
Custom Interrupt property page
A range of different custom interrupts are available for each chip: