Problem with command " TPreadFK "

  • As I use in the problem , I want to have a count time when I use TPreadFK , but it does't work if I put count before it, Just as the example.


    Please tell me why ?


    for example:


    1.
    1\ count time before TPReadFK; ! when problem execute reg2=0
    PROC GoGlue()
    ClkReset clCycleTime;
    ClkStart clCycleTime;
    Set DO10_12_GelStart;
    reg1:=ClkRead(clCycleTime);
    reg2:=reg1;
    TPReadFK nSelectNo, "If you want to end glue, click YES ", stEmpty, stEmpty, stEmpty, stEmpty, "YES";
    IF nSelectNo=5 or reg2>60 THEN
    Reset DO10_12_GelStart
    nSelectNo:=0;
    ELSE
    Set DO10_12_GelStart;
    ENDIF

    ENDPROC
    2\ count time after TPReadFK; ! when problem execute reg2 is the time
    PROC GoGlue()
    ClkReset clCycleTime;
    ClkStart clCycleTime;
    Set DO10_12_GelStart;
    TPReadFK nSelectNo, "If you want to end glue, click YES ", stEmpty, stEmpty, stEmpty, stEmpty, "YES";
    reg1:=ClkRead(clCycleTime);
    reg2:=reg1;
    IF nSelectNo=5 or reg2>60 THEN
    Reset DO10_12_GelStart
    nSelectNo:=0;
    ELSE
    Set DO10_12_GelStart;
    ENDIF

    ENDPROC




    and I don't want use the variable [MaxTime]. Thanks..... :wallbash:


  • But, TPReadFK only get out if someone to press the key or by MaxTime.


    What do you really need to do?


    Start a timer after TPReadFK , if the timer is < 60 , it will go on ; else press the key or >60 , it will come to the end. :top:

  • OK...


    Which robot do you have? I'm asking because I see one other way to do this and you could use the programmable keys, M97 or later.


    Instead of TPReadFK you need to use only TPWrite, BUT, using a WHILE condition.


    For example...


    TPErase;
    TPWrite "IF you want to end the glue, Press P1 (programmable key with IO simulated - "DI01_Sim" );
    ClkStop clkGlue;
    ClkReset clkGlue;
    ClkStart clkGlue;
    SetDO DO_GLUE;
    WHILE DI01_Sim=0 and nTimer<60 DO
    WaitTime 0.1;
    nTimer:=ClkRead(clkGlue);
    ENDWHILE
    Reset DO_GLUE;
    TPErase;


    This is only a suggestion and the syntax needs to be double checked of course.

Advertising from our partners