Promotic
WikipediaLinkedInYoutubeTwitterFacebook

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

This driver is used for communication with 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 determined for the communication between the PROMOTIC system and the SAIA devices.
- The S-BUS+ protocol is determined for the 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 read the chapter: Communicaton using the PROMOTIC drivers.
 
Basic properties of the driver:
- Using this driver is bound to purchase the license: PmSBUS. With the freeware version PmFree, or when developing the application (with development environment for tersting purposes), this component is always functional.
- The communication is done via Ethernet or via standard serial link (COM1, COM2 ...).
- The PROMOTIC application is the MASTER (i.e. it initiates the data transfer) from this communication point of view.
- The driver is incorporated into the PROMOTIC system by means of the PmComm object.

Driver supports the usage of both PmCommMsg and PmCommData objects. For common data transfers, it is easier to use the PmCommData object.

For easy integration of this driver into the application it is handy to use: Preconfigurations in group "S-BUS protocol (SAIA, DIGIControl)"

 

Recommended parameters values:

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 of data bits8
ParityNO, For Transfer mode=Parity the setup is being dynamically modified.
Number of stop bits1
Recommended values for the Ethernet parameters - For SAIA devices:
TCP/UDP 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 parameters - For DIGIControl devices:
TCP/UDP 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 set:
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 devices not equipped with Ethernet interface.

If Transfer mode=Parity, the 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 on 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 for the serial link communication and comunicate via the virtual COM port!

SAIA S-BUS in UDP-frame - For SAIA devices. Compared to the standard serial link data it contains a special header and it is transfered via Ethernet UDP on port 5050.
DIGIControl S-BUS TBETH protocol - For DIGIControl devices. Compared to the standard serial link data it contains a special header (TBETH protocol) and it is transfered 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, the transfer of the message is terminated (event onEndOfTransfer fires 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. In this mode it is the same however the designer sets the parity in 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. Now (year 2007) every PLC SAIA supports this.
SBUS address of this applicationFor "DIGIControl S-BUS TBETH protocol" data type

The communication description by the PmCommData objects

The PmCommData objects can be used for this driver. For usual data transmissions it is more favourable than using the PmCommMsg object.

The variables in the PmCommData object (or even better the variables in the PmData 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 enabled). When writing to the variable, only the single value is sent (if the Auto write when writing to item configurator is enabled).

 
Description of the ItemID configurator:

ItemId is the text identifier of the item that is used for addressing the value 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 while the application is launching).

The text may be for example "dev2.R33.L".

- The 1st part defines the PLC address (device), to be communicated with (dev2 = address 2). The address 255 represents so called broadcast, i.e. a message to all PLCs and is relevant only for sending data (e.g. sending the current time to all PLCs simultaneously).
- The 2nd part defines the type and data address (R33 = the registry on 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 defines 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 reading 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 PmCommData > Parameters > Special Parameters configurator:
Default PLC addressThe address defined here can be used for definitions in the ItemID configurator for the variables in this object (i.e. the variables on the Data page or in the ExtComm data extensions). The address can be defined in ItemID:
- as for example dev1... - then the value will be read from the PLC with address 1.
- or devD... - the "D" character means default, and the address is taken from this configurator.

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

The communication description by the PmCommMsg objects for PLC SAIA (S-BUS)

 
There is the first variable with the name "Slave" on the PmCommMsg > Data-sent page. Into this variable enter the address (static or dynamic) of the PLC to which the message has to be sent. The address 255 represents so called broadcast, i.e. a message to all PLCs and is relevant only for sending data (e.g. sending the current time to all PLCs 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 the 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 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 can be 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: The CPU Status of the PLC can be 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 like into the register areas. This 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 size of data is set in the message parameters. The real size of data is then set in the Size variable of the Data-sent item. If this value is set to 0 (or isn't entered at all), the maximum size is regarded as the real size.

The communication description by the PmCommMsg objects for PLC DIGIControl (S-BUS+)

There is the first variable with the name "Slave" on the PmCommMsg > Data-sent page. Into this variable enter the address (static or dynamic) of the PLC to which the message has to be sent. The address 255 represents so called broadcast, i.e. a message to all PLCs and is relevant only for sending data (e.g. sending the current time to all PLCs simultaneously).
 
The PLC register addressing type DIGIControl can be selected 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 adress is for example 90383 (decimal) then it equlas to 01610f hexadecimaly. 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 = number of source program page
2) Col = column number of requested modul
3) Row = row number of requested modul
4) Item = number of the modul input/output. Usually: 1,2,..,8 are inputs, 9,10,..,16 are outputs.
After the adressing type is selected in Data-sent one (Addr) variable is generated or four (Chart/Col/Row/Item) variables are generated. The register adress must be entered into these variables.
 
The Bit type registers are transfered as Long type values with the 0.bitem correctly set. The bit access in the PROMOTIC system can be done using the attribute Var.Bit.
 
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 the 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 can be read/written. 1 item of the Date type is created in the data.
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice