LabView Driver

DLN LabView Driver is the LabView Instrument Driver which provides compatible port for operating DLN-series adapters within National Instruments LabView applications. All available instruments can be found inside DlnLibrary.Net.llb.

The DLN LabView Driver is based on dln.net.dll library. DlnLibrary.Net.llb also includes simple examples for each available module of DLN-series adapters.

DLN LabView Driver's components can be easily integrated into any customer applications. All software examples are free and can be modified and expanded by customer. Although you can create your own components to satisfy your specific requirements.

DLN LabView Driver is included to MS Windows DLN setup package

To use DlnLibrary.Net.llb you need to have Windows OS with installed NI LabView 2012 development environment. If you need LabView instrument driver for earlier version, please contact support team at support@diolan.com.
Rating: 
Средняя: 4 (7 оценок)

Components

LabView Driver contains Connectivity, SPI Interface, I2C Interface, GPIO, ADC, PWM, Pulse Counter and UART Interfaces components. Lets look at DLN LabView Driver VI Tree.

vi-tree.png

Connectivity
By using this type of DLN LabView Driver components you can connect to or disconnect from DLN Server; open single connected DLN device or open device by its ID number.
SPI Interface
By using this type of DLN LabView Driver components you can operate with SPI Master and SPI Slave ports by configuring port properties and transferring data via SPI.
I2C Interface
By using this type of DLN LabView Driver components you can operate with I2C Master and SPI Slave ports by configuring port properties and transferring data via I2C interface.
GPIO Interface
By using this type of DLN LabView Driver components you can operate with GPIO pins by configuring pin properties and IO values.
Other Interfaces
This type of DLN LabView Driver components contains PWM, ADC, Pulse Counter and UART interfaces.
Rating: 
Средняя: 4.2 (5 оценок)

ADC, PWM, UART and Pulse Counter Components

DlnAdcPort.vi

Component for opening ADC port, which can be configured and used by user.

labview-adcport.png

Input connectors:

reference Dln.Device, dln.net
port index ADC port number
channel index ADC channel number
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

port get_Item     Dln.Adc.Port, dln.net 
channel get_Item  Dln.Adc.Channel, dln.net
error out Output connector with error information wired from the VI previously called.

 

DlnPwmPort.vi

Component for opening PWM port, which can be configured and used by user.

labview-pwmport.png

Input connectors:

reference Dln.Device, dln.net
port index PWM port number
channel index PWM channel number
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

port get_Item       Dln.Pwm.Port, dln.net
channel get_Item Dln.Pwm.Channel, dln.net
error out Output connector with error information wired from the VI previously called.

 

DlnUartPort.vi

Component for configuring UART port.

labview-uartport.png

Input connectors:

reference Dln.Device, dln.net
port index UART port index
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

port get_Item Dln.Uart.Port, dln.net      
error out Output connector with error information wired from the VI previously called.

 

DlnPulseCounterPort.vi

Component for configuring Pulse Counter port.

labview-pulsecounterport.png

Input connectors:

reference Dln.Device, dln.net
port index Pulse Counter port index
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

port get_Item Dln.PulseCounter.Port, dln.net
error out Output connector with error information wired from the VI previously called.

 

Rating: 
Средняя: 1.5 (2 оценок)

Connectivity

Connectivity components serves for device initialization and connecting operations.

DlnConnect.vi

Component for connecting to DlnServer service. This component should be run first before any other operations with DLN-series adapter.

labview-connect.png

Input connectors:

host DLN Server valid host. By default host is "localhost".
port DLN Server valid port. By default port is "9656".
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

reference out Dln.Library output reference.
Connect Dln.Connection, dln.net.
error out Output connector with error information wired from the VI previously called.
DlnDisconnect.vi
Component for closing connection with DlnServer service. Also closes reference for .NET object, which was opened and used by DlnConnect VI component.
labview-disconnect.png

Input connectors:

reference Dln.Library, dln.net
connection Dln.Connection, dln.net
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

error out Output connector with error information wired from the VI previously called.

 

DlnOpenDevice.vi
This component opens connection with the single connected device.
labview-opendevice.png

Input connectors:

error in Input connector excepts error information wired from the VI previously called.

Output connectors:

Open Dln.Device, dln.net
error out Output connector with error information wired from the VI previously called.

 

DlnOpenDeviceById.vi
This component opens device by ID number, which can be assigned and changed by user.
labview-opendevicebyid.png

Input connectors:

id ID number to be set to connected DLN-series device.
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

OpenById Dln.Device, dln.net
error out Output connector with error information wired from the VI previously called.

 

Rating: 
Средняя: 2 (1 оценка)

GPIO Interface Component

Rating: 
Средняя: 3 (6 оценок)

I2C Interface

I2C Interface components help to operate with I2C Master and I2C Slave ports by configuring port properties and transferring data.

DlnSpiMasterPort.vi

Component for opening I2C Master port which can be configured and used by user.

labview-i2cmasterport.png

Input connectors:

reference Dln.Device, dln.net
port index I2C Master port number
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

port get_Item Dln.I2cMaster.Port, dln.net
error out Output connector with error information wired from the VI previously called.

 

DlnI2cSlavePort.vi

Component for opening I2C Slave port which can be configured and used by user. This component will operate correctly only with DLN-4S adapter.

labview-i2cslaveport.png

Input connectors:

reference Dln.Device, dln.net
port index I2C Slave port number
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

port get_Item Dln.I2cSlave.Port, dln.net
error out Output connector with error information wired from the VI previously called.

 

Rating: 
Средняя: 1.5 (2 оценок)

SPI Interface

SPI Interface components help to operate with SPI Master and SPI Slave ports by configuring port properties and transferring data.

DlnSpiMasterPort.vi

Component for opening SPI Master port which can be configured and used by user.

labview-spimasterport.png

Input connectors:

reference Dln.Device, dln.net
port index SPI Master port number
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

port get_Item Dln.SpiMaster.Port, dln.net
error out Output connector with error information wired from the VI previously called.

 

DlnSpiSlavePort.vi

Component for opening SPI Slave port which can be configured and used by user. This component will operate correctly only with DLN-4S adapter.

labview-spislaveport.png

Input connectors:

reference Dln.Device, dln.net
port index SPI Slave port number
error in Input connector excepts error information wired from the VI previously called.

Output connectors:

port get_Item Dln.SpiSlave.Port, dln.net
error out Output connector with error information wired from the VI previously called.

 

Rating: 
Средняя: 2.4 (7 оценок)

Examples

In addition to interfaces components, DLN LabView Driver contains some simple examples. Examples demonstrate the principle of interfaces components usage, such as handling events, properties and methods calling.

Rating: 
Средняя: 2 (1 оценка)

AdcExample.vi

AdcExample.vi demonstrates how to set and get properties values of ADC port and its channels.

Application Block Diagram is shown below.

adc-example.png

All components are connected sequentially and all error inputs and outputs should be connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. DlnAdcPort.vi gets Dln.Device reference and port number as inputs and we get Dln.Adc.Port and Dln.Adc.Channel references as outputs. Connect Dln.Adc.Port and Dln.Adc.Channel references outputs to Property Nodes. To add Port or Channel properties right-click on Port Property Node choose Add Element, then right click again on the new element and choose "Select Property" list. After property is added you can change property to read or write also by right-clicking on property element.

After all operations with ADC module are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 3 (2 оценок)

DeviceRemovedEventExample.vi

DeviceRemovedEventExample.vi shows how to use events. While example execution, application is waiting for events and message is shown, if event is raised.

Application Block Diagram is shown below.

deviceremovedevent-example.png

All components are connected sequentially and all error inputs and outputs should be connected. First, we call DlnConnect.vi component with port and host values as inputs. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. Next we call Register Event Callback function and connect Dln.Device reference to Register Event Callback function reference input and choose event (in our case it is DeviceRemoved event). Our next step is to create callback function, which will contain code, that should be executed in case of event is raised. Connect callback function to VI reference input of Register Event Callback function.

Callback function DeviceRemovedCallback.vi is shown below.

deviceremovedevent-callback.png

By default, callback function contains Event Common Data, Control Ref, Event Data and User Parameter. For our example we added One Button Dialog with message "Device was removed!". So when event is raised we'll see this message.

device-removed-message.png

To make possible waiting for event, While Loop was added with interval of 100 ms and stop button. If you press stop button application will close. After application is closed, we should call Unregister For Events and Close Reference functions. with unregister all events associated with event registration refnum and close Dln.Device reference accordingly. Finally DlnDisconnect.vi is called, which closes connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1 (2 оценок)

GetVersionExample.vi

GetVersionExample.vi demonstrates how to retreive information about hardware, library, server and firmware versions.

Application Block Diagram is shown below.

getversion-example.png

All components are connected sequentially and all error inputs and outputs are connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, it opens any connected DLN-series device and returns its reference. Add Property Node and connect Dln.Device reference output from DlnOpenDevice.vi. To add Device properties right-click on Property Node and choose "Add Element", then right-click again on the new element and choose "Select Property" and click property name to add it. After property is added you can change property to read or write by right-clicking on property name and choosing correct operation. You can read "Hardware Type", "Hardware Version", "Library Version", "Server Version" and "Firmware Version" properties.

After all operations are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1.5 (2 оценок)

GpioExample.vi

GpioExample.vi demonstrates how to set and get properties values of GPIO pins.

Application Block Diagram is shown below.

Labview GPIO example

All components are connected sequentially and all error inputs and outputs should be connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. DlnGpioPin.vi gets Dln.Device reference and pin number index as inputs and we get Dln.Gpio.Pin reference as output. Connect Dln.Gpio.Pin reference output to Property Node. To add Pin properties right-click on Property Node function and choose Add Element, then right click again on the new element and choose "Select Property" list. After property is added you can change property to read or write also by right-clicking on property element.

After all operations with ADC module are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1 (1 оценка)

I2cMasterExample.vi

I2cMasterExample.vi demonstrates how to set and get properties values of I2C Master port and call methods for transferring data through I2C Master nterface.

Application Block Diagram is shown below.

i2c-master-example.png

All components are connected sequentially and all error inputs and outputs should are connected.

First, we call DlnConnect.vi component and connect to proper inputs port and host values.

Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device.

DlnI2cMasterPort.vi gets Dln.Device reference and I2C port index number as inputs and we get Dln.I2cMaster.Port reference as output. Connect Dln.I2cMaster.Port reference output to Property Node to configure properties. To add port properties right-click on Port Property Node, choose Add Element, then right-click again on the new element and choose "Select Property" list. After property is added you can change property to read or write by right-clicking on property element. Connect Dln.I2cMaster.Port reference output to Invoke Node to execute available methods.

In this example Write method is called with slaveDeviceAddress and Data parameter as inputs.

After all operations with I2C Master module are done, close Dln.Device reference by calling Close Reference component. Finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1 (1 оценка)

I2cSlaveExample.vi

I2cSlaveExample.vi demonstrates how to set and get properties values of I2C Slave port and call methods for transferring data through I2C Slave Interface.

Application Block Diagram is shown below.

i2c-slave-example.png

All components are connected sequentially and all error inputs and outputs are connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. DlnI2cSlavePort.vi gets Dln.Device reference and port index number as inputs and we get Dln.I2cSlave.Port reference as output. Connect Dln.I2cSlave.Port reference output to Property Node to configure properties. To add Port properties right-click on Port Property Node choose Add Element, then right click again on the new element and choose "Select Property" list. After property is added you can change property to read or write also by right-clicking on property element. Connect Dln.I2cSlave.Port reference output to Invoke Node to execute available methods. In this example Write method is called with slave device address and data parameters.

After all operations with I2C Slave module are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1 (1 оценка)

PulseCounterExample.vi

PulseCounterExample.vi demonstrates how to set and get properties values of Pulse Counter port.

Application Block Diagram is shown below.

pulsecounter-example.png

All components are connected sequentially and all error inputs and outputs should be connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. DlnPulseCounterPort.vi gets Dln.Device reference and port number as inputs and we get Dln.PulseCounter.Port reference as output. Connect Dln.PulseCounter.Port reference output to Property Nodes. To add Port or Channel properties right-click on Port Property Node and choose Add Element, then right-click again on the new element and choose "Select Property". After property is added, you can change property to read or write by right-clicking on property name.

After all operations with Pulse Counter module are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1 (1 оценка)

PwmExample.vi

PwmExample.vi demonstrates how to set and get properties values of Pwm port and its channels.

Application Block Diagram is shown below.

pwm-example.png

All components are connected sequentially and all error inputs and outputs should be connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. DlnPwmPort.vi gets Dln.Device reference and port number as inputs and we get Dln.Pwm.Port and Dln.Pwm.Channel references as outputs. Connect Dln.Pwm.Port and Dln.Pwm.Channel references outputs to Property Nodes. To add Port or Channel properties right-click on Port Property Node choose Add Element, then right click again on the new element and choose "Select Property" list. After property is added you can change property to read or write also by right-clicking on property element.

After all operations with PWM module are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 2 (1 оценка)

SetDeviceIdExample.vi

SetDeviceIdExample.vi demonstrates how to set and retrieve connected DLN-series adapter ID number.

Application Block Diagram is shown below.

setdeviceid-example.png

It is seen that all components are connected sequentially and all error inputs and outputs are connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, it opens any connected DLN-series device and returns its reference. Add Property Node and connect Dln.Device reference output from DlnOpenDevice.vi. To add Device properties right-click on Property Node and choose "Add Element", then right-click again on the new element and choose "Select Property" and click property name to add it. After property is added you can change property to read or write by right-clicking on property name and choosing correct operation. After ID property is added you can assign new ID value or retrieve current.

After all operations are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with DLN Server and Dln.Library reference.

Rating: 
Средняя: 1 (1 оценка)

SpiMasterExample.vi

SpiMasterExample.vi demonstrates how to set and get properties values of Spi Master port and call methods for transferring data through SPI Master nterface.

Application Block Diagram is shown below.

spi-master-example.png

All components are connected sequentially and all error inputs and outputs should be connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. DlnSpiMasterPort.vi gets Dln.Device reference and port index number as inputs and as output we get Dln.SpiMaster.Port reference. Connect Dln.SpiMaster.Port reference output to Property Node to config properties. To add Pin properties right-click on Port Property Node choose Add Element, then right click again on the new element and choose "Select Property" list. After property is added you can change property to read or write also by right-clicking on property element. Connect Dln.SpiMaster.Port reference output to Invoke Node to excecute available methods. In this example ReadWrite method is called.

After all operations with ADC module are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1 (1 оценка)

SpiSlaveExample.vi

SpiSlaveExample.vi demonstrates how to set and get SPI Slave port properties values and call methods for transferring data through SPI Slave Interface.

Application Block Diagram is shown below.

spi-slave-example.png

All components are connected sequentially and all error inputs and outputs should be connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. DlnSpiSlavePort.vi gets Dln.Device reference and port index number as inputs and we get Dln.SpiSlave.Port reference as output. Connect Dln.SpiSlave.Port reference output to Property Node to configure properties. To add Port properties right-click on Port Property Node choose Add Element, then right click again on the new element and choose "Select Property" list. After property is added you can change property to read or write also by right-clicking on property element. Connect Dln.I2cSlave.Port reference output to Invoke Node to execute available methods. In this example LoadReply method is used.

After all operations with SPI Slave module is done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1 (2 оценок)

UartExample.vi

UartExample.vi demonstrates how to set and get properties values of UART port and call methods for transferring data through UART interface.

Application Block Diagram is shown below.

uart-example.png

All components are connected sequentially and all error inputs and outputs should are connected. First, we call DlnConnect.vi component and connect to proper inputs port and host values. Then we call DlnOpenDevice.vi component, which opens any connected DLN-series device. DlnUartPort.vi gets Dln.Device reference and port index number as inputs and we get Dln.Uart.Port reference as output. Connect Dln.Uart.Port reference output to Property Node to configure properties. To add port properties right-click on Port Property Node, choose Add Element, then right click again on the new element and choose "Select Property" list. After property is added you can change property to read or write by right-clicking on property element. Connect Dln.Uart.Port reference output to Invoke Node to execute available methods. In this example Write method is called with buffer parameter as input.

After all operations with UART module are done, close Dln.Device reference and finally call DlnDisconnect.vi to close connection with Dln Server and Dln.Library reference.

Rating: 
Средняя: 1 (1 оценка)

Handling Events

All DLN-series adapters, except of DLN-1 device, support event-driven interface, which can be also used within LabView environment.

Use Register Callback Event for registering events from .NET library reference. Registers a VI to be called when an event occurs. This function is used to register and handle .NET events. LabView uses the type of the input reference wired to each item to determine the events for which you can register.

register-event-callback.png

To get Register Callback Event function, right-click on Block Diagram and navigate to Connectivity > .NET palette. More detailed information on how to use events can be found at DeviceRemovedEvent example section or NI LabView help.

Rating: 
Средняя: 1 (1 оценка)

Invoking Properties and Methods

By using DLN LabView Driver Components you are able to get references for modules port, channel and pin. To set and get properties or execute methods we should use Property Node and Invoke Node, which are LabView internal components.

Property Node gets(reads) and/or sets(writes) properties of the reference.

property-node.png

Invoke Node invokes methods or actions. Most methods have associated parameters.

invoke-node.png

To get these functions, right-click on Block Diagram and navigate to Connectivity > .NET palette. More detailed information on how to use properties and methods can be found at Examples section.

Rating: 
Средняя: 1 (3 оценок)