Table of Contents
hil_task_create_writer
The HIL API MATLAB functions have been deprecated in favour of the new quanser.hardware.hil class, which has support for code generation for Quanser targets. Hence, with the new hil class it is possible to run MATLAB scripts in real-time on Quanser targets, while making use of the Quanser hardware. |
Creates a task to write the specified channels.
[task, err] = hil_task_create_writer(board, samples_in_buffer, ... analog_channels, encoder_channels, digital_channels, other_channels)
Creates a task to write the specified channels. The task must be deleted using the hil_task_delete or the hil_task_delete_all function. Tasks are used for operation such as data streaming and control. Tasks maintain an internal buffer into which samples are read or from which samples are written in the background once the task is started. Data may be written asynchronously to this buffer using the task_write functions or read from this buffer using the task_read functions.
Many cards allow the digital I/O lines to be programmed as inputs or outputs. The digital I/O lines are configured as inputs or outputs using the hil_set_digital_directions function. All the channels which will be used as digital outputs must be configured as outputs using this function. Failure to configure the digital I/O may result in the hil_task_write function failing to write those outputs.
If no err output is provided then it throws an exception if an error occurs. In generated code it prints the error message. Use hil_get_error_message to get the message associated with an error code.
board
The board handle returned by hil_open.
samples_in_buffer
The number of samples in the task's internal buffer. For double-buffering, make this parameter twice the size of the number of samples written using task_write.
analog_channels
A vector of analog channel numbers. Channel numbers are zero-based. This parameter may be an empty matrix, [].
Select a board type from the list for board-specific details: .
pwm_channels
A vector of pwm channel numbers. Channel numbers are zero-based. This parameter may be an empty matrix, [].
Select a board type from the list for board-specific details: .
digital_channels
A vector of digital channel numbers. Channel numbers are zero-based. This parameter may be an empty matrix, [].
Select a board type from the list for board-specific details: .
other_channels
A vector of other channel numbers. Channel numbers are zero-based. This parameter may be an empty matrix, [].
Select a board type from the list for board-specific details: .
task
A task structure. Fields of the structure should never be modified.
err
A negative error code or zero on success.
% Creates a task to write analog channels 0 and 3 and digital channel 5, with an internal buffer of 1000 samples.
task = hil_task_create_writer(board, 1000, [0 3], [], 5);
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.