Hi all,
I have a program that is structured to process a variety of different part numbers all having similar geometries and for each of these part numbers I have a different routine that will execute based on operator input. The operator is prompted to input the 5 digit numeric p/n they would like to process stored in PERS num nPN, for instance 11053. After the operator inputs the part number they would like to run I have a error routine setup to check that the given number is in the program by executing the following lines of code...
PROC rPN_SET()
%"r"+NumToStr(nPN,0)%;
ERROR
IF ERRNO=ERR_REFUNKPRC OR ERRNO=ERR_CALLPROC THEN
ErrWrite "Proc DNE","Procedure for P/N does not exist in"\RL2:="program, please try again or contact"\RL3:="programmer";
WaitTime 2;
TPErase;
rPN_SELECT;
ENDIF
In the event they enter a valid p/n, everything works as it should including temporary point values being set, movement speeds, text output and any other process specific values. If the value, lets say "2", is entered the routine runs and will prompt the operator that it does not exist and loops back into the p/n list.
Thus far the program works fine... upon entering a valid p/n directly after entering something incorrect however the program will fault with an 40168 error, Task MAIN: Reference to unknown procedure r2 (or whatever the invalid p/n may be). I thought this would occur because PERS num nPN was not holding the new "corrected" value but when I review the data num values I see the 11053 in there.
Is it possible that the execution is occurring too quickly and not reading the correct value? My other thought is the order of execution being that rPN_SELECT is executed from within the error routine. Should this be a separate routine that gets executed outside of the rPN_SET routine?
To possibly further aid in the troubleshooting here is the rPN_SELECT routine.
PROC rPN_SELECT()
TPErase;
TPWrite "Current P/N: "+sPN;
TPReadFK nCONTINUE,"Is this the correct P/N?","YES","NO",stEmpty,stEmpty,stEmpty;
TPErase;
IF nCONTINUE=2 THEN
TPWrite "P/N 11053 (E SEAL)";
TPWrite "P/N 12182 (TWIST FLEX SEAL)";
TPWrite "P/N 13988 (WAVE SEAL)";
TPWrite "P/N 14614 (E SEAL)";
TPWrite "P/N 15419 (E SEAL)";
TPReadNum nPN,"Enter a P/N from above, 0 for more...";
TPErase;
IF nPN=0 THEN
TPWrite "P/N 15640 (E SEAL)";
TPWrite "P/N 15838 (E SEAL)";
TPWrite "P/N 15840 (E SEAL)";
TPWrite "P/N 15931 (E SEAL)";
TPWrite "P/N 15932 (E SEAL)";
TPReadNum nPN,"Enter a P/N from above, 0 for more...";
TPErase;
IF nPN=0 THEN
TPWrite "P/N 15946 (E SEAL)";
TPWrite "P/N 15948 (E SEAL)";
TPWrite "P/N 15949 (E SEAL)";
TPWrite "P/N 15951 (E SEAL)";
TPWrite "P/N 16105 (E SEAL)";
TPReadNum nPN,"Enter a P/N from above, 0 for more...";
TPErase;
IF nPN=0 THEN
TPWrite "P/N 16239 (E SEAL)";
TPWrite "P/N 16249 (E SEAL)";
TPWrite "P/N 16378 (E SEAL)";
TPWrite "P/N 16473 (E SEAL)";
TPWrite "P/N 16474 (E SEAL)";
TPReadNum nPN,"Enter a P/N from above, 0 for more...";
TPErase;
IF nPN=0 THEN
TPWrite "P/N 16482 (E SEAL)";
TPWrite "P/N 16508 (WAVE SEAL)";
TPReadNum nPN,"Enter a P/N from above, 0 to restart...";
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
rPN_SET;
rCOATING;
ENDPROC
Thanks for any assistance!