Query
stud.bs
✭
in RobotStudio
Hi everyone,
I am new to thr roboyt studio. I have robot cutting application to build that should diplay 3 model options on the touchpendent. The user then selects one out of three options and under this Model selected he gets 3 tasks to perform. The user can choose any one of them. Once that is done, the user press a push button on the machine which would start the robot cutting operation. SO I have tried different wayd to do this task. It would be great if some one could guide me on how can I make the program wait for the start button to be pressed before calling the particular routine.
** but if the user has to perform the same task again he wouldnt have to select the whole model and task again, he just have to press the start button and the same routine that was called previously will be called again.
I could send the program that I have written for the robot and then Some body could give a feedback on it or wat has to be changed.
****I have multitasking on this robot and I planned to run the Main menu as a seperate Task and all the robots routines and actions will be set up in another Task.
I tried to save the name of the model selected in a string variable PERS str strproduct.
I tried to call the same string strproduct in another task but for some reason it says that the str is not unknown in that Task.
How can we declare a variable as global so that it can be called in any other Task in Multitasking.
please let me know the I can send the code to you.
I am new to thr roboyt studio. I have robot cutting application to build that should diplay 3 model options on the touchpendent. The user then selects one out of three options and under this Model selected he gets 3 tasks to perform. The user can choose any one of them. Once that is done, the user press a push button on the machine which would start the robot cutting operation. SO I have tried different wayd to do this task. It would be great if some one could guide me on how can I make the program wait for the start button to be pressed before calling the particular routine.
** but if the user has to perform the same task again he wouldnt have to select the whole model and task again, he just have to press the start button and the same routine that was called previously will be called again.
I could send the program that I have written for the robot and then Some body could give a feedback on it or wat has to be changed.
****I have multitasking on this robot and I planned to run the Main menu as a seperate Task and all the robots routines and actions will be set up in another Task.
I tried to save the name of the model selected in a string variable PERS str strproduct.
I tried to call the same string strproduct in another task but for some reason it says that the str is not unknown in that Task.
How can we declare a variable as global so that it can be called in any other Task in Multitasking.
please let me know the I can send the code to you.
Bharat Suvarna
0
Comments
-
Hi,The exmple below should get you startedMODULE MainModule
PERS num ProductCode:=0;
PROC main()
!
! Initialise the productcode
ProductCode:=0;
!
WHILE TRUE DO
!
! Show product selection UI. Usinf DIBreak will abort the menu if the start button is pressed
ProductCode:=UINumEntry(Header:="Product selection"Message:="Enter the code of the product you want cut"Icon:=IconInfoMinValue:=1MaxValue:=3AsIntegerDIBreak:=diStartCut);
WaitDI diStartCut,1;
!
TEST ProductCode
CASE 1:
!
! Add code here to cut product 1
CASE 2:
!
! Add code here to cut product 2
CASE 3:
!
! Add code here to cut product 3
DEFAULT:
UIMsgBox Header:="Code error","Please select a valid code before pressing the start button"Buttons:=btnOKIcon:=iconError;
ENDTEST
ENDWHILE
ENDPROCENDMODULE
Sharing variables between tasks is done by declaring the variable in each task. The variable must be a PERS. In you're declaration of "PERS str strproduct" "str" is not recognized it should say "string"BrRon nakken0 -
RonN said:
The variable must be a PERS.0 -
From the Multitasking manual:
To share data between tasks, use persistent variables. A persistent variable is global in all tasks where it is declared. The persistent variable must be declared as the same type and size (array dimension) in all tasks. Otherwise a runtime error will occur. It is sufficient to specify an initial value for the persistent variable in one task. If initial values are specified in several tasks, only the initial value of the first module to load will be used. Tip When a program is saved, the current value of a persistent variable will be used as initial value in the future. If this is not desired, reset the persistent variable directly after the communication.0
Categories
- All Categories
- 5.5K RobotStudio
- 395 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)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings