Defining a system timer interrupt task – Echelon Neuron C User Manual

Page 170

Advertising
background image

158 Additional

Features

• Infrared input
• Ontime input
• Period input
• Pulsecount input
• Stretched triac output
• Triac output

Note: Triggering the interrupt on the latch for the stretched triac output and
triac output models means that the interrupt occurs at zero crossing. This

trigger could be used for phase detection. If your application requires pulse

monitoring, you could overload an I/O interrupt to monitor both the zero crossing
and the trigger pulse.
Example:

IO_4 input edgelog mux clock(5) myEdgelog;
IO_5 input ontime myOnTime;
IO_1 output oneshot myOneShot;

interrupt(myEdgelog) { // T/C 1 IRQ
...
}

interrupt(myOnTime) { // T/C 2 IRQ
...
}

// The following yields a compilation error, even though
// the declaration of overlapping T/C models is correct
// (through use of the io_select function).

interrupt(myOneShot) { // ERROR: Too many T/C interrupts
...
}

Defining a System Timer Interrupt Task

To define a periodic system timer interrupt, use the repeating

keyword, followed

by an optional frequency specification.
The default frequency is 8 kHz (a period of 125 μs). You can define other
frequencies from 2,441.406 Hz to 625,000 Hz, in 256 steps. The interrupt

frequency is a constant value in Hertz, specified as a double-quoted string. The

number that you specify in that string follows the standard C format for floating
point numbers. Additionally, you can append an optional multiplier: “Hz”

(hertz), “kHz” (kilohertz), “MHz” (megahertz), or “GHz” (gigahertz). The

multiplier is case-sensitive.

Examples:

interrupt(repeating) { // periodic system timer, 8kHz
...
}

interrupt(repeating, ”8kHz”) { // equivalent to default

Advertising