Applies To:
  • CitectSCADA x.xx
  • CitectHMI x.xx
  • CitectFacilities x.xx


I have created a cicode function as follows:

FUNCTION Wait(REAL NewValue, REAL OldValue)
INT i=0
    i  =0
    WHILE NewValue <> OldValue AND i<5 DO
If I pass the 'NewValue' as a PLC tag, does CitectSCADA pass this by value or by a pointer? 


In short, they are passed by value not by pointer.

Cicode functions may be passed arguments.  These may be constant values e.g.  1, "A"; or variables.   Declaring arguments defines local copies which can then be used just within the cicode statements of the function.   For variable tags, the value is read before the cicode statements are  executed. 

If you want to use variable tags by reference, and thus potentially use updated values in your cicode, then you would not declare arguments to which you then pass the tag values into.  Instead,  just reference the tags by tag name (or use TagRead(), Tagwrite() cicode functions within your cicode statements. 

In version 5.0, a ReRead(0) was automatically called for you in your cicode functions every [code]timedataTimedata (3000 ms).  You could force an update right away by using ReRead(1) in your cicode.  

Prior to version 5.0 you would use Reread(0) or Reread(1) yourself with the same meaning as above.

In version 7, ReRead is gone.  The tags are subscribed at the start of cicode functions  and updated for you at [Code]TimeData (now 250 ms).  This can be set differently by calling tagsubscribe(), TaskNewEx().  Tags on graphics pages update at the graphics page update rate.