Writes to digital outputs immediately.
Namespace:
Quanser.Hardware
Assembly:
Quanser.Hardware.Hil (in Quanser.Hardware.Hil.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Sub WriteDigital ( _
channels As Integer(), _
bits As SByte() _
) |
C# |
---|
public void WriteDigital(
int[] channels,
sbyte[] bits
) |
Visual C++ |
---|
public:
void WriteDigital(
array<int>^ channels,
array<signed char>^ bits
) |
JavaScript |
---|
function writeDigital(channels, bits); |
Parameters
- channels
- Type: array<
System..::.Int32
>[]()[]
An array containing the numbers of the digital output channels to be written.
Channel numbers are zero-based. Thus, channel 0 is the first channel, channel 1 the second channel, etc.
Select a board type to the list for board-specific details:
.
- bits
- Type: array<
System..::.SByte
>[]()[]
An array containing the binary values to write to the digital outputs. Each element in
the bits array corresponds to the same element in the channels array.
Hence, there must be as many elements in the bits array as there are channels.
Remarks
Examples
This example illustrates how to write digital outputs immediately. It writes 0, 1, 1 and 0
to digital channels 0-3 respectively.
Exceptions are ignored for simplicity.
C# | Copy Code |
---|
int [] channels = { 0, 1, 2, 3 };
sbyte [] buffer = { 0, 1, 1, 0 };
card.WriteDigital(channels, buffer);
|
Visual Basic | Copy Code |
---|
Dim channels() As Integer = {0, 1, 2, 3}
Dim buffer() As SByte = {0, 1, 1, 0}
card.WriteDigital(channels, buffer)
|
Visual C++ | Copy Code |
---|
array<int>^ channels = { 0, 1, 2, 3 };
array<char>^ buffer = { 0, 1, 1, 0 };
card->WriteDigital(channels, buffer);
|
Exceptions
Exception | Condition |
---|
Quanser.Hardware..::.HilException |
If the write cannot be performed then an exception is thrown. This situtation
typically arises if the board does not support digital outputs or the hardware
resources required are in use by a task.
|
See Also