-
5.2. Access Relays
5.2.1. Check Relay Status
Function Description:
To get current Relay status.
Function call:
BOOL IOC_GetRelayStatus(DWORD *pStatus);
Parameters(Output):
pStatus:
DWORD *
: Relay status
Return code:
TRUE = Success
FALSE = Unsupported
Note:
This macro returns relay status in pStatus, which is a point to a DWORD. Macro RELAY1_BITS
…
RELAY4_BITS define which bit in the *pStatus corresponds to which relay.
Example:
#include “ioc_ioctl.h”
…
DWORD dwStatus;
HANDLE gIOControlDriverHandle;
…
gIOControlDriverHandle = CreateFile(L”IOC1:”, GENERIC_READ |
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, 0);
If (gIOControlDriverHandle == INVALID_HANDLE_VALUE) {
// IO device not found, function not supported,
// error process
}
…
IOC_GetRelayStatus(&dwStatus);
if (dwStatus & RELAY1_BITS) {
// relay 1 close
}
else {
// relay 1 open
}
if (dwStatus & RELAY2_BITS) {
// relay 2 close
}
else {
// relay 2 open
}
if (dwStatus & RELAY3_BITS) {
// relay 3 close
}
else {
// relay 3 open
}
if (dwStatus & RELAY4_BITS) {
// relay 4 close
}
else {
// relay 4 open
}
CloseHandle(gIOControlDriverHandle);
Содержание MR650
Страница 1: ...MR650 Programming Manual V 1 12 1 16 2008 ...
Страница 7: ... 7 13 FUNCTION KEY SETTING ON REGISTRY 65 14 UPDATE NOTES 66 ...
Страница 16: ... it is for internal use send messages ...
Страница 33: ... Be aware to release handles when program ends ...