For information on the latest version, please have a look at 1.33.5.
set_on_monitoring_ctrl_io_ex (Manual Mode)
This section explains how to use set_on_monitoring_ctrl_io_ex during Manual (Teach) operations to register a callback function that receives real-time I/O monitoring data from the robot’s control box. The callback type depends on DRCF_VERSION; both variants are shown below.
Typical usage
Monitor digital and analog I/O state changes in real time during manual operation.
Debug I/O wiring or verify signal transitions without polling functions repeatedly.
Log or visualize I/O changes in a user-defined callback for testing.
Note
The callback is triggered whenever any I/O input/output state changes.
Must be registered after establishing a connection with the robot controller.
With DRCF_VERSION 3, set_on_monitoring_ctrl_io_ex takes a TOnMonitoringCtrlIOEx2CB callback; see set_on_monitoring_ctrl_io_ex.
Example: Register I/O monitoring callback (DRCF v2)
// 1) Define the callback function
void OnMonitoringCtrlIOEx(const LPMONITORING_CTRLIO_EX pData) {
printf("[I/O Monitor v2] DIN_1: %d, DOUT_1: %d, ANIN1: %.2f V\n",
pData->_tInput._iActualDI[0],
pData->_tOutput._iTargetDO[0],
pData->_tInput._fActualAI[0]);
}
// Preconditions:
// - Connection established (open_connection)
// - Manual (Teach) mode active
// 2) Register callback
drfl.set_on_monitoring_ctrl_io_ex(OnMonitoringCtrlIOEx);
// 3) Keep program alive to receive events
while (true) { std::this_thread::sleep_for(std::chrono::seconds(1)); }
Example: Register I/O monitoring callback (DRCF v3)
// 1) Define the callback function (DRCF_VERSION 3 uses MONITORING_CTRLIO_EX2)
void OnMonitoringCtrlIOEx2(const LPMONITORING_CTRLIO_EX2 pData) {
printf("[I/O Monitor v3] DIN_1: %d, DOUT_1: %d, ANIN1: %.2f\n",
pData->_tInput._iActualDI[0],
pData->_tOutput._iTargetDO[0],
pData->_tInput._fActualAI[0]);
}
// Preconditions:
// - Connection established (open_connection)
// - Manual (Teach) mode active
// 2) Register callback
drfl.set_on_monitoring_ctrl_io_ex(OnMonitoringCtrlIOEx2);
// 3) Keep program alive to receive events
while (true) { std::this_thread::sleep_for(std::chrono::seconds(1)); }
The structure is described in MONITORING_CTRLIO_EX2.
Tips
The callback runs at the same time as the rest of your program.
Unregister or stop monitoring before closing the connection to prevent dangling callbacks.