RSView VBA script is unacceptably slow.

TConnolly

Lifetime Supporting Member
Join Date
Apr 2005
Location
Salt Lake City
Posts
6,152
I have a VBA script that reads 90 tags from a file (a custom recipe) and writes those values to tags. When I tested the VBA offline in Works writing to memory tags the script ran fast. But when I run it in Runtime and write to PLC tags then the script becomes very slow, taking about 15 seconds to read the file and write to the tags, and closer to 30 seconds to read the tags and write back to the file for a recipe save.

The PLC is a ControlLogix connected over ehternet via OPC server. All the rest of the communications is lighning fast - so its not a comm problem.
Am I missing something here - or is there a way to give the VBA script more resources to it will run faster?
 
There are some frequently-overlooked actions that will greatly improve the performance of tag writes from VBA in RSView32; sorry if you know them already and I'm teaching you to suck eggs.

Don't use individual tags. Better to create a tagS object and populate it using a gtagdb.queryfortags method.

Loop through all the tags in the the collection of tags and set their pending values.

Put the collection on scan (MyBigBunchOfTags.onscan roWait)

Write the pending values (MyBigBunchOfTags.WritePendingValues roWait)

Take the collection off scan

Hope this helps.
 

Similar Topics

Hi, I have a subroutine which I want to trigger every 10 seconds in RSView? Is there a way i can do this in RSView?
Replies
16
Views
7,950
Hello there, I'm new at the forums and with HMI programming and would like to ask for some help. I'm having trouble migrating a VBA code from...
Replies
1
Views
3,089
Need a bit of help. I have a older rsview app running on Windows nt that runs fine. My clients wanted to update and now the same project will...
Replies
12
Views
3,023
I have a global object that is a group of a series of objects one of which is a button. The push of the button needs to execute a VB script based...
Replies
0
Views
4,698
Hallo, I got a Cognex Scanner for dormatrix code. I want to read it in a RSView 32 Application. Therefore I need a VBA Code. Did anybody from...
Replies
0
Views
1,951
Back
Top Bottom