PLC
The PLC module is a Special module used to interact with programmable logic controllers (PLC). These industry grade CPUs are used in controlling machines and plants. They typically allow to write/read certain registers or datablocks using a variety of protcols.
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 csv file. When saving the table all fields will be saved again in a csv file. Thus, the csv file contains the general description of all readable/writable addresses in the PLC.
Via right-click menu you can read from or write to single values to the selected PLC address for testing purposes.
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 csv file.
Register columns
- Variable: mandatory, the name of the parameter as shown in SweepMe!
- Unit: optional, the unit related to the variable
- Internal name: optional, the tag name of the register, address or datablock as defined in the PLC setup software. 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.
- Parameter: optional, a field to enter a parameter using the Parameter system in order to write a value to the PLC whenever the parameter changes.
- 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 delimited as 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
- 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.
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
- returns a bool (True/False)
- writable/readable by default
Discrete Inputs "1xxxx"
- all registers, starting with 1
- returns a bool (True/False)
- only readable by default
Input registers "3xxxx"
- all registers, starting with 3
- 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
- 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.