0

I have managed to write a code which counts running total on Citect Scada using Cicode-language. Now I have a problem because it seems that my loop has somehow reset my counter. I'm pretty new to this.

At this point, I don't know what causes this. This morning total was around 1480 before reset happened and I'm using INT as datatype. Counter has been active for about few weeks now. I'm using Citect Scada 6.1V.

FUNCTION Laskuri()
INT iState14 =0                 
INT iState15

 WHILE 1 DO                                                 

Sleep(3600)
iState15 = ReadVar(5,"Ar",59)                       
iState14 = iState14 + iState15;                         
SetVar(5,"Ar", 58, iState14);

      END
END
halfer
  • 19,824
  • 17
  • 99
  • 186
  • 2
    This is not C, I re-tagged it. As a naive reader without any knowledge of Cocode, it looks like integer overflow. – unwind Apr 01 '19 at 11:16
  • Yes thank you. Can you explain for dummy how the overflow happens in this case. Schneider datatypes say that allowed value range for int is -32,768 to 32,767 . – raimoretku Apr 01 '19 at 11:52

0 Answers0