Promotic
WikipediaLinkedInYoutubeTwitterFacebook

PmTeco - Driver for communication with TECO PLC devices

This driver is used for communication with TECO PLC devices. See also Communication with TECO PLC devices (Czech republic).
 
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:
- Driver communicates with TECO device series TECOMAT (TC400, TC500, TC600, TC650, TC700, NS950, FOXTROT ..) and TECOREG (TR050, TR200, TR300 ..) by EPSNET monomaster protocol (the protocol comes from the definition of the transportation level of the PROFIBUS protocol). The communication in other modes ("PLC", multimaster ..) is not supported here.
- 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.
- Using this driver is bound to purchase the license: PmTeco. With the freeware version PmFree, or when developing the application (with development environment for tersting purposes), this component is always functional.
- 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 "TECO PLC"

 
Note: At the RS232 communication with the TECOREG the pin 5 must be patched to the pin 9 on the connector that is connected into the service communication port ! Elsewhere use standard cross patching (RX->TX, TX->RX, SG->SG).
 
The driver supports the following data types:
- BOOL: Bit defined by bit address and bit number. In the PROMOTIC application represented by the data type: Boolean.
- USINT: 1-byte integer (from 0 to 255). In the PROMOTIC application represented by the data type: Byte.
- INT: 2-byte integer (from -32 768 to +32 767). In the PROMOTIC application represented by the data type: Integer.
- UINT: 2-byte integer (from 0 to +65 535). In the PROMOTIC application represented by the data type: Long.
- DINT: 4-byte integer (from -2 147 483 648 to +2 147 483 647). In the PROMOTIC application represented by the data type: Long.
- REAL: 4-byte real number. In the PROMOTIC application represented by the data type: Single.
- LREAL: 8-byte real number. In the PROMOTIC application represented by the data type: Double.
- TIME / TIME_OF_DAY: In the PLC this type is in fact the same as DINT (i.e. 4-byte integer) and represents the number of milliseconds (for TIME_OF_DAY it is the number of milliseconds since the day started). But if instead of the DINT type the TIME (or TIME_OF_DAY) is used then the value is then represented by Date data type in the PROMOTIC system and the value is converted accordingly after the transfer. Year/Month/Day/Hour/Minute/Second
- DATE / DATE_AND_TIME: In the PLC this type is in fact the same as LREAL (i.e. 8-byte real number) and represents the number of seconds since 1.1.1970. But if instead of the LREAL type the DATE (or DATE_AND_TIME) is used then the value is then represented by Date data type in the PROMOTIC system and the value is converted accordingly after the transfer.
 
Note: If the value of the date/time is stored as Date data type, then the values of year/month/day/hour/minute/second can be obtained, for example, by the VBScript methods Year/Month/Day/Hour/Minute/Second. See also VBScript date and time functions and Pm date and time methods.
 

Recommended parameters values:

Recommended values for the Serial link parameters:
Baud rate19200 Bd (even higher)
Number of data bits8 (mandatory)
ParityEVEN, exceptionally it is possible to switch off the parity for the case of sending data by modems that don't support the parity.
Number of stop bits1 (mandatory)
RTS flow control1
DTR flow control0
Delay between receive-send0. In some cases the TECOREG converter at the RS485 interface cannot satisfactory quickly change the RTS signal automatically. Then the delay must be set to 10 ms.
Recommended values for the Ethernet parameters:
TCP/UDP port number61682 (for "TECO Ethernet" data type)
Ethernet transfer typeUDP (for "TECO Ethernet" data type)
Description and recommended values for the Protocol parameters:
Protocol data typeOnly for Ethernet. Specifies the protocol data form. It is possible to set:
TECO Ethernet - Standard Ethernet communication for TECO PLCs. Compared to standard serial link data it includes a special header and it is transfered via Ethernet UDP on port 61682.
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.
Response receipt timeoutOnly for serial link. Recommended valute is for example 2000 ms. 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).
TECO address of this applicationThe Address of the PROMOTIC application for the communication with the PLC. Addressing in the TECOMAT protocol allows the connection of more PLC's to one PROMOTIC application over one communication port. Here it is necessary to ensure that the connected PLC and the application have different addresses. The addresses needn't make a continuous range.

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.W".

- The 1st part defines the PLC address (device), to be communicated with (dev2 = address 2).
- The 2nd part defines the type and data address (R33 = the "R" registry on address 33).
X register
Y register
S register
R register
- The 3rd part defines the data type.
b = BOOL = bit
B = USINT = Byte
I = INT = Integer signed
W = UINT = Integer unsigned
L = DINT = Long
R = REAL = Single
LR = LREAL = Double
TIME = TIME / TIME_OF_DAY
DT = DATE / DATE_AND_TIME
Description of the PmCommData > Parameters > Special Parameters configurator:
This configurator is not used for given driver.

The communication description by the PmCommMsg objects

Table 1: Values of the scratch pad memory for some following messages:

0 - register X (inputs)
1 - register Y (outputs)
2 - register S (system variables)
3 - register R (registers)
128(=80hexa) - DataBox, first 64 kB (00000-0FFFF hex address)
129(=81hexa) - DataBox, second 64 kB (10000-1FFFF hex address)
130.. - DataBox, etc.

The below explicit service name marked with a * (asterisk) is available in central units of the following versions: CPM-1E version 3.4 and higher, CPM-1M version 4.3 and higher, CPM-1S version 4.1 and higher, CPM-2S all versions, CPM-1D all versions, CPM-1B all versions.

 
The list and description of the communication messages:
1) CONNECT: Starting the communication connected with the initialization of the communication structures.
2) IDENT: Getting information about the type of the connected PLC.
3) SETTID: Writing time into the RTC time circuit. From this point the PLC works with new time.
4) SETCW: Writing into the PLC control word. This service is accessible only over the serial channel CH1 !
There are following variables on the Data-sent page:
CLE - request for clearing an error (active in 1)
RES - request for restarting the PLC (active in 1)
TPR - type of the restart (0-warm, 1-cold)
CLO - request for clearing outputs (active in 1)
BLO - request for blocking outputs (active in 1)
MOD - required PLC mode (0=HALT, 1=RUN)
5) GETSW: Reading the PLC status word.
There are following variables on the Data-received page:
ERH - indication of the fatal error (active in 1)
ERS - indication of the other errors (active in 1)
IMS - indication of external blocking outputs (active in 1)
ISP - indication of external enabling RUN mode (active in 1)
BLO - indication of blocking outputs (active in 1)
MOD - indication of PLC mode (0=HALT, 1=RUN)
6) GETERR*: Reading the main error stack of the central unit. The error stack contains 8 error messages in total ordered from the oldest to the newest one, each of 4 bytes in length. The total length is 32 bytes.
7) MASKCW: Setting individual bits of the PLC control word. This service is accessible only over the serial channel CH1 ! The service is accessible in central units of the version 5.0 and higher.
There are following variables on the Data-sent page:
CLE - request for clearing an error (active in 1)
RES - request for restarting the PLC (active in 1)
TPR - type of the restart (0-warm, 1-cold)
CLO - request for clearing outputs (active in 1)
BLO - request for blocking outputs (active in 1)
MOD - required PLC mode (0=HALT, 1=RUN)
CLEP - validity of CLE setting
RESP - validity of RES setting
TPRP - validity of TPR setting
CLOP - validity of CLO setting
BLOP - validity of BLO setting
MODP - validity of MOD setting

For setting the bit it is necessary to set the corresponding validity of the bit to logical 1.

8) READN*: Reading from registers of the PLC scratch-pad memory.
There are following variables on the Data-sent page:
TR - scratch-pad memory area from which it is read (see table 1)
IR - index of the first read register (bajt addressing).
There are following variables on the Data-received page: The number and the type of the read data (see further Extended potential for setting PmCommMsg data).
9) WRITEN*: Writing into registers of the PLC scratch-pad memory.
There are following variables on the Data-sent page:
TW - scratch-pad memory area to which it is written (see table 1).
IW - index of the first written register (bajt addressing).
data - specified number and type of written data (see further Extended potential for setting PmCommMsg data).
10) WANDRN: Writing into registers and reading from registers of the PLC scratch-pad memory.
There are following variables on the Data-sent page:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the first read register (bajt addressing).
TW - scratch-pad memory area to which it is written (see table 1).
IW - index of the first written register (bajt addressing).
data - specified number and type of the written data (see further Extended potential for setting PmCommMsg data).
There are following variables on the Data-received page: The number and the type of the read data (see further Extended potential for setting PmCommMsg data).
11) READB*: Reading bits from the PLC scratch-pad memory.
There are following variables on the Data-sent page:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the read register (bajt addressing).
BR - index of the read bit (0-7).

The required bit is in the Data-received.

There are following variables on the Data-received page: The required bit.
12) WRITEB*: Writing bits into the PLC scratch-pad memory.
There are following variables on the Data-sent page:
TW - scratch-pad memory area to which it is written (see table 1).
IW - index of the written register (bajt addressing).
BW - index of the written bit (0-7).
Bit - logical value of the written bit.
13) READBD*: Reading bits from the PLC scratch-pad memory and their consecutive zeroing.
There are following variables on the Data-sent page:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the read register (bajt addressing).
BR - index of the read bit (0-7).

The required bit is in the Data-received.

There are following variables on the Data-received page: The required bit.
14) READND*: Reading from registers of the PLC scratch-pad memory and their consecutive zeroing.
There are following variables on the Data-sent page:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the first read register (bajt addressing).
There are following variables on the Data-received page: The number and the type of the read data (see further Extended potential for setting PmCommMsg data).
15) WANDRND: Writing into registers and reading from registers of the PLC scratch-pad memory and their consecutive zeroing.
There are following variables on the Data-sent page:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the first read register (bajt addressing).
TW - scratch-pad memory area to which it is written (see table 1).
IW - index of the first written register (bajt addressing).
data - specified number and type of the written data (see further Extended potential for setting PmCommMsg data).
There are following variables on the Data-received page: The number and the type of the read data (see further Extended potential for setting PmCommMsg data).
 
Data type limitations in PmCommMsg:
- BOOL: The services READN, WRITEN, WANDRN, READND, WANDRND don't transfer bit values. But it is possible to transfer the whole bytes and then to separate bits in the PROMOTIC system, for example by means of the Var.Bit / Pm.GetBit / Pm.SetBit methods.
- USINT: The maximum number of transferred values of this type in a single message: 246.
- INT / UINT: The maximum number of transferred values of this type in a single message: 109.
- DINT / REAL: The maximum number of transferred values of this type in a single message: 55.
- LREAL: The maximum number of transferred values of this type in a single message: 27.
 
Extended potential for setting PmCommMsg data:

In messages of the READN, WRITEN, WANDRN, READND and WANDRND types (that can transfer data of the Byte, Integer sign/unsign, Long or Single type) the same data type is set for all data on the PmCommMsg configuration. Sometimes it is necessary to transfer mixed data types. This can be achieved by additional changing these data (on the Data-received or Data-sent page). It is possible to subtract or add data and first of all to change types of these data if the following conditions are met:

- the overall size of data (in bytes) isn't changed.
- Integer unsign and Single data type cannot be used.

Example: For example it is possible to change 2 items of the Long type (8 bytes in total) into 6 items of the following types: Byte, Byte, Integer, Integer, Byte, Byte.

© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice