MULTITASKING
I need to know whether loops will work in forground background tasks in RAPID and is there any chance of deadlocks or preemption in RAPID programs.If so, will you please provide a reference manual for the examples of deadlocks or multithreading or concurrent programming in RAPID language. Given below are my three simple tasks.
MODULE MAIN
VAR num i;
PERS bool tproutine_inuse := FALSE;
PROC main()
WaitUntil TestAndSet(tproutine_inuse);
WHILE(i<=2) DO
TPWrite "First line from MAIN";
TPWrite "Second line from MAIN";
TPWrite "Third line from MAIN";
tproutine_inuse := FALSE;
ENDWHILE
ENDPROC
ENDMODULE
MODULE BACK1
VAR num j;
PERS bool tproutine_inuse := FALSE;
PROC main()
WaitUntil TestAndSet(tproutine_inuse);
WHILE(j<=2) DO
TPWrite "First line from BACK1";
TPWrite "Second line from BACK1";
TPWrite "Third line from BACK1";
tproutine_inuse := FALSE;
ENDWHILE
ENDPROC
ENDMODULE
MODULE MAIN
VAR num k;
PERS bool tproutine_inuse := FALSE;
PROC main()
WaitUntil TestAndSet(tproutine_inuse);
WHILE(k<=2) DO
TPWrite "First line from BACK2";
TPWrite "Second line from BACK2";
TPWrite "Third line from BACK2";
tproutine_inuse := FALSE;
ENDWHILE
ENDPROC
ENDMODULE
Best Answer
-
I see nothing changing the value of i, j, or k. Main will be caught in infinite loop of WHILE DO.Lee Justice5
Answers
-
Oh.Sorry,That I didn't noticed.Thanks0
Categories
- All Categories
- 5.4K RobotStudio
- 385 UpFeed
- 15 Tutorials
- 12 RobotApps
- 291 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 247 ScreenMaker
- 2.7K Robot Controller
- 285 IRC5
- 47 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 748 RAPID Programming
- 15 Wizard Easy Programming
- 110 Collaborative Robots
- 3 Job listings