User Manual

Interactive display
12/06 AWB2724-1584GB
80
Creating the program “Visualisation”
Depending on the status of auxiliary variable
“g_xFirstCycleAfterStartProgram” register the variables for which
the text/value is to be displayed:
X Program the function “Disp_RegisterVariable” with the
following example parameters: Disp_RegisterVariable
(`S1',ADR(g_sDisp_String1), Disp_TYP_STRING). Here the
variable is assigned the name S1.
X To display a value (type Byte) program a variable with the
function call Disp_RegisterVariable (‘V1’, ADR(byValue),
Disp_TYP_BYTE).
In this program section you can also define the position of the
variables on the display by specifying the Line and Column. Call
the function block (FB) “Disp_DisplayElement” and assign
parameters for the inputs sName, byLine, and byColumn, e.g.:
The element S1 with the text “motor1” would be displayed in the
first line starting from the first column.
In order to display/enter several elements call the function block
“Disp_DisplayElement” in the following program section that is
continuously processed and assign external inputs to the
“xEnable” inputs, e.g. I3.
X Start the programs.
Figure: 93: Function Disp_RegisterVariable
fbDisplayElement1.sName := 'S1';
fbDisplayElement1.byLine := 1;
fbDisplayElement1.byColumn := 1;
VAR
xIsDisplayEnabled: BOOL;
fbGetDisplayInfo: Disp_GetDisplayInfo;
fbDisplayElement1: Disp_DisplayElement;
fbDisplayElement2: Disp_DisplayElement;
fbDisplayElement3: Disp_DisplayElement;
fbDisplayElement4: Disp_DisplayElement;
byError: BYTE;
byValue: BYTE;
wValue: WORD;
END_VAR
------------------------------------------------------------
(* Initialisation in the first cycle after program start *)
IF g_xFirstCycleAfterStartProgram = TRUE THEN
Disp_ClearScreen(xEnable:=TRUE);
Disp_RegisterVariable('S1', ADR(g_sDisp_String1),
DISP_TYP_STRING);
Disp_RegisterVariable('S2', ADR(g_sDisp_String2),
DISP_TYP_STRING);
Disp_RegisterVariable('V1', ADR(PLC_PRG.byValue),
DISP_TYP_BYTE);
Disp_RegisterVariable('V2', ADR(PLC_PRG.wValue),
DISP_TYP_WORD);
fbDisplayElement1.sName := 'S1';
fbDisplayElement1.byLine := 1;
fbDisplayElement1.byColumn := 1;
fbDisplayElement2.sName := 'S2';
fbDisplayElement2.byLine := 3;
fbDisplayElement2.byColumn := 1;
fbDisplayElement3.sName := 'V1';
fbDisplayElement3.byLine := 1;
fbDisplayElement3.byColumn := 8;
fbDisplayElement3.byDigits := 4;
fbDisplayElement3.byPrecision := 1;
fbDisplayElement4.sName := 'V2';
fbDisplayElement4.byLine := 3;
fbDisplayElement4.byColumn := 8;
fbDisplayElement4.byDigits := 6;
fbDisplayElement4.byPrecision := 1;
(* The first cycle is completed, reset flag *)
g_xFirstCycleAfterStartProgram := FALSE;
END_IF
xIsDisplayEnabled := Disp_EnableDisplay(I1, I2);
fbDisplayElement1( xEnable:= I3 );
fbDisplayElement2( xEnable:= I5 );
fbDisplayElement3( xEnable:= I3 );
fbDisplayElement4( xEnable:= I5);