Defining an interrupt task, Defining an i/o interrupt task – Echelon Neuron C User Manual

Page 167

Advertising
background image

Neuron C Programmer’s Guide

155

associated periodic system timer interrupt as needed; see

Controlling Interrupts

on page 159.

One application for periodic system timer interrupts could be to provide audio

output for your application. Audio output generally requires a minimum of an 8

kHz signal, and a Series 5000 chip can process interrupts at an 8 kHz rate while
providing full network communication support for the application.

Defining an Interrupt Task

Within your Neuron C application, you can define one interrupt task for each

interrupt source. The interrupt task definition specifies the interrupt source,
interrupt type, and the interrupt condition. An interrupt task looks similar to

the familiar Neuron C when task, but uses the interrupt keyword rather than the
when keyword. However, interrupt tasks are not scheduled by the application

scheduler.
The basic syntax for an interrupt task is:

interrupt (

pin

,

condition

)

interrupt (

object-name

)

interrupt (repeating)
interrupt (repeating,

freq

)

pin

specifies the I/O pin for an I/O interrupt

condition

specifies the interrupt trigger condition for an I/O
interrupt

object-name

specifies the timer/counter I/O object name for a

timer/counter interrupt

repeating

defines a periodic system timer interrupt

freq

specifies the frequency for a periodic system timer
interrupt

The following sections describe how to define each type of interrupt task.

Defining an I/O Interrupt Task

An I/O interrupt references an I/O pin, IO_0 .. IO_11. The I/O interrupt can use
the same I/O pin keyword that you use to declare the I/O object, but you do not

need to declare an I/O object for the pin used with an I/O interrupt. The I/O pin

can be an input signal or an output signal.

You can define up to two I/O interrupts, which are dispatched in declaration

order. If you define a third I/O interrupt task, the Neuron C compiler issues

error NCC#577.

You declare the trigger condition for the I/O interrupt through a level indicator,

‘+’ or ‘-‘, or by using the clockedge keyword, as shown in Table 10 on page 156.

Advertising