FB DISPWRITE

VAR_INPUT
bWrite :BOOL;
bBlanking :BOOL;
nRow :UINT;
sData :STRING(16)
Legend
bWrite: rising edge starts the function block
bBlanking: FALSE backlight on, TRUE backlight off, default is on (supported in all BX controllers from FW 1.15).
nRow: row in display 1 or 2.
sData: displayed character string
VAR_OUTPUT
bBusy :BOOL;
bErr :BOOL;
iErrId :WORD;
Legend
bBusy: The function block is active as long it is TRUE.
bErr: Error bit.
iErrId: Error number.
Return parameter |
Meaning |
---|---|
0 |
No error |
> 0 |
Error number |
ST sample program
Download (sample file)
PROGRAM MAIN
VAR
fb_DispWrite1: FB_DispWrite;
i: INT;
udiCounter: UDINT;
strCounter: STRING;
strLine: STRING;
k: INT;
END_VAR
CASE i OF
0: strCounter:=CONCAT('Counter :',UDINT_TO_STRING(udiCounter));
fb_DispWrite1(bWrite:=TRUE , nRow:=1 ,sData:=strCounter );
IF NOT fb_DispWrite1.bBusy THEN
IF NOTfb_DispWrite1.bErr THEN
fb_DispWrite1(bWrite:=FALSE);
udiCounter:=udiCounter+1;
i:=1;
END_IF
END_IF
1: fb_DispWrite1(bWrite:=TRUE , nRow:=2 , sData:=strLine);
IF NOT fb_DispWrite1.bBusy THEN
IF NOTfb_DispWrite1.bErr THEN
fb_DispWrite1(bWrite:=FALSE);
k:=k+1;
strLine:=REPLACE(' ','#',1,k);
IF k=16 THEN
k:=0;
END_IF
i:=0;
END_IF
END_IF
END_CASE
display_test.prx
Display of ASCII table
Example for the "&" sign (see row 1 column 7): 00100110bin = 38dec = 26hex. In the PLC values this corresponds to '$26' (string.)