FP_INTERRUPT_ENABLE

Habilitar programas de interrupción

Esta instrucción FP habilita la ejecución de todos los programas asignados a tareas de interrupción.

Observaciones

  • En el caso de interrupciones periódicas, se aplica lo siguiente: Después de habilitar los programas de interrupción, la primera ejecución de un programa de interrupción puede producirse una vez transcurrido el intervalo de tiempo que se ha definido para el mismo.

  • Cuando el PLC pasa del modo PROG al modo RUN, los programas de interrupción se deshabilitan. Es necesario habilitar los programas de interrupción ejecutando FP_INTERRUPT_ACTIVATE.

Ejemplo

Cabecera de la POU

Todas las variables de entrada y de salida utilizadas para la programación de esta función han sido declaradas en la Cabecera de la POU. Se utiliza la misma cabecera de la POU para todos los lenguajes de programación.

	VAR
		bEnable_Interrupt: BOOL:=FALSE;
		bComparisonMatchMonitor: BOOL:=FALSE;
		bDisableHscUnit: BOOL:=FALSE;
		bDisable_Interrupt: BOOL:=FALSE;
	END_VAR

Cuerpo LD

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 12 ;
        NETWORK_BODY
B(B_COMMENT,,Program behavior:ø^- with first scan all interrupts are disabled (or via "bDisable_interrupt" by hand)ø^ø^- g_Count_up ONCE a second --> if EQ 10 the interrupts will be enabled ø^ø^- the interrupt program is activated in  Interrupt 10 (Slot 1 Channel 0)ø^ø^- if g_bCount_interrupt = 20 --> g_bCount_interrupt and g_bCount_up are set to ZEROø^,4,1,41,10,);
L(1,0,1,12);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_CONTACT,,sys_bIsFirstScan,6,1,8,3,F);
B(B_COIL,,g_bHscUnitEnable,29,1,31,3,);
B(B_CONTACT,,g_bHscUnitEnable,6,4,8,6,);
B(B_CONTACT,,bDisableHscUnit,16,1,18,3,N);
L(18,2,29,2);
L(8,2,16,2);
L(1,2,6,2);
L(1,5,6,5);
L(8,5,11,5);
L(11,2,11,5);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_CONTACT,,g_bHscUnitEnable,6,1,8,3,R);
B(B_COIL,,g_bHscUnitEnableCounting,29,1,31,3,);
B(B_CONTACT,,g_bHscUnitEnableCounting,6,4,8,6,);
B(B_CONTACT,,bDisableHscUnit,16,1,18,3,N);
L(18,2,29,2);
L(1,5,6,5);
L(13,2,13,5);
L(8,5,13,5);
L(13,2,16,2);
L(8,2,13,2);
L(1,2,6,2);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 3 ;
        NETWORK_BODY
B(B_CONTACT,,g_bHscUnitComparisonMatchFlag,7,1,9,3,);
B(B_COIL,,bComparisonMatchMonitor,29,1,31,3,);
B(B_COMMENT,,For Monitoring if ComparisionMatchFlag is TRUE,45,0,69,2,);
L(9,2,29,2);
L(1,2,7,2);
L(1,0,1,3);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_F,FP_INTERRUPT_DISABLE!,,12,0,24,3,,?DEN?AENO);
B(B_CONTACT,,sys_bIsFirstScan,4,1,6,3,);
B(B_COIL,,bEnable_Interrupt,29,1,31,3,E);
B(B_CONTACT,,bDisable_Interrupt,4,3,6,5,);
B(B_COMMENT,,Disable all Interrupts hard: no activation with the FB- FP_INTERRUPT_ACTIVATE possible,43,0,67,2,);
L(1,2,4,2);
L(6,2,12,2);
L(1,4,4,4);
L(6,4,11,4);
L(11,2,11,4);
L(24,2,29,2);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 2 ;
        NETWORK_BODY
B(B_VAROUT,,g_iCount_interrupt,16,0,18,2,);
B(B_VARIN,,g_iCount_interrupt,14,0,16,2,);
B(B_COMMENT,,For monitoring the counter variable in the interrupt 10,45,0,69,2,);
L(1,0,1,2);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 4 ;
        NETWORK_BODY
B(B_F,@EQ-2!,,9,1,14,4,,?D?D?C);
B(B_VARIN,,g_iCount_up,7,1,9,3,);
B(B_VARIN,,10,7,2,9,4,);
B(B_COIL,,bEnable_Interrupt,19,1,21,3,S);
L(14,2,19,2);
L(1,0,1,4);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 3 ;
        NETWORK_BODY
B(B_F,FP_INTERRUPT_ENABLE!,,19,0,31,3,,?DEN?AENO);
B(B_CONTACT,,bEnable_Interrupt,5,1,7,3,R);
L(1,2,5,2);
L(7,2,19,2);
L(1,0,1,3);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 4 ;
        NETWORK_BODY
B(B_F,FP_INC!,,19,0,25,4,,?DEN?Dd?Ad?AENO);
B(B_VARIN,,g_iCount_up,17,2,19,4,);
B(B_CONTACT,,sys_bPulse1s,5,1,7,3,R);
L(1,2,5,2);
L(7,2,19,2);
L(1,0,1,4);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

Cuerpo en ST

(* Initiation *)
g_bHscUnitEnable := (DFN (sys_bIsFirstScan) OR g_bHscUnitEnable) AND  NOT bDisableHscUnit ;
g_bHscUnitEnableCounting := (DF(g_bHscUnitEnable) OR g_bHscUnitEnableCounting) AND NOT bDisableHscUnit ;
(* Monitoring *)
bComparisonMatchMonitor := g_bHscUnitComparisonMatchFlag ;  
g_iCount_up := g_iCount_up;                    (* is counted in the main project *)
g_iCount_interrupt := g_iCount_interrupt;            (* is counted in the interrupt program 1_0*)
(* Interrupt expressions *)
if (sys_bIsFirstScan OR bDisable_Interrupt) then
    FP_INTERRUPT_DISABLE();
    bEnable_Interrupt := FALSE;
end_if;
if (g_iCount_up = 10 ) then
    FP_INTERRUPT_ENABLE();    (* Enabel all interrupts *)
end_if;
(* 1 second counting pulse *)
if (DF(sys_bPulse1s)) then
    FP_INC(d := g_iCount_up);
end_if;

Modificado el: 2022-11-15Comentarios sobre esta páginaLínea directa de Panasonic