{
    S7_Author := "ABH";
    S7_BlockComment := "MLC_42w";
    S7_BlockNumber := "15992";
    S7_BlockTitle := "MLC_4Ga";
    S7_EditorMode := "SCL";
    S7_Family := "ZeusControl";
    S7_IECCheck := "TRUE";
    S7_Optimized := "TRUE";
    S7_Version := "1.0"
}
FUNCTION_BLOCK "FB15992_ZC_FAT_AI"
    VAR_INPUT
        { S7_MLC := "MLC_4Ya" }
        ByteEntrada : DInt := 0;
        { S7_MLC := "MLC_44A" }
        Area : Int := 0;
    END_VAR
    VAR_OUTPUT
        { S7_MLC := "MLC_ge" }
        Input_Raw : DInt;
        { S7_MLC := "MLC_N4" }
        Input_0_100 : Real;
    END_VAR
    VAR_TEMP
        t_Area : Byte;
        t_Input : DInt;
    END_VAR
    VAR CONSTANT
        { S7_MLC := "MLC_4xu" }
        INPUT : Byte := 16#81;
        { S7_MLC := "MLC_qs" }
        OUTPUT : Byte := 16#82;
        { S7_MLC := "MLC_39s" }
        MARCAS : Byte := 16#83;
        { S7_MLC := "MLC_pG" }
        "DB" : Byte := 16#84;
        { S7_MLC := "MLC_sK" }
        PERIFERIA : Byte := 16#01;
        { S7_MLC := "MLC_3aw" }
        VALOR_MAX_TARJETA : Real := 27648.0;
    END_VAR

    { S7_Language := "SCL" }
    NETWORK
        REGION DESCRIPCION
        (*
        ###### (C)Copyright ZeusControl 2023 - 2023
        
        ---
        ### Información del Sistema
        | Hardware Compatible | Entorno de Ingeniería |
        |---------------------|-----------------------|
        | PLC serie 1200/1500 | TIA Portal 18         |
        
        ---
        > **Restricciones:** Ninguna.
        
        ---
        ### Descripción Funcional
        
        Función para el forzado de las entradas analogicas para las pruebas FAT de los cuadros.
        
        ---
        ### Dependencias Requeridas
        | Tipo | Elementos |
        |------|-----------|
        | FC   | - |
        | FB   | - |
        | DB   | - |
        | UDT  | - |
        
        ---
        ### Historial de Cambios
        | Versión  | Fecha      | Técnico | Cambios |
        |----------|------------|---------|---------|
        | 01.00.00 | 12.09.2023 | (ABH)   | Primera version. |
        *)
        END_REGION DESCRIPCION
        
        
        //  ==========================================================================================================
        REGION GESTION_TIPO
            
            //  Gestion de tipo
            CASE #Area OF
                0:
                    #t_Area := #INPUT;
                1:
                    #t_Area := #OUTPUT;
                2:
                    #t_Area := #MARCAS;
                3:
                    #t_Area := #DB;
                4:
                    #t_Area := #PERIFERIA;
                    
                ELSE
                    #t_Area := #INPUT;
            END_CASE;
            
        END_REGION GESTION_TIPO
        
        
        //  ==========================================================================================================
        REGION LECTURA
            
            //  Lectura de entrada analogica
            #t_Input := WORD_TO_INT(PEEK_WORD(area := #t_Area, dbNumber := 0, byteOffset := #ByteEntrada));
            
        END_REGION LECTURA
        
        
        //  ==========================================================================================================
        REGION SALIDAS    
                
                //  Gestion de salidas
                #Input_Raw := #t_Input;
                #Input_0_100 := (DINT_TO_REAL(#t_Input) * 100) / #VALOR_MAX_TARJETA;
            
        END_REGION SALIDAS
        
    END_NETWORK
END_FUNCTION_BLOCK
