#Variable

Top  Previous  Next

The #Variable object is used to display and/or input a numerical/alphanumerical variable.

 

Example

variable_1variable_3variable_2

 

Parameters

Object

Column A

M/O

Default

Description

#Variable

M


Display or/and input of a numerical/alphanumerical variable

Text/File

Column B

M/O

Default

Description

[text]<format>[text]

M


Static text can be combined with a format. These formats are described below.

Icon-HinweisSee also Unit systems

 

Formats

The following formats can be used to display the text in the variable object. See the basic template for an explanation:

 

Text %[Sign][IntegerDigits].[DecimalPlaces][Type] Text

 

Sign

Sign

Description

+

If this character is placed in front, a sign value ("+" or "-") is always specified.

0

If this character is placed in front, all unused characters are filled with 0.

 

Example

Input

Format

Output

10000

%+d

"+10000"

10000

%08d

"00010000"

 

Integer digits

Number, specifies the number of places to the left of the decimal point.

 

Example

Input

Format

Output

10000

%8d

"   10000"

 

Decimal places

Number, specifies the number of places to the right of the decimal point.

 

Example

Input

Format

Output

100.1111

%4.2f

" 100.11"

 

Type

Type

Description

Bits

b

Binary representation

16

lb

Binary representation

32

llb

Binary representation

64

d or i

Signed integer representation

16

ld or li

Signed integer representation

32

lld or lli

Signed integer representation

64

u

Unsigned integer representation

16

lu

Unsigned integer representation

32

llu

Unsigned integer representation

64

f or g

Signed floating point representation

32

lf or lg

Signed floating point representation

64

c

Letter

8

s

Text


x

Hexadecimal representation

16

lx

Hexadecimal representation

32

llx

Hexadecimal representation

64

e

Exponential representation

64

 

 

Icon-Hinweis        Integer values with decimal point

Integer values can be displayed on screen with a decimal point. A value of 1000 grams can thus be displayed on screen as kg 1.000 and also input in this way. In most cases, this eliminates the need for complex floating point arithmetic on the PLC (speed!).

 

Sample: %3.2d

 

 

Date and time formats

The DT and Time data types are configured as follows. This must be used for both the input and for the output screen:

%[<printout>]DT
%[<printout>]T

DT

Format

Description

Number of characters

Value range

d

Day of the month, represented by two digits

2

01-31

m

Month of the year, represented by two digits

2

01-12

y

Year, represented by two digits

2

00-99

Y

Year, represented by four digits

4

0001-9999

H

Hour, represented by two digits

2

00-23

M

Minute, represented by two digits

2

00-59

S

Second, represented by two digits

2

00-59

P

AM/PM - representation

The hours are converted and P is replaced by AM or PM.

 

See also: AM/PM time system

2

01-12 AM and

01-12 PM

p

am/pm - representation

The hours are converted and p is replaced by am or pm.

 

See also: AM/PM time system

2

01-12 am and

01-12 pm

a

Abbreviated day of the week, in the language of the operating system

2

Mon,Tue,Wed,Thu,Fri,Sat,Sun

A

Day of the week in full, in the language of the operating system


Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

b

Abbreviated month name, in the language of the operating system

3

Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec

B

Full month name, in the language of the operating system


January, February, March, April, May, June, July, August, September, October, November, December

 

Examples:

Format

Output

%[d.m.Y H:M:S]DT

26.01.2012 14:54:36

%[dd.mm.YY HH:MM:SS]DT

26.01.2012 14:54:36

%[d.m.Y H:M:S P]DT

26.01.2012 02:54:36 PM

%[A, d.B Y]DT

Thursday, 26 January 2012

 

 

Time

Format

Description

Number of characters

Value range

H

Hour, represented by one digit

1

0-9

HH

Hour, represented by two digits

2

00-23

M

Minute, represented by one digit

1

0-9

MM

Minute, represented by two digits

2

00-59

S

Second, represented by one digit

1

0-9

SS

Second, represented by two digits

2

00-59

MS

Millisecond, represented by one digit

1

0-9

MSMS

Millisecond, represented by two digits

2

00-99

MSMSMS

Millisecond, represented by three digits

3

000-999

 

Examples

Format

Output

%[H:M:S:MS]T

9:3:7:4

%[HH:MM:SS:MSMSMS]T

09:03:07:004

 

 

Icon-HinweisIf the formatted text should contain %-character, then two %-characters must be defined.

Example:

Format

Ausgabe

Val: %d %%

Val:    0 %

 

 

Font

Column C

M/O

Default

Description

<Fontname>.FNT

O

Current font

Font for displaying the scale

X, Y, DX, DY

Columns D-G

M/O

Default

Description

Integer constants

Variable of type INT

O

Autom. positioning

Position and dimension

Color

Column H

M/O

Default

Description

Color

O

Current foreground color

Font color

BackColor

Column I

M/O

Default

Description

Color

O

Current background color

Background color

Format

Column J

M/O

Default

Description

Format

O

No frame

Type of frame

 

Action

Column K

M/O

Default

Description


O


Only the value is displayed if an action is not specified.

SetVar

O


The SetVar actions are supported

#Page=<name>

O


Opens the keyboard page and sets the input focus

 

Icon-HinweisIndex Variablen

<name> may contain a variable name embraced by '%'

 

Sample #page=kbd_%/S/SYS/Kbd_Layout%

 

Opens a keyboard page depending on a system variable, e.g. for country specific keyboard layouts.

#Page=<name>%/S/App/keyb_layout%

O


Opens the keyboard page according to a system variable, e.g. for country-specific keyboard layouts

Edit

 


Activates the Edit mode

Limit1

Column L

M/O

Default

Description

 

<constant>

<variable>

O

VarType-Min

Lower limit value of the variable

...Numerical constant

...Variable of type VarType

Limit2

Column M

M/O

Default

Description

 

<constant>

<variable>

O

VarType-Max

Upper limit value of the variable

Variable of type VarType

ActionLimit1, ActionLimit2

Columns N,O

M/O

Default

Description

<action>

O


The standard LimitActions are available.

VarValue

Column P

M/O

Default

Description

<variable>

O


Value of the variable

VarType

Column Q

M/O

Default

Description

Data type

M


All data types are supported

VarState

Column R

M/O

Default

Description

<variable>

O


see Object status

Option

Column S

M/O

Default

Description

Pos={Center¦Left¦Right}

O

Pos=Left

Horizontal text, image alignment

 

Pos=Center

centered

Pos=Left

left aligned

Pos =Right

right aligned

 

The vertical alignment is centered per default

VPos={Top¦Bottom}

 

 

Vertical alignment of text or image

 

VPos=Top

top aligned

VPos=Bottom

bottom aligned



Mirror

O

 

Displays (mirrors) the current input of the #Variable object with the input focus, e.g. in the Keyboard page to display the currently edited variable

Set_focus

O

 

As soon as the object was loaded, it is set to the input mode

HelpText=<n>

O

 

If the object has the focus, the system variable /S/SYS/HelpText is set to <n>. The variable is reset to 0 as soon as it no longer has the focus. <n> must be an integer constant. In order, for example, to display a Help text in the Keyboard page

Verify

O

 

This option is used for verifying the input (e.g. for password input). The same value must be entered twice. If the same value was entered both times, the Close action is executed.

The /S/SYS/VariableVerify system variable of type WORD displays the status:

0 means that nothing has been entered yet.
1 means that the first value was entered.
2 means that the second value was incorrectly entered and that the input has to be repeated.
3 means that the same value was entered twice (verified)

This option can not be combined with set_focus!

CloseIfOk

O

 

If the entered value is within the limits, the Close action is executed.

Type=password

O

 

The object can be disguised for entering passwords. All characters are replaced with '*' during the input.

PWL=<level>

O

PWL=0

Required password level for enable

see also #Password object

select

O

 

Applies to (W)STRING Types only!

The existing string value will be selected, when the #variable object gets the input focus. erhält. So existing string value will be completely overwritten with the first character entered.

VarStateOnOffInverted

O

 

Inverts the On / Off functionality of the VarState Variable:

 

VarState = 0 -> Off

VarState = 1 -> On

 

 

Function

Columns T

M/O

Default

Description

<unit>function0,..</unit>

O


Conversion functions (see Unit systems)

 

Init, Exit

Columns U, V

M/O

Default

Description

<action>

O


The same actions are available as described for the Action parameter

 

 

Edit

In order to edit a variable object, it must be given the input focus.

The input focus is set via the following action:

 

Action

Description

#Page=<name>

With this action a Keyboard page is normally opened.

Edit

Edit via hard keyboard

 

The input focus can be set via the following option:

 

Option

Description

Set_focus

The focus is automatically set after the page is generated.

 

Edit mode

If the variable object is given the input focus, it is in Insert mode.

Insert mode

Characters are inserted at the cursor position as long as space is still available. If there is no more space available, no more characters are inserted. However characters are also not overwritten. The size of the input field is determined by the format string.

 

The format string determines the behavior.

Format string

Behavior

%s

With a string, the cursor is placed at the end of the text where all inputs are added.

%d, etc.

With all other formats, the content is not displayed but overwritten.

 

Selection mode

If the object with the active focus is clicked, the text is selected. If the text was already selected, this selection is cancelled.

Keyboard inputs have an effect on the entire selection:

 

Key

Behavior

Backspace or Delete

Deletes the entire selection

Character

All selected characters are overwritten

Control character

Cancels the selection

 

 

 

Icon-Hinweis        Time/date function

The DT variable type enables the time/date display in conjunction with the /S/SYS/DateTime system variable. The actual time is refreshed once a second. Special system variables are available for the time and date input.

See also

System variables

 

Icon-Hinweis        Actual time on the PLC

To transfer the actual time to the PLC, the #Sys2PLC object can be used in conjunction with the time system variables.

 

Icon-Hinweis        System variables

The following system variables are defined at the start of the input with the actual values and can, for example, be displayed on the screen keyboard page:

 

/S/SYS/Edit_val                …Last value before the input data type WSTRING
/S/SYS/Limit1                ...Lower limit value data type WSTRING
/S/SYS/Limit2                ...Upper limit value data type WSTRING
/S/SYS/HelpText        ...Contains the current Help text number data type WORD

 

Icon-Hinweis        Screen keypad

If a screen keyboard is called via the variable action #Page=<name>, this must be opened as a window! In other words, the screen page of the variable object and the keyboard must have different sizes or the keyboard page will be defined with the Popup option.

 

Difference to EPAM3

Option Mirror replaces system variable s_input_val