Applies To:
  • CitectSCADA 3.x, 4.x

Summary:
TagDebug() is a Cicode function which enables reading and writing to variable tags in runtime. In version 3.x and 4.x it does not support reads/writes to arrays, however it can be modified to do so. In version 5.0 this feature will be added to the TagRead() and TagWrite() functions directly so the following modification do not need to be made. If you need this feature under version 3.x or 4.x then you can make the following changes to your cicode in the INCLUDE project. 

Solution:
Edit the cicode functions _tagDebugRead() and _tagDebugWrite() found in the TAG.CI library file of the Include project as follows:

/*
** _tagDebugRead()
**
** Callback for Read button. This function will read the tag
** from the I/O Device and display on the form.
*/
INT
FUNCTION
_tagDebugRead()
   INT pos1;
   INT pos2;
   INT index;

   index = 0;
   FormGetData(hForm);
   pos1 = StrSearch(0, sTag, "[");
   IF pos1 > 0 THEN
      pos2 = StrSearch(0, sTag, "]");
      IF pos2 > 0 THEN
         index = StrToInt(StrMid(sTag, pos1 + 1, pos2 - pos1 - 1));
      END
   ELSE
      pos1 = StrLength(sTag);
   END
   sValue = TagRead(StrLeft(sTag, pos1), index);
   FormSetData(hForm);
   RETURN 0;
END

/*
** _tagDebugWrite()
**
** Callback for Write button. This function will write to the
** I/O Device from the value in the form.
*/
INT
FUNCTION
_tagDebugWrite()
   INT pos1;
   INT pos2;
   INT index;

   index = 0;
   FormGetData(hForm);
   pos1 = StrSearch(0, sTag, "[");
   IF pos1 > 0 THEN
      pos2 = StrSearch(0, sTag, "]");
      IF pos2 > 0 THEN
         index = StrToInt(StrMid(sTag, pos1 + 1, pos2 - pos1 - 1));
      END
   ELSE
      pos1 = StrLength(sTag);
   END
   TagWrite(StrLeft(sTag, pos1), sValue, index);
   RETURN 0;
END

 

Keywords:
 

Attachments