📄 iout.c
字号:
/**********************************************************************
* 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.c *
* Device: MyDevice *
* Author(s): *
* Walter Borst *
* *
* Revision History *
* ================ *
* 2.11.1999, W. Borst: *
* Initial Version *
* *
**********************************************************************/
/**********************************************************************
* The standard include *
**********************************************************************/
#define __IOUT_H__
#include "..\Iout\Iout.h"
/**********************************************************************
* Function Block Parameters *
**********************************************************************/
/*
* Value for 20 mA current
*/
ROM FLOAT co_flIoutUpperRange = 100;
/*
* Value for 4 mA current
*/
ROM FLOAT co_flIoutLowerRange = 0;
/*
* Behaviour of current output on mal function
* 0: set minimum value
* 1: set maximum value
* 2: hold last value
* 3: set user value
*/
EEPROM UINT8 ee_ui8IoutFailMode;
RAM UINT8 re_ui8IoutFailMode;
RAM UINT8 rl_ui8IoutFailMode = 0;
/*
* The current output value given by the measurement
*/
RAM FLOAT re_flIoutActCurrent;
RAM FLOAT rl_flIoutActCurrent = 0;
/*
* Percent
*/
ROM UINT8 co_ui8IoutRangeUnits = 57;
/*
* Percent of range
*/
RAM FLOAT re_flIoutActPercent;
RAM FLOAT rl_flIoutActPercent = 0;
/*
* Damping of current output
*/
ROM FLOAT co_flIoutDamping = 1;
/*
* For quick calculation of Iout
*/
RAM FLOAT re_flIoutM;
RAM FLOAT rl_flIoutM = 1;
/*
* For quick calculation of Iout
*/
RAM FLOAT re_flIoutA0;
RAM FLOAT rl_flIoutA0 = 0;
/**********************************************************************
* Automatically generated semaphores *
**********************************************************************/
RAM BOOL se_bIoutParamChanged;
RAM BOOL se_bIoutDynChanged;
/**********************************************************************
* Standard Methods *
**********************************************************************/
/*IIIIIIII*/
void IoutInit(void)
/*IIIIIIII*/
{ if (!M_API_IS_EE_VALID)
{ M_API_EE_WRITE(&ee_ui8IoutFailMode,&rl_ui8IoutFailMode,1);
}
else
{ M_API_EE_READ(&rl_ui8IoutFailMode,&ee_ui8IoutFailMode,1);
}
/* Always set semaphore to transfer settings to the event level */
se_bIoutParamChanged = TRUE;
/* Trigger watchdog in initialization routines, system not yet running */
M_API_TRIGGER_WATCHDOG;
}
/*##########*/
void IoutVerify(void)
/*##########*/
{ if (se_bIoutParamChanged)
{ re_ui8IoutFailMode = rl_ui8IoutFailMode;
re_flIoutM = rl_flIoutM;
re_flIoutA0 = rl_flIoutA0;
se_bIoutParamChanged = FALSE;
}
}
/*#############*/
void IoutPutParams(void)
/*#############*/
{ if (!bLowLevelLocked)
{ rl_flIoutActCurrent = re_flIoutActCurrent;
rl_flIoutActPercent = re_flIoutActPercent;
se_bIoutDynChanged = TRUE;
}
}
/**********************************************************************
* User Methods *
**********************************************************************/
/****************/
VOID IoutCalcMandA0(
/****************/
void
)
/*
* Calculate M and A0 from Upper
* and Lower Range
* Remark: Example without unit
*/
{
rl_flIoutA0 = co_flIoutLowerRange - co_flIoutLowerRange *
(co_flIoutUpperRange - co_flIoutLowerRange);
rl_flIoutM = co_flIoutUpperRange - co_flIoutLowerRange;
se_bIoutParamChanged = TRUE;
}
/*################*/
VOID IoutProcessValue(
/*################*/
FLOAT flMeasuredValue
)
/*
* To be called by the measurement
*/
{
/* Automatically generated call */
IoutVerify();
/* User's function body */
re_flIoutActCurrent = re_flIoutM * flMeasuredValue + re_flIoutA0;
/* Automatically generated call */
IoutPutParams();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -