Table of Contents
hil_task_stop
Stops a running task.
Description
The hil_task_stop function stops a task that is running. A task may be stopped before it has processed all of its samples. Tasks may also be restarted using the hil_task_start function.
Prototype
t_error hil_task_stop(t_task task);
Parameters
t_task task
A handle to the task, as returned by one of the task creation functions.
Return value
The return value is 0 if the task is stopped 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_HIL_TASK_STOP_NOT_SUPPORTED
This function is not supported by the board-specific HIL driver for this board type.
QERR_INVALID_TASK_HANDLE
An invalid task handle was passed as an argument. Once a task has been deleted using hil_task_delete the task handle is invalid.
QERR_INVALID_OPERATION_HANDLE
An invalid operation handle was passed as an argument to the board-specific HIL driver. Once a task has been deleted using hil_task_delete the operation handle is invalid.
QERR_DRIVER_INCOMPATIBLE_WITH_BOARD_DLL
The board-specific HIL driver passed an invalid parameter to the operating system specific kernel-level driver for the board. The board-specific HIL driver is likely not compatible with the operating system specific kernel-level driver for the board. Make sure both are up-to-date and compatible versions.
Requirements
Include Files |
Libraries |
---|---|
hil.h |
hil.lib;quanser_runtime.lib;quanser_common.lib |
Examples
/* * Reads 5000 samples at 1 kHz from the first four analog input channels, using SYSTEM_CLOCK_1. * Return values are ignored for simplicity. */ t_uint32 channels[] = { 0, 1, 2, 3 }; t_double frequency = 1000; t_uint32 samples = 5000; t_uint32 samples_in_buffer = frequency; t_uint32 samples_to_read = 1; static t_double buffer[4]; t_task task; hil_task_create_analog_reader(board, samples_in_buffer, channels, ARRAY_LENGTH(channels), &task); hil_task_start(task, SYSTEM_CLOCK_1, frequency, samples); for (int index = 0; index < samples; index += samples_to_read) { hil_task_read_analog(task, samples_to_read, buffer); ... } hil_task_stop(task); hil_task_delete(task);
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.