WriteSPIDAC Method

Beta Innovations USB SDK .NET/COM

Writes contents of iDataBuffer to SPI compatible peripherals or DACs on the port specified by inPort. This function can be used on modules supporting either DACs or SPI ports.

Namespace:  BIUSBWrapper
Assembly:  BIUSBWrapper (in BIUSBWrapper.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function WriteSPIDAC ( _
	ByRef iDeviceList As DeviceParam, _
	inPort As Byte, _
	ByRef iDataBuffer As DAC_OUTPUTS, _
	inLevel As Byte _
) As Integer
C#
public static int WriteSPIDAC(
	ref DeviceParam iDeviceList,
	byte inPort,
	ref DAC_OUTPUTS iDataBuffer,
	byte inLevel
)

Parameters

iDeviceList
Type: BIUSBWrapper..::.DeviceParam %
A DeviceParam structure. Must contain valid device information returned from call to DetectHID.
inPort
Type: System..::.Byte
Zero based index of output Port to write to.
iDataBuffer
Type: BIUSBWrapper..::.DAC_OUTPUTS %
DAC_OUTPUTS structure containing data to write to the port specified by the inPort parameter. A port supporting 10 DAC or SPI outputs will require a 40-byte buffer, each 32 bits long word corresponding to the data to be written to the corresponding DAC/SPI output. Note that all SPI/DACs on a port are written to at the same time. Writing to a single SPI/DAC is not possible; therefore SPI/DAC buffer data must be updated in iDataBuffer for all SPI/DACs on the specified port.

Actual data length output on a corresponding SPI/DAC channel is determined by the module's capability, not the maximum word length of 32 bits per channel as defined in the DAC_OUTPUTS structure.

inLevel
Type: System..::.Byte
Output level range from 0 to 7. This value sets the pulse width of the backlight if supported.

Return Value

0: If failure writing to device.

>0: if success, returns number of bytes written to device.

See Also