Digarm – Measurement Computing Personal488 rev.3.0 User Manual
Page 78

Personal488 for Windows 95/98/Me/NT/2000
04-10-01
API Reference 6-10
DigArm
AT488pnp and PCI488 Only !
Syntax
INT WINAPI DigArm(DevHandleT devHandle, BOOL bArm);
devHandle
refers to an interface handle.
bArm
refers to a value that arms or disarms event generation.
TRUE
= Arm,
FALSE
=
Disarm.
Returns
-1
if neither nibble is set for input, or other error
Bus States
None
Example
DigArm(devHandle, TRUE);
Arms digital input event generation.
See Also
DigArmSetup, DigSetup, OnDigEvent, OnDigEventVDM
The
DigArm
command arms or disarms the event-generation due to a digital I/O port match condition. The
caller should configure the digital I/O port, the event-callback mechanism, and the match condition prior to
arming the event generation. The following code snippet illustrates this sequence:
DigSetup(devHandle, FALSE, FALSE); // Configure both nibbles for input.
OnDigEventVDM(devHandle, MyFunc, 0); // On event, call function MyFunc.
DigArmSetup(devHandle, 0x0A5); // Trigger when inputs equals 0xA5.
DigArm(devHandle, TRUE); // Enable event generation.
Event generation is automatically disarmed when an event is triggered. The event generation
configuration, however, remains intact, so event generation can be re-armed just by calling
DigArm
. The
other steps shown in the above code snippet do not need to be repeated unless the event configuration is to
be changed.
Event generation may be disarmed (
bArm = FALSE
) at any time.
Notes:
(1)
This function does not configure the digital I/O port for input. The caller must use
DigSetup
to configure the port for input before performing arming event generation. If neither nibble is
configured for input the function returns
-1
and sets the error code to
IOT_BAD_VALUE2
.
(2)
Event generation may be re-armed from within the event handler to provide continuous
detection of match condition events. However, this is not guaranteed to catch every event if
the digital input values are rapidly changing.
(3)
Any digital I/O port bits configured for output are treated as “don’t care” bits for the purposes
of event generation. In other words, it is valid to arm an event when only one nibble of the
port is configured for input. In this case, the other nibble is ignored when detecting the match
condition.