Syntax, Example – Echelon Neuron C User Manual
Page 108

88
Functions
provided by Series 5000 devices, and is only available to an application that
defines at least one interrupt task.
If you need to disable or enable all interrupts at the same time, you can also use
the io_idis() function to disable interrupts and the io_iena() function to enable
interrupts.
Syntax
void interrupt_control(unsigned
irqSelect
);
irqSelect
Specifies the type of interrupts to enable. You can use the
following predefined symbols to specify the interrupt type:
#define INTERRUPT_IO 0x03
#define INTERRUPT_TC 0x0C
#define INTERRUPT_REPEATING 0x10
A value of zero disables all interrupts. A value of -1 (0xFF) enables all interrupt
tasks defined within the application. You can enable and disable interrupts at
any time, as required for your application, but you cannot enable an interrupt
type for which your application does not define an interrupt task.
All interrupts are disabled after device reset. An application that uses interrupts
must enable these interrupts when it is ready, typically towards the end of the
reset task. Enable interrupts only when the device is in the online state.
The function prototype and predefined symbols are defined within the
<echelon.h> header file. The Neuron C compiler automatically includes this file
for every application; you do not need to include it explicitly.
Example
#include "status.h"
when(reset) {
// query node status:
status_struct status;
retrieve_status(&status);
// proceed with device initialization:
...
// enable interrupt system if configured and online:
if (status.status_node_state == 0x04) {
interrupt_control(INTERRUPT_IO | INTERRUPT_REPEATING);
}
}
when(offline) {
interrupt_control(0);
}
when(online) {
interrupt_control(INTERRUPT_IO | INTERRUPT_REPEATING);
}