Before we start, some clarification of terminology for this section:
Port: either a serial (RS 232/422/485) port, or an Ethernet IP address / port.
Protocol: the language used to communicate with your device. For example, ModbusRTU.
Comm device: a DAQFactory device that you create by selecting a port and a protocol.
In order to do any sort of communications with external devices connected over the serial port or Ethernet, you have to create a comm device. A comm device is like any other device within DAQFactory and can be selected from the channel table. To create a new comm device, go to the device configuration window by selecting Quick - Device Configuration from the DAQFactory main menu. A list of devices will appear along with New Serial (RS232/485) / Ethernet (TCP/IP) device. Click on this and hit Select to add a new comm device.
First you'll need to name your device. The name, like most DAQFactory names, must begin with a letter and only contain letters, numbers, or the underscore. You'll see below the name are two lists, one with the ports, which will likely be empty, and the other with protocols. Next you'll need to create a new port. To do so, click either on New Serial, New Ethernet Client (TCP), or New Ethernet Server depending on the type of port you need. Each of these buttons will open a new window to allow you to specify the port parameters. For all port types, you will need to name your port as well. This is so you can use the port for more than one protocol.
Connection Name: a valid DAQFactory name for your port. This can be as simple as COM1 or whatever you prefer.
Serial Port #: the comm port number. This should be a valid comm port on your computer. For example "1" for COM1. Make sure another program is not using the port. To create a placeholder port, use serial port # 0. This will create the port so you can assign it to a device, but will not initialize the port. Then when you are ready, you can change the port # and parameters from a sequence to start using it.
Baud: the baud rate for communications on the comm port. This and the next three items are the standard serial port parameters. Check the documentation for the device you are connecting to for the proper settings. If these parameters are incorrect you will either get no communications or garbled communications. The improper setting of these parameters is the most common difficulty with serial communications. The baud can be selected from a list of standard bauds, or in the rare case that you are using a non-standard baud rate, you can manually enter your desired baud rate in the field.
Byte Size: the number of bits per byte used in communications.
Parity: the type of parity bit used in communications.
Stop Bits: the number of stop bits used in communications.
Timeout: the number of milliseconds to wait for a read / write request to complete. This will depend on the response time of your device. We recommend keeping this between 20 and 2000 milliseconds. Longer timeouts are appropriate when working with slow devices or low baud rates, but will result in a latency in a comm failure condition.
Note: if using the Timing parameter of a channel or the wait() function in the polling loop of your serial communications, make sure the timeout is set smaller than the loop time or a backlog of requests will occur in a comm failure condition. For this reason we typically recommend using the delay() function over wait() in serial polling loops. With channel Timing, you will eventually get a Timing Lag error, which is not serious, but an indicator that the things are running slower than you'd hoped.
Flow Control Type: determines the type of flow control used for communications. Flow control is the use of extra serial lines or codes to allow the device and the PC to control the speed of communications. Flow control has become less and less common as the speed of external devices has improved. Check the documentation for your device for the proper setting. Hardware uses the standard hardware flow control methods. None does not use any flow control. If only three wires of your serial device are used, then this is the correct setting unless your device uses Xon/Xoff. The three wires would then be Tx, Rx, and ground. Manual uses the settings of the other 5 parameters listed next.
Flow Control Parameters: for the proper setting of these parameters, please review the documentation of your remote device. In general these settings are not required. They are only used when Type is set to Manual.
Connection Name: a valid DAQFactory name for your port.
IP Address: (applies to Ethernet Clients only) the IP address of the remote device. Depending on your network setup, you may be able to use an URL as well. To create a placeholder port, set this to a blank string. This will create the port so you can assign it to a device, but will not initialize the connection. Then when you are ready, you can change the IP address and parameters from a sequence to start using it.
Port: the IP port to connect to. For example, you would use 80 to connect to a web server. For the Ethernet Server, this is the port to listen on for new connections. Note that DAQFactory only supports one connection per port for the server.
Timeout: the number of milliseconds to wait for a read / write request to complete. This will depend on the response time of your device. We recommend keeping this between 20 and 2000 milliseconds. Longer timeouts are appropriate when working with slow devices or modem Ethernet, but will result in a latency in a comm failure condition. Please see the note above concerning polling loops and timeout.
Note: In most cases you will use Ethernet Client and not Ethernet Server, and typically the TCP version as only a few devices use UDP. Ethernet Server would typically be used for ModbusTCP slave, or to create your own networking within DAQFactory.
Note: Ethernet Server is only available in DAQFactory Pro and higher.