Running VBA code via Eventtable
Hello,
I made a station with VBA code controlled from the robotprogram by using the eventable with simple robot outputs.
The event works as follows:
a) simple attachments and deattachments,
b) moving object by use of timers ccrp timers,
I had done this exercise a couple of times before, but this time it won't work.
The simple attachments can be executed from the I/O simulator
The timer controlled events can only be managed through the VB editor, when I try to run it in the I/O simulator nothing happens.
(no error code ). The structure of the code is as usual (I just use copy and paste, change the subs.
Hop you got some ideas.
Regards
Michael
Comments
-
When the Event Table executes code it will run it as a macro only. That is, the event table holds the simulation, runs the macro, then starts the simulation again.
So timed events will be lost when run from the Event Table.
The only way to get around this is to put timed events into a simulation-controller just like when simulating periferal equipment like an elevator or a door.
Like this:
Private Sub Controller_AfterTick(ByVal Time As Double)
If myTime > Time Then
'do stuff
End If
End SubYou could also do this for an IO signal:
Private Sub Controller_AfterTick(ByVal Time As Double)
Dim myIO As IO
Set myIO = ActiveStation.ActiveMechanism.Controller.IOs("do1")
If myIO.Value = 1 Then
'do stuff
End If
End SubSo fi you combine the two criteria you could have a timed event triggered by an IO signal in the simulation-controller.
John
Developer Center0 -
Hello leamus,
I don't agree with John that you can't use the ccrp-timer together with the eventtable. If you set up a ccrp-timer you can enable and disable it from a macro that you trigg with a event in the eventtable. See the attached station how you can do it (start the macro "SpeedControl" in the Station). The attached station require that you have the ccrp-timer in your PC (it is also attached). Your problem could depend on that RS can't find all your IOs (have happend me sometimes). To check that you can run this Macro (the IOs will be displayed in the Output window). A restart of the VC normally solves this.
Sub CheckIOs()
Dim VC As Controller
Dim IO As IOSet VC = ActiveStation.ActiveMechanism.Controller
For Each IO In VC.IOs
Call ActiveStation.PrintLog(IOs, IO.Name)
Next
End SubRegards,
Anders
Best regards,
Anders Spaak
ABB Robotics0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings