/**********************************************************************
 * Function Block Factory Files Generator V 1.0                       *
 * This file was generated automatically!                             *
 * ==============================================                     *
 * DO NEVER MAKE CHANGES IN THIS FILE MANUALLY!!!                     *
 * ==============================================                     *
 * Date/Time: 31.07.00 12:54:26                                       *
 *                                                                    *
 *                                                                    *
 * Copyright 2000, Borst Automation, Fachingen                        *
 * All Rights Reserved                                                *
 *                                                                    *
 *         File Name: Iout.h                                          *
 *            Device: MyDevice                                        *
 *         Author(s):                                                 *
 *                    Walter Borst                                    *
 *                                                                    *
 * Revision History                                                   *
 * ================                                                   *
 * 2.11.1999, W. Borst:                                               *
 *   Initial Version                                                  *
 *                                                                    *
 **********************************************************************/
#ifndef __iout_h__
#define __iout_h__

/**********************************************************************
 * Includes                                                           *
 **********************************************************************/
#ifdef __IOUT_H__
  #include <String.h>
  #include "..\Common\Types.h"
  #include "..\Common\MemDecls.h"
  #include "..\Api\UserApi.h"
  #include "..\HrtSrvIn\HrtSrvIn.h"
#endif

/**********************************************************************
 * Function Block Parameters                                          *
 **********************************************************************/
#ifndef __IOUT_H__
  /*
   * Value for 20 mA current
   */
  extern    ROM  FLOAT co_flIoutUpperRange;

  /*
   * Value for 4 mA current
   */
  extern    ROM  FLOAT co_flIoutLowerRange;

  /*
   * Behaviour of current output on mal function
   * 0: set minimum value
   * 1: set maximum value
   * 2: hold last value
   * 3: set user value
   */
  extern EEPROM  UINT8 ee_ui8IoutFailMode;
  extern    RAM  UINT8 re_ui8IoutFailMode;
  extern    RAM  UINT8 rl_ui8IoutFailMode;

  /*
   * The current output value given by the measurement
   */
  extern    RAM  FLOAT re_flIoutActCurrent;
  extern    RAM  FLOAT rl_flIoutActCurrent;

  /*
   * Percent
   */
  extern    ROM  UINT8 co_ui8IoutRangeUnits;

  /*
   * Percent of range
   */
  extern    RAM  FLOAT re_flIoutActPercent;
  extern    RAM  FLOAT rl_flIoutActPercent;

  /*
   * Damping of current output
   */
  extern    ROM  FLOAT co_flIoutDamping;

  /*
   * For quick calculation of Iout
   */
  extern    RAM  FLOAT re_flIoutM;
  extern    RAM  FLOAT rl_flIoutM;

  /*
   * For quick calculation of Iout
   */
  extern    RAM  FLOAT re_flIoutA0;
  extern    RAM  FLOAT rl_flIoutA0;


/**********************************************************************
 * Automatically generated semaphores                                 *
 **********************************************************************/
  extern    RAM   BOOL se_bIoutParamChanged;
  extern    RAM   BOOL se_bIoutDynChanged;

#endif

/**********************************************************************
 * Standard Methods                                                   *
 **********************************************************************/
extern void IoutInit(void);
extern void IoutVerify(void);

extern void IoutPutParams(void);


/**********************************************************************
 * User Methods                                                       *
 **********************************************************************/

/*
 * Calculate M and A0 from Upper
 * and Lower Range
 * Remark: Example without unit
 */
extern VOID IoutCalcMandA0(
                            void
                          );
/*
 * To be called by the measurement
 */
extern VOID IoutProcessValue(
                              FLOAT flMeasuredValue
                            );
#endif
