Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

OPC want to use OPCGroup.SyncWrite

$
0
0
I’m writing values to other equipment via OPC and modbus. I’ve lifted the example from http://www.autoitscript.com/forum/topic/127376-using-autoit-to-read-data-from-opc-server/page__hl__%2Bopcserver and it works well including the Item.Write.  Now I’d like to use OPCGroup.SyncWrite because with .Write the modbus server does individual writes and it's too slow.

I have example in VB from http://forums.mrplc.com/index.php?showtopic=12381
OPCGroup1.SyncWrite NumItems, ServerHandles(), Values(), Errors() 'Perform OPC Write

My attempt in AutoIt:
[ autoit ]      
ReDim $OPCErrs[$iOPCNofItms] For $iItmIx = 0 To $iOPCNofItms - 1 ConFmtWr("%2d ~%s~ ~%s~ ~%s~\n", $iItmIx, $OPCItmHnds[$iItmIx], $sOPCValues[$iItmIx], $OPCErrs[$iItmIx]) Next $iOPCNofItms = 1 $OPCGroup1.SyncWrite($iOPCNofItms, $OPCItmHnds, $sOPCValues, $OPCErrs) ; OPC Write
Output:
0 ~24986912~ ~1.100000~ ~~
1 ~24987056~ ~1.100000~ ~~
2 ~24987200~ ~1.100000~ ~~
3 ~24987344~ ~1.100000~ ~~
(178) : ==> The requested action with this object has failed.:
$OPCGroup1.SyncWrite($iOPCNofItms, $OPCItmHnds, $sOPCValues, $OPCErrs)
$OPCGroup1.SyncWrite($iOPCNofItms, $OPCItmHnds, $sOPCValues, $OPCErrs)^ ERROR

I think the group object is right (when I used the ID it said 'not an object'), item handles and values seem right. What could be wrong? Are the format of AutoIt arrays correct for passing to other languages?

Thanks.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>