SERIES AP440 ACROPACK
USER
’S MANUAL
Acromag, Inc. Tel: 248-295-0310
- 34 - http://www.acromag.com
- 34 -
www.acromag.com
ports or event signals to ensure that the input data is valid prior to being
used by the software.
Interrupt Generation
This model provides control for generation of interrupts on positive or
negative events, for all 32 channels. Interrupts are only generated in the
Enhanced Mode for event channels when enabled via the Event
Sense/Status Register. Writing 0 to the corresponding event sense bit in the
Event Sense/Status Register will clear the event sense flip/flop. Successive
interrupts will only occur if the event channel has been reset by writing a 1
to the corresponding event sense bit in the Event Sense/Status Register
(after writing 0 to clear the event sense flip/flop). Interrupts may be
reflected internally and reported by polling the module. Control of this line
is initiated via Bit 0 of the Interrupt Enable Register.
Note that the state of the inputs (on/off) is determined by reading the
corresponding port address while in bank 0 of the Enhanced Mode.
However, the event sense status can only be read by reading the
corresponding port address while in bank 1 of the Enhanced Mode.
Remember, the event sense status is a flag that is raised when a specific
positive or negative transition has occurred for a given input point, while the
state refers to its current level.
An enabled Event Sense bit and the board interrupt enabled when both
enabled will allow interrupts to be generated. Changing Debounce control
registers while interrupts are enabled can cause false interrupts. It is
recommended that interrupts be disabled prior to accessing Debounce
control registers.
Note that the Interrupt Enable Register is cleared following a power-up or
bus initiated hardware reset, but not a software reset initiated via writing a
one to bit 1 of the Software Reset Register. Keep this in mind when you wish
to preserve the information in these two registers following a reset.
Programming Example
The following example outlines the steps necessary to configure the AP440
for Enhanced Mode operation, to setup event-generated interrupts,
configure debounce, and read and write inputs. It is assumed that the
module has been reset and no prior (non-default) configuration exists.
For this example, we will configure port 0 input points as a four-channel
change-of-state detector. For change-of-state detection, both positive and
negative polarities must be sensed and thus, two channels are required to
detect a change-of-state on a single input signal. IN00-IN03 will be used to
detect positive events (low-to-high transitions); IN04-IN07 will be used to
detect negative events (high-to-low transitions). IN00 and IN04 will be tied
to the first input signal, IN01 & IN05 to the second, IN02 & IN06 to the third,
and IN03 & IN07 to the fourth. Any change-of-state detected on these input