# IRC5/ unload and load problem

**URL:** <https://tech-community.robotics.abb.com/t/irc5-unload-and-load-problem/1896>\
**Category:** Robot Controller\
**Created:** [May 29, 2008, 8:12am UTC](https://tech-community.robotics.abb.com/t/irc5-unload-and-load-problem/1896 "2008-05-29T08:12:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![memphiss](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@memphiss](https://tech-community.robotics.abb.com/u/memphiss)\
**Post date:** [May 29, 2008, 8:12am UTC](https://tech-community.robotics.abb.com/t/irc5-unload-and-load-problem/1896/1 "2008-05-29T08:12:43Z")

</div>

I have a problem of unload and load files.  
My machine needs to unload old file and load a new one very often. However,  
it often met with unload errors and need to try again and again. I can be sure  
mu unload and load path is the same and of no problem.(Of course,before first time  
unload,working memory does not have that file so it will be unload error and try again it will  
be OK)

Is that because of IRC5 is so fast so that we need to add a waittime between unload  
and load?

My Code:

PROC My\_Do\_Loading()  
!MyFileName is a string already declared in another module  
VAR bool Errorcounter:=FALSE;

Errorcounter:=FALSE;  
boolload:=FALSE;  
! WaitTimeInPos, 0.2;  
TPWrite “Loading”+MyFileName;  
UnLoad "/hd0a/"File:=“MyDir/”+MyFileName;  
boolload:=TRUE;  
Load "/hd0a/"File:=“MyDir/”+MyFileName;  
IF Errorcounter=TRUE THEN  
UnLoad "/hd0a/"File:=“MyDir/”+MyFileName; & nbsp;  
Load "/hd0a/"File:=“MyDir/”+MyFileName;  
ENDIF  
MyFileName:=“FALSE”;  
TIME := CTime();  
!TPErase;  
ERROR  
IF boolload=TRUE AND Errorcounter=FALSE THEN  
WaitTime 1;  
Errorcounter:=TRUE;  
TRYNEXT;  
ELSEIF boolload=TRUE THEN  
TPWrite "Error Loading "+MyFileName;  
PulseDOHighPLength:=2,doErrLoadMoMy;  
MyFileName:=“FALSE”;  
EXIT;  
ENDIF

---

<div class="post-metadata">

**Author:** ![RussD](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@RussD](https://tech-community.robotics.abb.com/u/RussD)\
**Post date:** [May 29, 2008, 3:46pm UTC](https://tech-community.robotics.abb.com/t/irc5-unload-and-load-problem/1896/2 "2008-05-29T15:46:51Z")

</div>

Maybe you can try using the instructions StartLoad and WaitLoad, see the RAPID documentation for more information.

---

<div class="post-metadata">

**Author:** ![memphiss](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@memphiss](https://tech-community.robotics.abb.com/u/memphiss)\
**Post date:** [May 30, 2008, 3:34am UTC](https://tech-community.robotics.abb.com/t/irc5-unload-and-load-problem/1896/3 "2008-05-30T03:34:12Z")

</div>

Thank you Russell for the quick help.

I still not clear about the difference of static mode and dynamic mode of StartLoad.What I need to do is unload a \*.sys system module and load a new one under auto production mode.

What is the difference between static and dynamic?

---

<div class="post-metadata">

**Author:** ![RussD](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@RussD](https://tech-community.robotics.abb.com/u/RussD)\
**Post date:** [May 30, 2008, 5:07pm UTC](https://tech-community.robotics.abb.com/t/irc5-unload-and-load-problem/1896/4 "2008-05-30T17:07:13Z")

</div>

I couldn’t find an exact definition of these anywhere, but it seems to have to do with how “deeply embedded” into the Program Server is the module.

Basically it seems a statically loaded system module is an integrated component of the loaded RAPID system, i.e. it is always present unless you unload that module, while a statically loaded program module is an integrated part of the loaded RAPID program, i.e. it is always present until you unload the program.

A dynamically loaded module then seems to be a part of the current execution context, i.e. it is only available while you are actively executing your main routine. If you move the program pointer back to main, your dynamically loaded modules are unloaded and you must reload them again as needed during execution.

I inferred this from reading the description of the affects of **Moving PP to main** and **Opening a new program** in the Rapid Reference Manual under the instruction Load.

Can anyone else offer a more formal definition than this?
