EasyIOConfig (Easy IO Config)
Purpose
Configure and open an NI-DNET Interface Object and multiple NI-DNET I/O Objects.
Format
LabVIEW
C
Not applicable
Input
Interface Name | Name of DeviceNet interface |
Device Configurations
DeviceMacId |
Array of I/O Object configuration clusters MAC ID of the remote device Type of I/O connection Number of input bytes Number of output bytes Expected rate of I/O message (packet) production |
Interface Configuration
IntfMacId |
Interface Object configuration cluster MAC ID of the DeviceNet interface Baud rate Communication scheme for all polled I/O connections |
Output
Interface ObjHandle Out | Object handle you use with all subsequent function calls for the Interface Object |
Device ObjHandle Out | Array of object handles you index to reference a particular I/O Object |
Error out | NI-DNET Error Cluster output |
Function Description
EasyIOConfig configures, opens, and starts an Interface and multiple I/O Objects, and returns object handles for the newly created objects.
Internally, the EasyIOConfig function makes use of ncOpenDnetIntf, ncOpenDnetIO, ncOperateDnetIntf, and ncWaitForState. If you are not familiar with the input clusters mentioned above, refer to ncOpenDnetIntf and/or ncOpenDnetIO parameter descriptions before reading this section. For more details on any of these functions, refer to the corresponding function descriptions.
Use EasyIOConfig to open multiple devices (I/O connections) with one VI call. This high-level function accepts Interface Configuration and an array of Device Configurations as its inputs. The Device Configurations can contain any number of I/O connections that you want to open. Remember, however, that you can only have one instance of a particular connection per device. For example, you cannot open two poll connections on the same device. Similarly, opening COS and cyclic connections simultaneously on a device will result in an error, since these two connections are mutually exclusive.
The relationship between expected packet rate (EPR) and the PollMode parameter of the Interface Object is the same as discussed in the ncOpenDnetIntf and ncOpenDnetIO function descriptions. For example, if you configure the Interface Object in Scanned mode, you must configure all the strobe connections with the same EPR and all the poll connections with either the same EPR value or an integer multiple of it. If this is not the case, you will see an Inconsistent Parameter error.
Since the EasyIOConfig function also starts the interface, a call to ncOperateDnetIntf (for Start) is only needed if the communication needs to be interrupted in the middle of your application to set some driver attributes for an object. To do so, call ncOperateDnetIntf with Stop as the Opcode after calling EasyIOConfig, make necessary calls to ncSetDriverAttr, and then call ncOperateDnetIntf with Start as the Opcode to restart the communication.
To open an Explicit Messaging Object, call ncOpenDnetExplMsg separately after a call to EasyIOConfig.
Note For any NI-DNET LabVIEW application, make sure that all the open calls are matched by an equal number of close calls. For example, if you have called the Open DeviceNet Interface function twice, you must call the Close Object function twice as well, passing in the handles returned from the open interface calls. Also, to ensure proper closure of all NI-DNET objects, create your own stop button to stop your application, instead of using the LabVIEW stop button from the menu bar. |
Parameter Descriptions
Interface Name
Description | Name of the DeviceNet interface as an ASCII string with format "DNETx", where x is a decimal number starting at zero that indicates which DeviceNet interface is being used. You associate DeviceNet interface names with physical ports using Measurement and Automation Explorer (MAX). |
Values | "DNET0", "DNET1", ... "DNET31" In LabVIEW, you select the interface name from an enumerated list. |
Device Configurations
Description | Array of NI-DNET I/O Object configuration clusters. For a description of individual elements within the I/O cluster, refer to the ncOpenDnetIO parameter description. |
Values | Refer to the ncOpenDnetIO input parameters description for value range applicable to each configuration parameter. |
Interface Configuration
Description | Configuration cluster for NI-DNET Interface Object. For a description of individual elements within the interface cluster, refer to the ncOpenDnetIntf parameter description. |
Values | Refer to the ncOpenDnetIntf input parameters description for allowed values for each cluster element. |
Interface ObjHandle Out
Description | If the Easy IO Config function is successful, a handle to the newly opened Interface Object is returned in Interface ObjHandle Out. This handle is used with all subsequent function calls for that Interface Object. |
Values | The encoding of object handles is internal to NI-DNET. |
Device ObjHandle Out
Description | If the Easy IO Config function is successful, an array of I/O Object handles is returned in Device ObjHandle Out. This array can be indexed to retrieve individual I/O handles for data read and write. |
Values | The encoding of object handles is internal to NI-DNET. |
Examples
LabVIEW
Open Interface Object "DNET0" using baud rate 125000, MAC ID 5, and poll mode Scanned. Open two I/O Objects, with MAC ID 6 and 9, and start the communication.