Table of Contents
hil_write
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. |
Writes to the specified channels.
err = hil_write(board, analog_channels, pwm_channels, digital_channels, other_channels, analog_voltages, pwm_duty_cycles, digital_values, other_values)
Writes to the specified analog, digital, PWM and other channels immediately. Channel numbers are zero-based. Specify an empty matrix, [], to specify no channels.
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.
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: .
analog_voltages
A vector of analog voltages. There must be one element for each analog channel. If no analog channels were specified then this parameter may be an empty matrix, [].
pwm_duty_cycles
In PWM duty cycle mode, this argument is a vector of PWM duty cycles. Values may range from -1.0 to +1.0. Sign indicates direction for bipolar PWM outputs.
In PWM frequency mode, this argument is a vector of PWM frequencies in Hertz. Sign indicates direction for bipolar PWM outputs.
In PWM period mode, this argument is a vector of PWM periods in seconds. Sign indicates direction for bipolar PWM outputs.
There must be one element for each PWM output channel. If no PWM channels were specified then this parameter may be an empty matrix, [].
digital_values
A vector of logical values. A value of true (1) represents a high digital output and a value of false (0) represents a low digital output. There must be one element for each digital channel. If no digital channels were specified then this parameter may be an empty matrix, [].
other_values
A vector of values. There must be one element for each other channel. If no other channels were specified then this parameter may be an empty matrix, [].
err
A negative error code or zero on success.
% Writes 0.5V to analog channel 0, 70% to PWM channel 4, % 0 to digital channel 2 and -1.2 to other channel 1 hil_write(board, 0, 4, 2, 1, 0.5, 0.7, 0, -1.2);
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.