Applies To:
  • CitectSCADA 7.xx
  • CitectHMI 7.xx

Summary:

Pre V7 the following code will increment a tag of data type INT to 32767 and then roll-over and start counting upwards from -32767.

FUNCTION myfunction()
WHILE 1 DO
        
testtag = testtag +1;
        
Sleep(1);
        
END
END

In V7 the code will increment the tag to 32767 but will not roll over.   

Solution:

The behaviour has changed in V7. Citect now checks the value being written to see if it is within the range of the tag's type. The write will fail if it is not. Pre v7 Citect used to cast the value down to fit the tag's type (from 32768 to -32767).

Therefore, the code should be modified as follows:

FUNCTION myfunction()
WHILE 1 DO
        
IF testtag <= 32766 THEN
                
testtag = testtag +1;
                
Sleep(1);
        
ELSE
                
testtag = -32767
        
END
END
END

 

Keywords:
 

Attachments