Promotic

PmSBUS - Driver for communication with PLC devices SAIA and DIGIControl by the S-BUS/S-BUS+ protocol

This driver serves for communication by the S-BUS and S-BUS+ protocol. Both protocols are mutually compatible, i.e. it is possible to communicate with S-BUS and S-BUS+ devices simultaneously on one line (e.g. or one RS485 or Ethernet link) using the same driver.
- The S-BUS protocol is used for communication between the PROMOTIC system and the SAIA devices.
- The S-BUS+ protocol is used for communication between the PROMOTIC system and the DIGIControl devices.

Both are the network protocols of the 1Master x nSlave type, where max. 254 Slave stations can be used.

Before using this driver in the PROMOTIC application it is highly recommended to watch "PROMOTIC video tutorial 4 - Communication drivers".

Basic properties of the driver:
- Usage of this driver requires purchase of the PmSBUS licence. When developing the application in the freeware mode PmFree, or with development environment and while testing it in runtime, this component is always functional.
- The communication is done for Ethernet (PROMOTIC application is client) or for serial link (COM1, COM2 ...).
- The PROMOTIC application is the Master (it means that it initiates the data transfer) from this communication point of view.
- The driver is incorporated into the PROMOTIC system by means of the PmaComm object.
The driver supports the usage of both PmaCommMsg and PmaCommGroup objects. For common case of the data transfer, it is better to use the PmaCommGroup object.
For easy integration of this driver into the application it is handy to use: Preconfigurations in group "S-BUS"


Recommended values of the PmaComm object parameters:

Recommended values for the Serial link parameters:
Caution: If the communication uses the RS485 interface, then we recommend the intelligent converter that switches the RTS signal by itself (see Communication drivers).
Baud rateFactory preset to 9600 Bd but it can be increased.
Number data bits8
ParityNO, For Transfer mode=Parity the setup is being dynamically modified.
Number of stop bits1
Recommended values for the Ethernet-client parameters - For SAIA devices:
TCP/UDP remote port number5050 - For "SAIA S-BUS in UDP-frame" data type.
Ethernet transfer typeUDP - For "SAIA S-BUS in UDP-frame" data type.
Recommended values for the Ethernet-client parameters - For DIGIControl devices:
TCP/UDP remote port number
5558 - For "DIGIControl S-BUS TBETH protocol" data type.
5556 - For "The same data as for serial link" data type.
Ethernet transfer typeUDP
Description and recommended values for the Protocol parameters:
Protocol data typeOnly for Ethernet. Specifies the protocol data form. It is possible to choose:
The same data as for serial link - This option can be selected, for example, if the device is equipped with the serial link and it is connected to the Ethernet through the RS232/Ethernet converter. If the converter does no modifications to the transmitted data, then it is a very easy way how to communicate via Ethernet with the device not equipped with Ethernet interface.
If Transfer mode=Parity, then the Ethernet transmission becomes more complicated because the converter can not only convrt the data, but it is also necessary to swith the paritní bit of the serial link side! Some types of data converters can do this, but only if the manufacturer´s software is used for the virtual COM port. This software allows to send the data together with the parity bit switching system commands. In such configuration it is necessary to set the PROMOTIC driver as via the computer's serial port and communicate via the virtual COM port!
SAIA S-BUS in UDP-frame - For SAIA devices. Compared to the data for serial link it contains a special header and it is transferred via Ethernet UDP on port 5050.
DIGIControl S-BUS TBETH protocol - For DIGIControl devices. Compared to the data for serial link it contains a special header (TBETH protocol) and it is transferred via Ethernet UDP on port 5558.
Response receipt timeoutOnly for serial link. The time (in milliseconds) the driver is waiting for the response on sending the message.
If no response comes during this time, then the transmission of the message is terminated (the onEndOfTransfer event is triggered with error 24 or 66).
Transfer modeFor "The same data as for serial link" data type.
1: Parity - In this mode the parity bit is used for the indication of the message beginning flag. In this mode it is the same however the designer sets the parity of the serial link parameters because it is then dynamically changed.
2: Data - is so-called data mode. In this mode the parity bit isn't affected and thus it is possible to transfer this protocol even via phone lines without problems. Since year 2007 every SAIA PLC device supports this.
SBUS address of this applicationFor "DIGIControl S-BUS TBETH protocol" data type.

The communication description by means of the PmaCommGroup object

The PmaCommGroup objects can be used for this driver. For usual data transmissions it is more favourable than using the PmaCommMsg object.
The variables in the PmaCommGroup object (or even better the variables in the PmaData object with ExtComm data extension) can be of arbitrary number, type and order. The driver uses optimalised internal communication messages for reading the data from the device.
All variables are read (if the "Data refresh enabled" configurator is checked). When writing into the variable, only the single variable is sent into the device (if the "Auto send when writing to item" configurator is checked).

Description of the "ItemId" configurator:
ItemId is the text identifier of the item that is used for addressing the item in the device. The "ItemId" configurator tells the driver how to receive or send the item value.
The text can be written manually, or it can be assembled in the window opened by the button to the right of the configurator.
Macro expression can be used for input (it is evaluated after the application is launched).
The ItemId identifier may look like for example "dev2.R33.L", where:
- The 1st part specifies the PLC address (device), to communicate with (dev2 = address 2).
The address 255 represents so-called broadcast, i.e. a message to all devices and is meaningful only for sending data (e.g. sending the current time to all devices simultaneously).
- The 2nd part specifies the type and data address (R33 = register at address 33).
- R = Register SAIA
- Rp = Register DigiControl
- K = RealTimeClock SAIA
- Kp = RealTimeClock DigiControl
- C = Counter SAIA
- T = Timer SAIA
- F = Flag SAIA
- I = Input SAIA
- O = Output SAIA
- S = CPU status SAIA (0-6=CPU Number, 7=Own)
- The 3rd part specifies the data type.
It is defined only for the registers (R, Rp). The addressing unit of the registry is a 4-byte and therefore the varibles with Byte and bit data type are used for read only and a 4-byte index must also be defined (e.g. "dev2.R33.B0").
- R = Real = 4 Byte floating-point
- L = Long = 4 Byte integer
- B = Byte (Read Only)
- b = bit (Read Only)

Description of the "PmaCommGroup > Parameters > Special Parameters" configurator:
Default device addressThe address defined here can be used for definitions in the "ItemId" configurator in variables in this object (i.e. in variables on the "Data" tab or in data extension ExtComm). The address can be entered in ItemId:
- as for example dev1... - then the value will be read from the PLC device with address 1.
- or devD... - the "D" character means default (it means that the address is taken from this configurator).

This parameter can be modified and read in the script in runtime by methods: SetSpecParam("SlaveAddr") and GetSpecParam("SlaveAddr").

The communication description by means of the PmaCommMsg object for PLC devices SAIA (S-BUS)



There is the 1st variable named "Slave" on the "PmaCommMsg > Data-sent" tab. The device address (to which the message has to be sent) is entered (statically or dynamically) into this variable. The address 255 represents so-called broadcast, i.e. a message to all devices and is meaningful only for sending data (e.g. sending the current time to all devices simultaneously).

From the PLC SAIA it is possible to read/write the following data (message types):
- Register: Messages of type "Read/Write Register". By one message it is possible to transfer 32 registers at the most in the continuous range of addresses. Registers can be read/written as:
- as Real: registers are regarded as real numbers with a decimal point.
Items of the Single type are created in the data (1 item for each register).
- as Long: registers are regarded as natural numbers (without the decimal point).
Items of the Long type are created in the data (1 item for each register).
- as 4 Bytes: registers are regarded as a set of bytes (each register represents 4 bytes).
Items of the Byte type are created in the data (4 items for each register).
- as 32 Bits: registers are regarded as a set of bits (each register represents 32 bits).
Items of the Boolean type are created in the data (32 items for each register).
- RealTimeClock: Messages of type "Read/Write RealTimeClock".
The time in the PLC device can be read/written.
1 item of the Date type is created in the data.
- Counter: By one message it is possible to transfer 32 counters at the most in the continuous range of addresses.
Counters can be read/written; they are regarded as natural numbers.
Items of the Long type are created in the data (1 item for each counter).
- Timer: By one message it is possible to transfer 32 timers at the most in the continuous range of addresses.
Timers can be read/written; they are regarded as natural numbers.
Items of the Long type are created in the data (1 item for each timer).
- Flag: By one message it is possible to transfer 32 flags at the most in the continuous range of addresses.
Flags can be read/written; they are regarded as logical values.
Items of the Boolean type are created in the data (1 item for each flag).
- Input: By one message it is possible to transfer 128 inputs at the most in the continuous range of addresses.
Inputs are read only, they are regarded as logical values.
Items of the Boolean type are created in the data (1 item for each input).
- Output: By one message it is possible to transfer 128 outputs at the most in the continuous range of addresses.
Outputs can be read/written, they are regarded as logical values.
Items of the Boolean type are created in the data (1 item for each output).
- CPU Status: Read only. 1 item of the String type is created in the data.
This data hold the value of 1 ASCII char: "S", "H", "R", "C", "D".
- Data Block: It is possible to read/write into the DataBlock area similarly to the register areas. It means that the DataBlock area can be read as real numbers, natural numbers (long), set of bytes or bits.
DataBlocks can be read or written even with a dynamic variable length. Only the maximum number of data is set in the message parameters. The real size of data is then set in the Size variable of the "Data-sent" tab. If this value is set to 0 (or isn't entered at all), then the maximum size is regarded as the real size.

The communication description by means of the PmaCommMsg object for PLC devices DIGIControl (S-BUS+)

There is the 1st variable named "Slave" on the "PmaCommMsg > Data-sent" tab. The device address (to which the message has to be sent) is entered (statically or dynamically) into this variable. The address 255 represents so-called broadcast, i.e. a message to all devices and is meaningful only for sending data (e.g. sending the current time to all devices simultaneously).

The PLC register addressing type DIGIControl it is possible to choose in the message parameter "Register address type":
- as one integer: The register is adressed by one number of the Long type.
This number matches the 4 numbers of the secondary adressing type this way: If the register address is for example 90383 (in decimal), then it equlas to 01610f in hexadecimal. First two digits (01) are Chart, the third digit (6) is Col, the fourth digit (1) is Row and the two last digits (0f) are Item.
- as 4 integer (chart/column/row/item): the register addressing is based on 4 integers:
1) Chart = source program page number
2) Col = column number of requested modul
3) Row = row number of requested modul
4) Item = the modul input/output number. Usually: 1,2,..,8 are inputs, 9,10,..,16 are outputs.
After the adressing type is selected on the "Data-sent" tab one (Addr) variable is generated or four (Chart/Col/Row/Item) variables are generated. The register address must be entered into these variables.

The Bit type registers are transferred as values of the Long type with the bit 0 correctly set. The bit access in the PROMOTIC system can be done by methods PmVar.GetBit / PmVar.SetBit.

From the PLC DIGIControl it is possible to read/write the following data (message types):
- Register: Messages of type "Read/Write SBUS+ Register". By one message it is possible to transfer 32 registers at the most in the continuous range of addresses. Registers can be read/written as:
- as Real: registers are regarded as real numbers with a decimal point.
Items of the Single type are created in the data (1 item for each register).
- as Long: registers are regarded as natural numbers (without the decimal point).
Items of the Long type are created in the data (1 item for each register).
- as 4 Bytes: registers are regarded as a set of bytes (each register represents 4 bytes).
Items of the Byte type are created in the data (4 items for each register).
- as 32 Bits: registers are regarded as a set of bits (each register represents 32 bits).
Items of the Boolean type are created in the data (32 items for each register).
- RealTimeClock: Messages of type "Read/Write SBUS+ RealTimeClock". The time in the PLC device can be read/written.
1 item of the Date type is created in the data.

History:
Pm9.00.25: Fixed bug: Receiving the "CPU Status" in the PmaCommGroup and PmaCommMsg objects did not work.
Pm8.01.01:
- In the PmaCommGroup object, there is a new "Default device address" configurator.
- Generalization for DigiControl Ethernet.
Pm8.00.02: Fixed bug: by the PmaCommGroup object it was unable to write real registers and read flags.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.