Commissioning
2:
// Proceed with writing to CoE
fb_coe_writeEx();
IF NOT fb_coe_writeEx.bBusy THEN
wState := 0;// Done
bWriteLUT2CoE := FALSE;
bError := fb_coe_writeEx.bError; // See nErrId if TRUE
END_IF
END_CASE
END_IF
A simple variable query, e.g., via button linked with bEnable, can be used to initiate the transfer. The variable
declaration must contain
VAR_INPUT
bEnable AT%I* :BOOL;
END_VAR
and the following program lines:
IF bEnable AND NOT startWrite THEN
bWriteLUT2CoE := TRUE;
END_IF
4.3.3
Sample program 4 (generate LookUp table)
Download TwinCAT 3 project: https://infosys.beckhoff.com/content/1033/epp3504/Resources/
2152669707/.zip
Program description / function:
Inclusion of LookUp table interpolation values from a box module input signal to a field variable (and optional
subsequent transfer of the LookUp table interpolation values via CoE access to the box module using
sample program 3).
It is envisaged to use a ramp generator with a trigger input, whose level, in conjunction with an input of a
digital input terminal (e.g., EL1002) sets the variable "bStartRecord" to TRUE via a link (e.g., push button
connected to +24 V). This allows recording of the values to be synchronized with the ramp input voltage.
Alternatively, an output terminal can be used (e.g., EL2002), whose output controls the trigger input and
whose output is then set to TRUE via the TwinCAT development environment ("bStartRecord" would then
have to be declared as AT%Q* and linked to a terminal output).
Variable declaration sample program 4
// Variable declaration for example program 4
PROGRAM MAIN
VAR CONSTANT
nEndX : BYTE := 50; // Number of support values
END_VAR
VAR
nPAISampleIn AT%I* : DINT; // PDO PAISamples
bStartRecord AT%I* : BOOL; // +Electrical junction to trigger ramp
bGetMinMax : BOOL := FALSE;
bRecordLUT : BOOL := FALSE;
r_trigStartRecord : R_TRIG;
nX : BYTE := 0;
aValues : ARRAY[0..nEndX-1] OF DINT;
nYstepValue : DINT;
tp_timer : TP;
ton_timer : TON;
EPP3504-0023
Version: 1.2
93