KB-30951: Generic XObject with I/O Driver.

Question:

How can I create a “generic” XObject with a Modbus Driver, so that the Driver’s IP address and the Ethernet communication port can be configured when instancing the XObject?

Solution:

To do so, you must create an XObject and add a Modbus Driver to it.

Then, on the Setup tab of the driver’s Extra Settings, check the Start driver OFFLINE option and set up the communication as Ethernet.

In the XObject, you must create a String property named IP and an Integer property named Port. In the I/O driver’s AfterStart event, set up these properties as the IOKit’s corresponding properties:

  • IO.Ethernet.MainIP, receiving values from the tag with the IP address;
  • IO.Ethernet.MainPort, receiving values from the tag with the port address.

In addition to that, since the Driver starts offline, you must start it setting one to the IOKit’s IO.WorkOnline tag. The script will look like this:

Item(“IO.Ethernet.MainIP”).Value = Parent.IP
Item(“IO.Ethernet.MainPort”).Value = Parent.Port
Item(“IO.WorkOnline”).Value = 1

NOTE: The attached demo application was developed with Elipse E3 version 3.1 build 270.

Attachments:

KB-30951.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *