Mitsubishi QD51 Programming Manual page 495

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

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
Program Example
(1) Program example for a format 1 control table
100 'A program example that writes data to a Q/QnA series PLC CPU's device memory
110 DIM TBL%(10),A%(20)
120 TBL%(0)=255
130 TBL%(1)=515
140 TBL%(2)=144
150 D!=0
160 H!=INT(D!/65536!)
170 L!-D!-H!*65536!
180 H$=RIGHT$("0000"+HEX$(H!),4)
190 L$=RIGHT$("0000"+HEX$(L!),4)
200 TBL%(3)=VAL("&H"+L$)
210 TBL%(4)=VAL("&H"+H$)
220 TBL%(5)=16
230 A%(0)=&HF
240 PCWT TBL%( ),A%( )
250 END
11 - 325
• Assign values to %(3) and %(4) ( %(6) and %(7) in case of a format 2
control table, %(7) and %(8) in case of a format 3 control table) in the
following manner.
D!
• • • • • •
Device number of the device to be written
H!
L!
• • • • • •
Used as work areas.
H$
L$
to
100
H!=INT(D!/65536!)
110
L!=D!-H!*65536!
120
H$=RIGHT$("0000"+HEX$(H!),4)
130
L$=RIGHT$("0000"+HEX$(L!),4)
140
%(3)=VAL("&H"+L$) • • • • • • • • • •
150
%(4)=VAL("&H"+H$) • • • • • • • • • •
to
In case of a format 2 control table
%(6)=VAL("&H"+L$)
%(7)=VAL("&H"+H$)
:
'Defines arrays
:
'Specifies the station number to
communicate with to the local station
:
'Specifies to write data to device memory of
the Q/QnA series CPU
:
'Specifies internal relays M
:
'Splits into lower and higher digits
:
'Specifies the starting number (lower) of the
device to be written
:
'Specifies the starting number (higher) of
the device to be written
:
'Specifies the number of points to be
written
:
'Executes the write operation
MELSEC-Q
11 - 325

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents