Mitsubishi QD51 Programming Manual page 382

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 reads buffer memory 1 of the special function module (A68AD)
110 '(Starting address of A68AD: &H80)
120 DIM TBL%(5),A%(0)
130 TBL%(0)=255
140 TBL%(1)=12
150 TBL%(2)=&H9
160 D!=&H94
170 H!=INT(D!/65536!)
180 L!=D!-H!*65536!
190 H$=RIGHT$("0000"+HEX$(H!),4)
200 L$=RIGHT$("0000"+HEX$(L!),4)
210 TBL%(3)=VAL("&H"+L$)
220 TBL%(4)=VAL("&H"+H$)
230 TBL%(5)=2
240 PCRD TBL%( ),A%( )
250 PRINT "Digital output of CH1=";A%(0)
260 END
(2) Program example for a format 2 control table
100 'A program example that reads buffer memory 1 of the special function module (A68AD)
110 '(Starting address of A68AD: &H80)
120 DIM TBL%(8),A%(0)
130 TBL%(0)=256
140 TBL%(1)=1
150 TBL%(2)=1
140 TBL%(4)=12
150 TBL%(5)=&H9
160 D!=&H94
170 H!=INT(D!/65536!)
180 L!=D!-H!*65536!
190 H$=RIGHT$("0000"+HEX$(H!),4)
200 L$=RIGHT$("0000"+HEX$(L!),4)
210 TBL%(6)=VAL("&H"+L$)
220 TBL%(7)=VAL("&H"+L$)
230 TBL%(8)=2
240 PCRD TBL%( ),A%( )
250 PRINT "Digital output of CH1=" ;A%(0)
260 END
11 - 212
:
'Defines arrays
:
'Specifies the station number to
communicate with to the local station
:
'Specifies to read buffer memory
:
'Specifies the module number
:
'Specifies the buffer memory address
:
'Upper byte of the buffer memory address
:
'Lower byte of the buffer memory address
:
'Stores the lower byte in the control table
:
'Stores the higher byte in the control table
:
'Specifies the number of bytes to be read
:
'Executes the read operation
:
'Displays the result
:
'Defines arrays
:
'Specifies a format 2 control table
:
'Specifies network number 1
:
'Specifies station number 1
:
'Specifies to read buffer memory
:
'Specifies the module number
:
'Specifies the buffer memory addresses
:
'Upper byte of the buffer memory address
:
'Lower byte of the buffer memory address
:
'Stores the lower byte in the control table
:
'Stores the higher byte in the control table
:
'Specifies the number of bytes to be read
:
'Executes the read operation
:
'Displays the result
MELSEC-Q
11 - 212

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents