日期:2014-05-17 浏览次数:20926 次
grp = grps.Item("ReadParaS1");
int counts = grp.OPCItems.Count;
Array svHandles = Array.CreateInstance(typeof(Int32), grp.OPCItems.Count);
Array er = Array.CreateInstance(typeof(Int32), counts);
Array v = Array.CreateInstance(typeof(object), counts);
object q = new object(), t = new object();
Int32 hd;
for (int i = 0; i < counts; ++i)
{
hd = (Int32)grp.OPCItems.Item(opcPrefix + readParaPrefix + "1[" + i.ToString() + "]").ServerHandle;
svHandles.SetValue(hd, i);
}
//在这一行出错,提示“值不在预期的范围内”。
grp.SyncRead((short)RsiOPCAuto.OPCDataSource.OPCCache, counts, ref svHandles, out v, out er, out q, out t);
for (int i = 1; i <= itemCount; i++)
{
ServerHandles.SetValue(KepItem[i-1].ServerHandle, i);
}