恭喜,你发布的帖子
发布于 2017-08-04 08:57:03
3楼
上面 的 程序 图片 看起来 比较 我 转换 了 文本 麻烦..
FUNCTION "FECU_TYP_J": VOID
TITLE =
// actual value acquisition FeCu type J
// maximum measuring points = 16
//
//
// Data interface: FL_Takt = edge Time standard (100 ms)
// Measurement_Cycle = Measurement every N seconds
// PEW_Start = Address of the AD module
// Actual value_DB = Data block Actual values
// Istw_DW_Start = Start DW actual values
// Number = number of measurements
// Offset_DB = Data block offset values
// Offset_DW_Start = Start DW offset values
// Error_DB = Data block sensor break
// Error_DB_Start = Start DB Sensor break
// Error_Bit_Start = Start Bit Sensor break
//
{S7_language: = '7 (1) German (Germany) 28.01.2016 09:38:44'}
AUTHOR: WDS
NAME: FeCu
VERSION: 0.1
VAR_INPUT
FL_100mS: BOOL; // Edge time normal
Measurement_Cycle: INT; // Measurement every N seconds
PEW_Start: INT; // Address Peripheriewort
Actual value_DB: BLOCK_DB; // Data block Actual values
Istw_DW_Start: INT; // Start DW actual values
Number: INT; // Number of measurements
Offset_DB: BLOCK_DB; // Data block offset values
Offset_DW_Start: INT; // Start DW offset values
Komp_Temp: INT; // Temperature of the reference point
Error_DB: BLOCK_DB; // Data block sensor breakage
Error_Byte_Start: INT; // Start Byte Sensor break
Error_Bit_Start: INT; // Start Bit Sensor break
Release_Pruef: BOOL; // Enable sensor breakage test
END_VAR
VAR_IN_OUT
C_MessCycle: INT; // Counter for measuring cycle
END_VAR
VAR_TEMP
Number_measure_2: INT; // Number of measurements * 2
Index: INT; // Index counter
Bit_Count: INT; // Bit holder for sensor break
Byte_Count: INT; // Byte counter for sensor break
AD_value: INT; // AD value
Pointer_byte: INT; // Pointer Byte offset
Pointer_Bit: INT; // Pointer bit offset
END_VAR
BEGIN
NETWORK
TITLE = control intervall
A # FL_100mS;
JNB ending;
// Count the second measure
// --------------------------
L #C_MessCycle;
L 1;
+ I;
T #C_MessZyklus;
// Check whether time for new measurement has expired
// --------------------------------------------
L #Mess_Cycle;
> = I;
JNB ending;
// new measurement
// ----------------------------
L 0;
T #C_MessZyklus;
NETWORK
TITLE = Init. FC
L #Number; // Reading number of measurements
SLW 1; // and multiply by 2
T # number_measure_2;
L 0;
T #Index; // IndexCounter = 0
L #Fehler_Bit_Start; // Start Byte Sensor break
T #Pointer_Bit;
L #Fehler_Byte_Start; // Start Byte Sensor break
// T #Pointer_Byte // test
// If measuring points> 8 then higher byte address +1
// Because of LSB MSB
// ------------------------------------------------ -
// L 8 // test
// I // test
// SPBNB Loop // test
// Increment Start Byte
// ------------------------------------------------ -
// TAK // test
L 1;
+ I;
T #Pointer_byte;
NETWORK
TITLE = calculate pointers
Loop: L #PEW_Start; // Pointer to the beginning of the peripheral address
L #Index; // Load Index Counter
+ I; // Calculate the address of the peripheral address
ITD; // Integer -> double Integer
SLD 3; // Convert to the pointer format
L P # P 0.0; // Int. pointer
+ D; // Picture Pointeradr. O word
LAR1; // Load pointer to address register 1
NETWORK
TITLE = calculate analogue value
L W [AR1, P # 0.0]; // Read analog value
ITD;
DTR; // A-D value in Real
L 1.000000e + 000; // Conversion factor (1200.0 ° C -> 12000 units)
* R; // Multiply
RND; // A-D value in integer
T #AD_value; // secure AD value
NETWORK
TITLE = offsetcompensation
OPN #Offset_DB; // Offset D
自已去理解吧
请填写推广理由:
分享
只看
楼主