This driver serves for communication with PLC devices by the
TECO company. See also
Communication with PLC devices by the TECO company (Czechia).
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:
- The driver communicates
with PLC devices by the TECO company series
TECOMAT (
TC400, TC500, TC600, TC650, TC700, NS950, FOXTROT ...) and
TECOREG (
TR050, TR200, TR300 ...) by the
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.
- Usage of this driver requires purchase of the
PmTeco 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.
Note: At the
RS232 communication with the PLC device
TECOREG the pin 5 must be patched to the pin 9 on the connector that is connected into the service communication port ! Otherwise use standard cross patching (
RX->TX, TX->RX, SG->SG).
The driver supports the following data types:
-
BOOL:
Bit defined by byte address and bit number.
In the PROMOTIC application represented by the
Boolean data type.
-
USINT:
1-byte integer (from
0 to
255).
In the PROMOTIC application represented by the
Byte data type.
-
INT:
2-byte integer (from
-32 768 to
+32 767).
In the PROMOTIC application represented by the
Integer data type.
-
UINT:
2-byte integer (from
0 to
+65 535).
In the PROMOTIC application represented by the
Long data type.
-
DINT:
4-byte integer (from
-2 147 483 648 to
+2 147 483 647).
In the PROMOTIC application represented by the
Long data type.
-
REAL:
4-byte real number.
In the PROMOTIC application represented by the
Single data type.
-
LREAL:
8-byte real number.
In the PROMOTIC application represented by the
Double data type.
-
STRING:
Text string with a maximum length of 255 characters.
In the PROMOTIC application represented by the
String data type.
TECO string always ends with "binary 0" and this 0 is included in the length. Thus, a string of length 81 can contain only 80 characters.
-
TIME / TIME_OF_DAY:
In the PLC device this type is in fact the same as
DINT type (i.e. 4-byte integer) and represents the number of milliseconds (for
TIME_OF_DAY it is the number of milliseconds from beginning of the day).
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 device this type is in fact the same as
LREAL type (i.e. 8-byte real number) and represents the number 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 date and time is of the
Date type, then the values of year/month/day/hour/minute/second can be obtained, for example:
See also
Pm date and time methods and
VBScript date and time functions.
Recommended values of the PmaComm object parameters:
Baud rate | 19200 Bd (and higher) |
Number data bits | 8 (mandatory) |
Parity | EVEN |
Number of stop bits | 1 (mandatory) |
RTS flow control | 1 |
DTR flow control | 0 |
Delay between receive-send | 0. 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. |
---|
TCP/UDP remote port number | 61682 (for "TECO Ethernet" data type) |
Ethernet transfer type | UDP (for "TECO Ethernet" data type) |
TCP/UDP local port number | Here it is advisable to specify some port, e.g. 61681 (don't leave the setting "Automatic").
The TECO PLC distinguishes connected clients by their port number and will not allow a new client to connect if it exceeds a certain number (a non-communicating client may drop out in the PLC e.g. after 2 hours). If the local port would be entered automatically, then on restarting the PROMOTIC application, a different local port number would be assigned to the communication and the TECO PLC would consider the application as a new client and could refuse the connection. |
---|
Description and recommended values for the Protocol parameters:
Protocol data type | Only for Ethernet. Specifies the protocol data form. It is possible to choose:
TECO Ethernet - Standard Ethernet communication for TECO PLCs. Compared to the data for serial link it includes a special header and it is transferred 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 the device not equipped with Ethernet interface. |
Response receipt timeout | Only for serial link. Recommended value 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, then the transmission of the message is terminated (the onEndOfTransfer event is triggered with error 24 or 66). |
TECO address of this application | The address of the PROMOTIC application for communication with PLC devices. Addressing in the TECOMAT protocol allows the connection of more PLC's to one PROMOTIC application over one communication port. In this case 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 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 optimized internal communication messages for reading the data from the device.
All variables are read (if the "
Data refresh enabled" configurator is checked). On writing into the variable, only the single variable is sent into the device (if the "
Auto send on 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 either 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.W", where:
- The 1st part specifies the PLC address (device), to communicate with (dev2 = address 2).
- The 2nd part specifies the type and data address (
R33 = register
"R" at address
33).
X register
Y register
S register
R register
- The 3rd part specifies the data type.
bn =
BOOL = bit with index
n (
n = 0 to 7)
W =
UINT = Integer unsigned
STR.n =
STRING = Text string length of
n characters (
n = 2 to 255).
This configurator is not used for given driver.
The communication description by means of the PmaCommMsg object
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.
List and description of communication messages:
1) CONNECT: Starting the communication connected with the initialization of the communication structures.
2) IDENT: Detects information about the type of the connected PLC.
3) SETTID: Writing time into the RTC time circuit. From this point the PLC device 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" tab:
CLE - request for clearing an error (active in 1)
RES - request for restarting the PLC device (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 device mode (0=HALT, 1=RUN)
5) GETSW: Reading the PLC status word.
There are following variables on the "
Data-received" tab:
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 the PLC device mode (0=HALT, 1=RUN)
6) GETERR*: Reading the main error stack of the central unit. The error stack contains 8 error messages in the order 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 device 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" tab:
CLE - request for clearing an error (active in 1)
RES - request for restarting the PLC device (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" tab:
TR - scratch-pad memory area from which it is read (see table 1)
IR - index of the first read register (byte addressing).
9) WRITEN*: Writing into registers of the PLC scratch-pad memory.
There are following variables on the "
Data-sent" tab:
TW - scratch-pad memory area to which it is written (see table 1).
IW - index of the first written register (byte addressing).
10) WANDRN: Writing into registers and reading from registers of the PLC scratch-pad memory.
There are following variables on the "
Data-sent" tab:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the first read register (byte addressing).
TW - scratch-pad memory area to which it is written (see table 1).
IW - index of the first written register (byte addressing).
11) READB*: Reading bits of the PLC scratch-pad memory.
There are following variables on the "
Data-sent" tab:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the read register (byte addressing).
BR - index of the read bit (0-7).
The required bit is on the "
Data-received" tab.
There are following variables on the "
Data-received" tab: The required bit.
12) WRITEB*: Writing bits of the PLC scratch-pad memory.
There are following variables on the "
Data-sent" tab:
TW - scratch-pad memory area to which it is written (see table 1).
IW - index of the written register (byte addressing).
BW - index of the written bit (0-7).
Bit - logical value of the written bit.
13) READBD*: Reading bits of the PLC scratch-pad memory and their consecutive zeroing.
There are following variables on the "
Data-sent" tab:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the read register (byte addressing).
BR - index of the read bit (0-7).
The required bit is on the "
Data-received" tab.
There are following variables on the "
Data-received" tab: 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" tab:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the first read register (byte addressing).
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" tab:
TR - scratch-pad memory area from which it is read (see table 1).
IR - index of the first read register (byte addressing).
TW - scratch-pad memory area to which it is written (see table 1).
IW - index of the first written register (byte addressing).
Data type limitations in the PmaCommMsg object:
-
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 methods
PmVar.GetBit /
PmVar.SetBit /
Pm.GetBit /
Pm.SetBit.
- USINT: The maximum number of transferred values of this type in one message: 246.
- INT / UINT: The maximum number of transferred values of this type in one message: 109.
- DINT / REAL: The maximum number of transferred values of this type in one message: 55.
- LREAL: The maximum number of transferred values of this type in one message: 27.
Extended potential for data setting in the PmaCommMsg object:
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
PmaCommMsg configuration. Sometimes it is necessary to transfer mixed data types. This can be achieved by additional changing these data (on the "
Data-received" tab or
Data-sent page). It is possible to subtract or add data and first of all to change data 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 2 items of the
Long type can be changed (8 bytes in total) into 6 items of the following types:
Byte,
Byte,
Integer,
Integer,
Byte,
Byte.