PLC
The PLC module is a Special module used to interact with programmable logic controllers (PLC). These industry grade CPUs are used for controlling machines and plants. They typically allow to write/read certain registers or datablocks using a variety of protocols.
Handling
After selecting the protocol, such as "Modbus TCP", you can enter the Port for communication and enter protocol-related options. Then, you can already begin to fill the table of registers. Either add rows on your own via right-click menu or load a CSV file. When saving the table all fields will be saved again in the specified CSV file. Thus, the CSV file contains the general description of all readable/writable addresses in the PLC and can be used to qucikly restore a machine-register description.
Via right-click menu you can read or write single values from ot to the selected PLC address for testing purposes. During a Run you can set fixed values or use the curly parameter syntax to change values dynamically.
You can click the button "File" at the right top of the Register Table to load, reload, and save the CSV file. You can also use "New" to create an empty table or open the current active CSV file in an editor, or quickly find the folder of the CSV file.
Register columns
- Variable: mandatory, the name of the parameter as shown in SweepMe!
- Unit: optional, the unit related to the variable
- Machine Tag: optional, the tag name of the register, address or datablock as defined in the PLC setup software or your electrical machine plan. Only used as a reference.
- Address: mandatory, the number of the register or a string specifying an address or node. This will be used to read/write a parameter.
- Data Type: mandatoy, the data type, e.g. BOOL, INT or REAL as which the retrieved data is interpreted.
- Set Value: optional, a field to enter a fixed value or a parameter using the Parameter system in order to write a value to the PLC whenever the parameter changes during the run. This informaton is not saved to the CSV file but written to the setting file as the CSV file only contain machine and protocol related information.
- Comment: optional, just a comment that helps you to understand the meaning of the register/address.
You can add empty lines to structure your registers into meaningful blocks. They will be omitted later on.
CSV file
The register table is represented by a csv file that helps you to reload all registers when you add a new PLC module. The csv file format of the PLC module uses a comma as cell delimiter.
You can use programs like Microsoft Excel, Google Sheets, or Libre Office Calc to fill these files and load them with the PLC module for faster processing or to programmactically create these files. Please note that regional settings must match the comma as delimiter because otherwise the file will be for example saved with semicolon.
Attention: Register addresses starting with 0 like "0xxxx" should be treated as Text not as number. Otherwise the leading zeros might be lost during saving the file and some protocols cannot handle the address correctly anymore, as in case of Modbus.
Protocols
Modbus
Basically, all sensors, actuators, and controllers can be connected with the PLC module if they support the Modbus protocol. So, not only PLCs are supported.
Options
- Port:: Please enter the IP address of the PLC or Modbus device with format "xxx.xxx.xxx.xxx", e.g. "192.168.0.1". The TCP port is set to 502 by default and cannot be changed right now.
- Start register: Some PLCs start counting registers from 0 and other from 1. The default is 0. If you see that all readings are off by 1 address, then changing the Start register might help.
So far, Big Endian is used for Word Order and Byte Order. Other options can be added in future.
Data types
The user must specify as which data type the readout register should be interpreted. Supported are:
- INT (2 bytes, 1 register)
- UINT (2 bytes, 1 register)
- WORD (2 bytes, 1 register)
- BOOL (first bit, 1 register)
- REAL (4 bytes, 2 register)
Register address regions
The PLC module will automatically read/write different register address regions based on the starting index of the register address. It can handle 5-digit as defined by Modbus but also 6-digit register addresses as used in some PLCs.
Coils "0xxxx"
- all registers, starting with 0
- Supported Data Type: BOOL
- returns a bool (True/False)
- writable/readable by default
Discrete Inputs "1xxxx"
- all registers, starting with 1
- Supported Data Type: BOOL
- returns a bool (True/False)
- only readable by default
Input registers "3xxxx"
- all registers, starting with 3
- Supported Data Type: INT, UINT, WORD, REAL
- returns different data types as defined by the user (INT, UINT, WORD, REAL)
- only readable by default
Holding registers "4xxxx"
- all registers, starting with 4
- Supported Data Type: INT, UINT, WORD, REAL
- returns different data types as defined by the user (INT, UINT, WORD, REAL)
- writable/readable by default
OPCUA
planned, but not yet available. Please contact us at contact@sweep-me.net if you like to use it.