11 - 41 11 - 41
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
CVS
Function
ConVert to Single
• Converts a character string, which was converted by the MKS$ function, back to a single
precision real number.
CVS ( <character string expression> ) [, S] )
Syntax
character string expression
• • • •
Specify the character string that was converted by
the MKS$ function.
A!=CVS(MS$)
• • • •
Converts the character string (MS$), which was
converted by the MKS$ function, back to the original
single precision real number and assigns it to A!.
Examples
B!=CVS(MS$, S)
• • • •
After replacing the contents of the character string
MS$, converts it back to the original single precision
real number and assigns it to B!.
Description
• The CVS function converts the character string, which was converted by the MKS$
function, back to the original numeric value.
• Since all the data, which is written into the random access file, has to be a character string,
a single precision real number is converted into a 4-byte character string by the MKS$
function before written into a file. Conversely, the 4-byte character string has to be
converted back to the original single precision real number when this data is read from the
file and to treat as a real number. The CVS function is used for this purpose.
• The CVS function can convert only the character string, which was converted by the MKS$
function, into a single precision real number. If other character stings are specified in
<character string expression>, normal data will not be returned or an "Illegal function call"
error occurs.
• The data, which was converted to a character string by the MKS$ function, can be used for
the data communication in addition to writing to a random access file.
• When the [, S] option is specified, the character string subject to the conversion is
rearranged as follows, then converted it into a single precision real number.
Original character string
L
H
L
H
1)
2)
3)
4)
!
4)
3)
2)
1)
Lower word
Higher word
Converts to a single
precision real number.
REMARK
See the MKS$ function.