11 - 151 11 - 151
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
Program Example
10 ' Reads AnACPU floating point real numbers from D0 and D1 and convert them into single-
precision real numbers
30 DIM TBL%(5),A%(3)
:
' Defines array
40 TBL%(0)=255
:
' Sets communication station number to
local station
50 TBL%(1)=1
:
' Specifies to read the device memory data
60 TBL%(2)=2
:
' Specifies the word unit
70 TBL%(3)=18
:
' Specifies the data register
80 TBL%(4)=0
:
' Specifies the starting device number to be
read
90 TBL%(5)=2
:
' Specifies the number of points to be read
100 PCRD TBL%( ),A%( )
:
' Starts reading
105 A!=0
:
' Stores dummy in A!
110 ZMOVE TO A!,0 FROM A%( ),0,4
:
' Stores data read from A!
120 B!=CVS(MKSMBF$(A!))
:
' Executes conversion
130 PRINT "Floating point real number from D0, D1-->";B!
140 END
REMARK
See the CVDMBF, CVSMBF, and MKDMBF$ functions.