How do I get a netHOST started across the API of the Windows DLL?

Q

How do I get a netHOST started across the API of the Windows DLL?

A

1.) To open the driver the function xDriverOpen() needs to be called first.

2.)To search for available netHOST devices and getting back a handle to them the function xDriverEnumBoards() needs to be called afterwards.

The function needs to be called until it returns a value unequal CIFX_NO_ERROR to enumerate through all boards.

For each device reachable across the driver the function returns you a handle to a structure named BOARD_INFORMATION.

In this structure you find the most relevant value abBoardName[ ] which is a text string, that is being used later for subsequent calls.

3.) Since each netHOST device consist of multiple communcation channels (up to 4 is possible with the used netX network controller chip) you may enumerate as next through the devices with the function xDriverEnumChannels() to get back the information of their channels and protocol stacks in use.Calling this function is not necessary, but very informative in cases you want to print out this information to users.

The function needs to be called until it returns a value unequal CIFX_NO_ERROR to enumerate through all boards.

The function returns a handle to a structure named CHANNEL_INFORMATION for each device reachable across the driver.

 

A netHOST is occupying a communication channel for the TCP/IP LAN interface, one for the Real-Time Ethernet or Fieldbus network depending on the model and one for adminitrative purposes.

The most relevant channel number to continue accessing a netHOST are the following:

For netHOST PROFIBUS Master, CANopen Master and DeviceNet Master the fieldbus communciation channel number is : 1

For netHOST PROFINET Controller, EtherCAT Master and EtherNet/IP Scanner the Real-Time Ethernet communication channel number is : 0

4.) To get in touch with the communication channel you have to call xChannelOpen() function as next. As parameter use the abBoardName and the given channel number in 3.) depending on the device model in use.

5.) Since a netHOST by default is configured to wait for an application to start the subordinate communication (RTE or FB) channel, the function xChannelHostState() has to be called at the end. The value CIFX_HOST_STATE_READY signals a netHOST to start the channel. You should see netHOST then starting network activities in the Real-Time Ethernet or Fieldbus side.