Applies To:
  • CitectSCADA 5.xx

Summary:
We are using Dial-Up I/O in Citect 5.21 and can get it to dial on schedule OK. It connects, reads the tags and disconnects. However, we want a Cicode function to be able to force it to connect and stay connected. When finished with that particular device, we want it to disconnect and use the cached values until we need to connect again. 

Solution:
Try the following concept in designing your cicode;

1. Configure the device to be Scheduled as normal in Citect project editor.

2. On startup of Citect runtime, use IODeviceControl( sDevice, 9, ...) to dissable the scheduling task.

3. Set the cache time to as high as is required, IODeviceControl( sDevice, 11, ...), in milliSeconds.

4. Then use IODeviceControl( sDevice, 7, ...) to connect to the plc when required.

5. Then use IODeviceControl( sDevice, 8, ...) to dissconnect the plc when finished.

There is another trick to update all the tags, not just those on the page you are currently viewing. Use the IODevice Control function as follows:

    IODeviceControl(sDevice, 16, 0)
// Initiate communications and read tags. Sleep time will depend on how fast your modems connect.


FUNCTION
    DisableSchedule()

INT hCon;
    hCon=IODeviceControl("IODev1", 9, 1); //disable I/O Dev 1
END

FUNCTION
    SetSched(INT rSched_Time)

INT hSched;
    rSched_Time=rSched_Time * 60* 1000 ; //sets time to minutes
    hSched=IODeviceControl("IODev1", 11, rSched_Time); //set I/O cache
END

FUNCTION
    Connect()
INT hConnect;
    hConnect=IODeviceControl("IODev1", 7, 0); //Connects to device
END

FUNCTION
    DisConnect()
INT hDisConnect;
    hDisConnect=IODeviceControl("IODev1", 8, 0); //Connects to device
END

 

Keywords:
 

Attachments