SetDO problem
Makoriko
✭
in RobotStudio
Hey all,
I am trying to add counter to my SetDO signal so that i can change 10 digital outputs inside the loop by using only one SetDO command. I can't get it to work and I haven't found solution from rapid refrence(or im just getting tired now )
.
.
.
FOR i FROM 1 TO 10 DO
SetDO dotest + numtostr(i),1; ! this dont work
SetDO dotest + i,1; ! This either don't work
ENDFOR
Is they a way to add num variables to your signal name? Hope you get the idea what im after from above.
- Marko
-once i thought i was wrong but i was mistaken-
0
Comments
-
Hi MarkoIt is not possible to add num variables to a signal.One way is just to write directly:SetDO dotest1,1;SetDO dotest2,1;...Another way is to define a groupe of signals in the EIO.cfg like: goTest that includes Signal dotest1 up to dotest10. To set all 10 signals you do:SetGO goTest,Pow(2,10)-1;Best regardsMarcel0
-
Hi Marko,It is possible to add num variables to the name of a data signal.Try This:MODULE ModuleIOTestVAR signaldo doTest;PROC Set10DOs()FOR i FROM 1 TO 10 DOGetDataVal "doTest"+NumToStr(i,0), doTest;SetDO doTest, 1;ENDFORENDPROCENDMODULEdoTest1 thru doTest10 must be defined in EIO.CFG.Have a look at GetDataVal - Get the value of a data object in the RAPID Reference Manual - it is not real clear in the documentation that you can also use this on IO signals, but it seems to work. (Maybe the manual needs some more examples)Thomas J2011-12-19 20:49:57
GetDataVal (Get Data Value) makes it possible to get a value from a data object that is specified with a string variable.Thomas H. Johnston
PACs Application Engineer0 -
Hi,I tested how Thomas suggested and it worked great! Thanks both of you. Awesome help here.-Marko-once i thought i was wrong but i was mistaken-0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings