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.
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.
Component for opening ADC port, which can be configured and used by user.
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. |
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. |
Component for opening PWM port, which can be configured and used by user.
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. |
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. |
Component for configuring UART port.
reference | Dln.Device, dln.net |
---|---|
port index | UART port index |
error in | Input connector excepts error information wired from the VI previously called. |
port get_Item | Dln.Uart.Port, dln.net |
---|---|
error out | Output connector with error information wired from the VI previously called. |
Component for configuring Pulse Counter port.
reference | Dln.Device, dln.net |
---|---|
port index | Pulse Counter port index |
error in | Input connector excepts error information wired from the VI previously called. |
port get_Item | Dln.PulseCounter.Port, dln.net |
---|---|
error out | Output connector with error information wired from the VI previously called. |
Connectivity components serves for device initialization and connecting operations.
Component for connecting to DlnServer service. This component should be run first before any other operations with DLN-series adapter.
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. |
reference out | Dln.Library output reference. |
---|---|
Connect | Dln.Connection, dln.net. |
error out | Output connector with error information wired from the VI previously called. |
reference | Dln.Library, dln.net |
---|---|
connection | Dln.Connection, dln.net |
error in | Input connector excepts error information wired from the VI previously called. |
error out | Output connector with error information wired from the VI previously called. |
---|
error in | Input connector excepts error information wired from the VI previously called. |
---|
Open | Dln.Device, dln.net |
---|---|
error out | Output connector with error information wired from the VI previously called. |
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. |
I2C Interface components help to operate with I2C Master and I2C Slave ports by configuring port properties and transferring data.
Component for opening I2C Master port which can be configured and used by user.
reference | Dln.Device, dln.net |
port index | I2C Master port number |
error in | Input connector excepts error information wired from the VI previously called. |
port get_Item | Dln.I2cMaster.Port, dln.net |
error out | Output connector with error information wired from the VI previously called. |
Component for opening I2C Slave port which can be configured and used by user. This component will operate correctly only with DLN-4S adapter.
reference | Dln.Device, dln.net |
port index | I2C Slave port number |
error in | Input connector excepts error information wired from the VI previously called. |
port get_Item | Dln.I2cSlave.Port, dln.net |
error out | Output connector with error information wired from the VI previously called. |
SPI Interface components help to operate with SPI Master and SPI Slave ports by configuring port properties and transferring data.
Component for opening SPI Master port which can be configured and used by user.
reference | Dln.Device, dln.net |
port index | SPI Master port number |
error in | Input connector excepts error information wired from the VI previously called. |
port get_Item | Dln.SpiMaster.Port, dln.net |
error out | Output connector with error information wired from the VI previously called. |
Component for opening SPI Slave port which can be configured and used by user. This component will operate correctly only with DLN-4S adapter.
reference | Dln.Device, dln.net |
port index | SPI Slave port number |
error in | Input connector excepts error information wired from the VI previously called. |
port get_Item | Dln.SpiSlave.Port, dln.net |
error out | Output connector with error information wired from the VI previously called. |
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.
AdcExample.vi demonstrates how to set and get properties values of ADC port and its channels.
Application Block Diagram is shown below.
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.
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.
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.
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.
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.
GetVersionExample.vi demonstrates how to retreive information about hardware, library, server and firmware versions.
Application Block Diagram is shown below.
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.
GpioExample.vi demonstrates how to set and get properties values of GPIO pins.
Application Block Diagram is shown below.
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.
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.
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.
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.
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.
PulseCounterExample.vi demonstrates how to set and get properties values of Pulse Counter port.
Application Block Diagram is shown below.
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.
PwmExample.vi demonstrates how to set and get properties values of Pwm port and its channels.
Application Block Diagram is shown below.
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.
SetDeviceIdExample.vi demonstrates how to set and retrieve connected DLN-series adapter ID number.
Application Block Diagram is shown below.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Invoke Node
invokes methods or actions. Most methods have associated parameters.
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.