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

Summary:
When using tag association to write values to a PLC, it doesn't seem to work reliably. There is some SQL and database lookup code before calling the tag association function - PLCWrite().  If I add a Cicode sleep(n), it does help but does not solve it 100%. What is the problem, and how do I resolve it?
 

Solution:
This problem is most likely caused by timing, and the Citect main task thread. The tag association command runs in a common task with all other functions, which may include some foreground/blocking functions. The tag association function calls can get interrupted or will not execute if there are other blocking functions executing (SQL, Database lookups). The easiest way to solve this problem, is to create a new cicode task by calling your PLCWrite() function using TaskNew(). I.e. TaskNew("PLCWrite","",0).
 

Keywords:
Tag association, Tagwrite, tasknew, cicode  

Attachments