Applies To:
  • CitectSCADA 1.00, 1.01, 1.10, 1.11, 1.20, 2.00, 2.01

Summary:
I would like to be able to call Cicode functions from another application using DDE. I would also like to be able to write to PLC registers in the same way. 

Solution:
Cicode can be called from another application using DDE. The following example is an Excel macro that will call Citect via DDE and get Citect to display the alarm page using the "PageAlarm()" Cicode function.

The cell "1B" must be named as "Channel". This is done in "Formula - Define name" in Excel.

A B C
1 CHANNEL =INITIATE("Citect", "SYSTEM") [PageAlarm()]
2 =EXECUTE(CHANNEL,C1)
3 =TERMINATE(CHANNEL)
4 =RETURN()
5

You can also call a Cicode function to set a PLC variable as follows:

/* This Cicode function will be called by DDE to set
** variables in the PLC a separate function is
** required for each variable which is to be set via DDE.
**/
FUNCTION
SetVariableA(INT value)

PV_1 = value; /* PV_1 is the Citect tag in the PLC */

END

This Excel macro will call the "SetVariableA()" Cicode function and pass the value "80" to the function.

  A B C
1 CHANNEL =INITIATE("Citect", "SYSTEM") [SetVariableA(80)]
2   =EXECUTE(CHANNEL,C1)  
3   =TERMINATE(CHANNEL)  
4   =RETURN()  
5      

For more details on Excel macros, see the Excel macro manual. If your are using another application, substitute the equivalent DDE functions from your application for the ones used above. Note that you must place the name of the Cicode function in square [] brackets, and you can call more than one function at a time by placing extra function calls, eg [PageMenu()][AlarmAck(0,0)]. 


Keywords:
 

Attachments