Applies To:
  • CitectSCADA 5.xx, 6.00
  • CitectHMI 5.xx, 6.00

How do you setup a String Variable Tag in CitectSCADA using the S7NT driver? I have heard that a Siemens String data type is different to a CitectSCADA Sting data type. Is this true?

There is a subtle difference between a Siemens String data type and a CitectSCADA String data type.
A Citect string data type is different from a Siemens string data type, so to be able to read strings from an S7 PLC you have to do following things:

In Citect you define a (Siemens) string as an array of INT’s (DW’s - datawords)
a Siemens string starts at a certain point in a DB; the first 2 bytes contain info on that string (such as string length). Then the string characters follow, with 1 byte per character. By default a Siemens String tag occupies 256 bytes of data, of which 254 is payload. So for CitectSCADA the string starts at an offset of 2 bytes when compared with the S7 string.
a Siemens string is not NULL terminated. A Citect string has to be NULL terminated (0x00). So the PLC programmer has to this into consideration when programming the PLC program, to also write the NULL characters for every change of the string. Otherwise Citect might read the new string but also part of the old string. (If old string was abcde and new string was aaa, then Citect might read aaade if NULL character is not written as well. So again a source of possible errors.

Below is an example of a String Tag setup.
In Step 7 you will have the following:

You can monitor this Variable Tag is Step 7:

Then in CitectSCADA you would have the following Variable Tag:

You will notice that in Siemens Step 7, the String Tag starts at DB102,0. This is because the first 2 bytes are used for the size of the String. CitectSCADA terminates a String tag by the Null character, or 0x00. So as soon as the null character is read, it will terminate the String Variable Tag.

The Address DB102,2[10] means start reading from DB102,2 to DB102,11 (10 characters). This will allow you to display a String Variable Tag like "ABCDEFGHIJ".

If there are more Characters past DB102,11, CitectSCADA will not read them. Therefore it is important to setup the size of the Citect Variable Tag. Please note that the maximum request size for the S7-300 PLC is 222 bytes.  Thus you will not be able to read all 254 characters supported by the Siemens PLC. 

See KB Q4070 and Q4097 for further details on maximum request sizes supported by the S7NT driver.


S7NT, String