Table of Contents
hil_close
Closes an HIL board.
Description
The hil_close function closes an HIL board, stopping any running tasks associated with the board and releasing any allocated resources. Once the board has been closed, the board handle is no longer valid and may not be used. Note that while hil_close does delete any tasks associated with the board, it is better not to rely on this behavior. Use hil_task_stop and hil_task_delete to properly shut down tasks.
Prototype
t_error hil_close(t_card card);
Parameters
t_card card
A handle to the board, as returned by hil_open.
Return value
The return value is 0 if the board is closed successfully. Otherwise a negative
error code is returned. Error codes are
defined in quanser_errors.h
. A suitable error message
may be retrieved using msg_get_error_message.
Error codes
QERR_INVALID_CARD_HANDLE
An invalid card handle was passed as an argument. Once a card has been closed using hil_close the card handle is invalid.
QERR_UNABLE_TO_LOCK_CARDS
It was not possible to gain access to the database of open boards. A thread may continue to hold the lock or the system may be low on memory.
QERR_OUT_OF_MEMORY
There is not enough memory to complete the operation.
Requirements
Include Files |
Libraries |
---|---|
hil.h |
hil.lib;quanser_runtime.lib;quanser_common.lib |
Examples
t_card board; t_error result = hil_open("q8", "0", &board); if (result == 0) { ... hil_close(board); } else { TCHAR message[512]; msg_get_error_message(NULL, result, message, sizeof(message)); _tprintf(_T("Failed to open board. %s (error %d)\n"), message, -result); }
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.