RobotStudio event

Check digital input value for a duration

Hi All,

I am new in robot programming, so apologize if my question is maybe a basic one.

I have an external software which sends an digital input to my IRC5 controller. The value 1 or 0.

I want to check the value of the DI during a period of time. In fact I want to be sure that the DI stays at the value 1 during at least 30 seconds. and then pass to the next action.

Is there any simple solution?


Thanks for your help


Comments

  • This below will wait until the signal becomes logic HIGH (it will wait there infinitely until you reset program pointer or another method - add a maxtime and timeout signal to that if you want to) then checks it for your 30 seconds.

    Jon

    VAR bool bSignal_High_For_30s;
    !
    WaitDI diInputSignal, 1;
    !
    bSignal_High_For_30s:=FALSE;
    WaitDI diInputSignal, 0 \MaxTime:=30 \TimeFlag:=bSignal_High_For_30s;
    !
    IF bSignal_High_For_30s=TRUE THEN 
        !
        ! signal high for 30 seconds
        !
    ELSE 
        !
        ! signal went low before 30 seconds expired
        !
    ENDIF