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 оценка)