Smart Camera Documentation

Configure existing PLC Server

20 views October 16, 2018 soliton-support 1

NUERA project template offers readily available data server, command server, PLC server, image server in order to exchange different type of information through TCP Communication.

Follow the steps given below to enable PLC server.

Step 1: Enable PLC Server (if not already enabled)
The PLC server can be enabled or disabled by using the definition PLC_SERVER_ENABLED in sys_constants.hpp:

NUERA PLC TCP Server Enable

Step 2: Configure Data Server (if needed)
In TCP, the server listens for connection requests from clients at a specific port. By default, the Port Number for the PLC server is given in sys_constants.hpp . Navigate to file src >> system_configurations >> sys_constants.hpp. Many constants are defined in this header file. Find PLC_SERVER_PORT. By default, it is defined as 7894. This can be changed as per your requirement. Remember that in Step 4, we
will use this port number as the TCP client end to connect to this PLC server. The Buffer Size and Data Timeout of the data server can also be changed in this file:

NUERA PLC TCP Server Buffer Size

Step 3: Update code in the PLC Server Function
Navigate to file src >> application >> application.cpp. Find and open the manage_plc_srvr() . Using this server, we can send control data to a device from NUERA which can be used for applications like starting and stopping of a motor, etc. The PLC server can be enabled or disabled by using the definition PLC_SERVER_ENABLED in sys_constants.hpp . The code is shown below:

NUERA PLC TCP Server Data to be sent

Call the send_data() , passing the character array as first parameter and number of characters
as second parameter, to send this message through the network to the other device using
TCP. The code needs to be added at the location shown below:

NUERA PLC TCP Server application code

Step 4: Observe Output (on Hercules)

Hercules is used here in place of a PLC TCP client. Connect a Windows System to the same network as NUERA. Open Hercules on the Windows System. Go to the TCP Client pane. Set the Module IP as the IP address of the NUERA camera. Set the Port field according to the data port as set in Step 2. Then, click Connect button. After a “Connected” message, the data we are sending from the Nuera camera will be
received by the TCP client and displayed on the screen as shown below:

NUERA PLC TCP Server result

For any further assistance, please contact our application engineer at camera.support@solitontech.com

Was this helpful?