![Acromag AcroPack AP471 Series User Manual Download Page 29](http://html1.mh-extra.com/html/acromag/acropack-ap471-series/acropack-ap471-series_user-manual_2841147029.webp)
SERIES AP471 ACROPACK
USER
’S MANUAL
Acromag, Inc. Tel: 248-295-0310
- 27 -
http://www.acromag.com
- 27 -
www.acromag.com
The event sense status is a flag that is raised when a specific change-of-state,
positive, or negative transition has occurred for a given I/O point, while the
state refers to its current level.
Enabling both an Event Sense bit and the board interrupts will allow
interrupts to be generated
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 0 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 AP471
to setup event-generated interrupts, configure debounce, and read and
write I/O. It is assumed that the module has been reset and no prior (non-
default) configuration exists.
For this example, we will configure channels 0 thru 3 as a four-channel
positive (low-to-high) transition detector. I/O00-I/O03 will be tied to input
signals. Any positive transition detected on these input signals will cause an
interrupt to be generated.
1.
The default debounce duration is 4µs with the default 31.25MHz
debounce clock. Write 0000 0055H to the Debounce Duration
Register to select a 64µs debounce time for channels 0 thru 3. An
incoming signal must be stable for the entire debounce time before
it will be recognized as a valid input transition.
2.
Enable the debounce circuitry for channels 0 thru 3 inputs by setting
bits 0 thru 3 of the Debounce Control Register. Write 000FH to the
Debounce Control Register. If the module had been configured
earlier, you would first read this register to check the existing
settings of debounce enable for the other channels of this module
with the intent of preserving their configuration by adjusting the
value written above.
3.
For our example, I/O00-I/O03 will be used to detect positive events
(low-to-high transitions). Write 000FH to the Event Polarity Control
Register to set I/O00-I/O03 to positive edge detection. If the module
had been configured earlier, you would first read this register to
check the existing settings of event polarity for the other channels of
this module with the intent of preserving their configuration by
adjusting the value written above.
4.
To enable event sensing for channels 0 thru 3, write 000FH to the
Event Enable Register.
5.
For our example, channels 0 thru 3 are to be used for inputs only and
writes to this port should be masked to prevent the possibility of