Mitsubishi QD51 Programming Manual page 566

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
VAL
Function
• Returns the value represented by a character string.
VAL(<character string expression>)
Syntax
character string expression
A=VAL("123")
Examples
• The VAL function returns the value represented by a character string.
Description
When a decimal string is specified
The first character in the string must be either space, +,
Specify digits only from the second character and onward.
Space, line feed, and tab characters exist in the string are ignored. In addition, if a
character that does not represent a numeric value is included, all characters from that
place to the end of the string are ignored.
Example
PRINT VAL(" -
PRINT VAL("
When an octal string is specified
The first and second characters in the string must be the "&0" characters, which indicate
an octal value.
Specify digits only from the third character and onward.
Space, line feed, and tab characters exist in the string are ignored. In addition, if a
character that does not represent a numeric value is included, all characters from that
place to the end of the string are ignored.
Example
PRINT VAL(" &01 2
PRINT VAL(" &012A3" )
When a hexadecimal string is specified
The first and second characters in the string must be the "&H" characters, which indicate a
hexadecimal value.
Specify digits and characters from A to F only from the third character and onward.
If characters other than digits and A to F are included in the string after the third character,
all characters from that place to the end of the string are ignored.
Example
PRINT VAL(" &H1A
PRINT VAL(" &H1A2!C" )
• 0 is returned if the first and second characters are not the prescribed characters.
• The VAL function is used to perform the calculation in double-precision.
11 - 396
VALue
• • • •
• • • •
1 2
3" )
12A3" )
3" )
2C" )
Specify the character string to be converted into a
numeric expression.
Assigns the value represented by the string "123" to A.
, or a digit.
-123
12
Octal
83 (123)
10
(12)
Hexadecimal
26 (1A)
418 (1A2)
MELSEC-Q
11 - 396

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents