{
    S7_Author := "ABH";
    S7_BlockComment := "MLC_Nd";
    S7_BlockNumber := "2929";
    S7_BlockTitle := "MLC_3mr";
    S7_EditorMode := "SCL";
    S7_Family := "ZeusControl";
    S7_Optimized := "TRUE";
    S7_Version := "1.0"
}
FUNCTION "FC2929_ZC_TOF_INDV" : Void
    VAR_INPUT
        Pulso1seg : Bool;
    END_VAR
    VAR_IN_OUT
        TOF : _.UDT_ZC_DISP_TOF;
    END_VAR

    { S7_Language := "SCL" }
    NETWORK
        REGION DESCRIPCION
        (*
        ###### (C)Copyright ZeusControl 2023 - 2025
        
        ---
        ### Información del Sistema
        | Hardware Compatible | Entorno de Ingeniería |
        |---------------------|-----------------------|
        | PLC serie 1200/1500 | TIA Portal 18         |
        
        ---
        > **Restricciones:** Ninguna.
        
        ---
        ### Descripción Funcional
        
        Función encargada de gestionar un dispositivo TOF.
        
        Las tareas que realiza son las siguientes:
        
        - Gestionar la activacion y temporizacion de la activacion del temporizador.
        
        ---
        ### Dependencias Requeridas
        | Tipo | Elementos |
        |------|-----------|
        | FC   | - |
        | FB   | - |
        | DB   | - |
        | UDT  | `UDT_ZC_DISP_TOF` |
            
        ---
        ### Historial de Cambios
        | Versión  | Fecha      | Técnico | Cambios |
        |----------|------------|---------|---------|
        | 01.00.00 | 02.10.2022 | (ABH)   | Primera version. |
        *)
        END_REGION DESCRIPCION
        
        
        //  ==========================================================================================================
        REGION GESTION_DISPOSITIVO
            
            IF #TOF.IN THEN
                #TOF.OldActivar := TRUE;
                #TOF.Q := TRUE;
            END_IF;
            IF #TOF.OldActivar AND NOT #TOF.IN THEN
                
                IF #TOF.ET <= 0 THEN
                    #TOF.Q := FALSE;
                    #TOF.OldActivar := FALSE;
                ELSE
                    IF #Pulso1seg THEN
                        #TOF.ET -= 1;
                    END_IF;
                END_IF;
            ELSE
                #TOF.ET := #TOF.SP;
            END_IF;
            
        END_REGION GESTION_DISPOSITIVO
        
        
    END_NETWORK
END_FUNCTION
