The text of a manual · part 23 of 29
AnS(H) CPU User's Manual: APPENDICES, pages 177 to 186
Pages 177 to 186 of 242, from AnS(H) CPU User's Manual
The original document is the PDF (3.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Mitsubishi A1S38
Page 177
APPENDICES Program Examples
MELSEC-A The following program writes "ABCDEFGHIJ" to 200H and subsequent addresses of the automatic updating buffer memory for the station set to station number 1 in the master module of CC-Link allocated to I/O numbers 000 to 01F. 0
X0020
P K MOV 5
D10
Setting of number of points written (word)
P H MOV 4142
D11
Setting of written data "AB"
P H MOV 4344
D12
Setting of written data "CD"
P H MOV 4546
D13
Setting of written data "EF"
P H MOV 4748
D14
Setting of written data "GH"
P H MOV 494A
D15
Setting of written data "IJ"
LEDB RITO SUB
H 0000
SUB
K 1
SUB
H 0200
LEDC D10 SUB
K 6 LEDR
CIRCUIT EN
APP - 21
RITO instruction designation
Page 178
MEMO
APP - 22
Page 179
APPENDICES
X
Y
M
L
S
B
F
T
C
D W R A0 A1 Z
V
Constant
Pointer
Levle
K
P
N
H
I
Index
Word device
Subset
Available device Bit device
Number of steps
Read from remote station buffer memory ................RIRD Digit designation
1.1.6
MELSEC-A
Carry flag
Error flag
M9012
M9011 n1 n2
26
D1 D2
Data to be set Command LEDA/LEDB
RIRD
SUB n1
SUB n2
LEDC
D1
LEDC
D2
LEDA·······Executed while ON LEDB·······Executed at leading edge LEDC······ Device number designated SUB·········Constant designated
LEDR
Control Data
(1)
Head I/O number of object master/local module n2
Remote station number • When the host station is the master station : 1 to 64 0 to 64 • Local station :
D1
Device for storing control data and read data
D2
Bit device number which is switched on on completion of execution
Control data setting items D1 +0
Completion status
D1 +1
Number of points read
D1 +2
Remote station's object area
D1 +3
Buffer address
D1 +4 to
Read data storage area
D1 +n
(2)
n1
Control data
Stores data read from remote stationon completion of RIRD instruction execution. [Number of points specified at D1 +1]
Number of control data area points Data read from a remote station is stored into the area after the 4 points of control data [ D1 +0 to D1 +3]. Reserve the control data area for 4 points + [number of points specified at D1 +1] successively.
REMARKS 1)
A remote station is a generic term for an intelligent device station and a local station.
APP - 23
Page 180
APPENDICES
MELSEC-A (3)
Control data Item
Completion status
Set data Status on completion of instruction execution is stored. 0 : No error 1 Other than 0 : Error code *
Number of points read
Specify the number of data read (word basis). • Set "0004H" when accessing the buffer memory of an intelligent device station. Remote station's object • Set "2004H" when accessing the random area access buffer memory of a local station. Buffer memory address Specify the head address of the buffer memory.
Read data
Setting range
Setting end
System
1 to 480 *
2
User User
0004H 2004H *3
User
System
REMARKS 1) *1 : For error codes at error occurrence, refer to the following manual. Control & Communication-Link System Master · Local Module type AJ65BT11/A1SJ61BT11 User's Manual 2) *2 : Indicates the maximum number of data read. Set a value within the remote station buffer memory capacity and parameter-set receiving buffer area setting range. 3) *3 : Refer to the manual of the remote station from which data is read. When specifying the random access buffer memory, set the address with the head of the random access buffer memory defined as 0.
Functions
(1)
Reads the points of data specified at D1 +1 from the buffer memory address specified at [ D1 +3] in the remote station having the station number specified at n2 and connected to the master/local module specified at n1 , and stores that data into the devices starting from the one specified at D1 +4. On completion of reading, the bit device specified at D2 switches on only one scan. On abnormal completion, the bit device at D2 +1 switches on only one scan. RIRD instruction execution range
Master/local station n1
AnSHCPU
Remote station n2
Request RIRD instruction D1 +3
Buffer memory D1 +4
D1 +1
Reading of buffer memory data Specified device
(2)
The RIRD instruction may be executed for two or more remote stations at the same time. However, this instruction cannot be executed for the same remote station in two or more locations at the same time.
APP - 24
Page 181
APPENDICES
Execution Conditions
MELSEC-A (3)
Before executing the RIRD instruction, set the network parameters using the RLPA instruction (network parameter setting). If the RIRD instruction is executed without the network parameters set, abnormal completion will occur and "4B00H" will be stored into the completion status.
(4)
No processing will be performed if the number of read points specified at D1 +1 is "0".
When the LEDA instruction is used, the RIRD instruction is executed every scan while the read command is ON. When the LEDB instruction is used, the RIRD instruction is executed only one scan on the leading edge (OFF → ON) of the read command. Note that several scans will be required until the completion of read processing by the RIRD instruction. Therefore, execute the next RIRD instruction after the completion device has switched on. (The RIRD instruction executed before the completion of RIRD instruction execution is ignored.) END processing
END processing
END processing
END processing
Sequence program flow Executed
RIRD instruction execution complete
RIRD instruction ON Completion device
OFF Abnormal ON completion
On-completion status display device
OFF
Normal completion
1 scan During processing of RIRD instruction
Operation Error
Data can be read by RIRD instruction.
The following condition will result in an operation error and the error flag (M9011) switch on. Description
The number of read points specified at D1 +1 is outside the range 0 to 480.
APP - 25
Error code D9008
D9092
50
503
Page 182
APPENDICES Program Example
MELSEC-A The following program reads 1 point of data from 1A8H of the buffer memory of the intelligent device station having station number 1 and connected to the master module of CC-Link allocated to I/O numbers 000 to 01F. 0
X0020
P K MOV 1
D241
Setting of the number of read points
P H MOV 0004
D242
Setting of intelligent device station buffer memory
P H MOV 01A8
D243
Setting of buffer memory head address
LEDB RIRD SUB
H 0000
SUB
K 1 RIRD instruction designation
LEDC D240 LEDC M340 LEDR CIRCUIT END
APP - 26
Page 183
APPENDICES
X
Y
M
L
S
B
F
T
C
D W R A0 A1 Z
V
Constant
Pointer
Levle
K
P
N
H
I
Index
Word device
Subset
Available device Bit device
Number of steps
Write to remote station buffer memory .......... RIWT Digit designation
1.1.7
MELSEC-A
Carry flag
Error flag
M9012
M9011 n1 n2
26
D1 D2
Data to be set Write command LEDA/LEDB
RIWT
SUB n1
SUB n2
LEDC
D1
LEDC
D2
LEDA·······Executed while ON LEDB·······Executed at leading edge LEDC······ Device number designated SUB·········Constant designated
LEDR
Control Data
(1)
n1
Head I/O number of object master/local module n2
Remote station number • When the host station is the master station : 1 to 64 • Local station : 0 to 64
D1
Device for storing control data and written data
D2
Bit device number which is switched on on completion of execution
Control data setting items D1 +0
Completion status
D1 +1
Number of points written
D1 +2
Remote station's object area
D1 +3
Buffer address
D1 +4 to
Written data storage area
D1 +n
APP - 27
Control data
Stores data written to remote station by RIWT instruction. [Number of points specified at D1 +1]
Page 184
APPENDICES
MELSEC-A (2)
Control data Item
Set data
Completion status Number of points written
Setting range
Setting end
Status on completion of instruction execution is stored. 0 : No error 1 Other than 0 : Error code *
System
Specify the number of data written (word basis).
1 to 480 *
2
User
• Set "0004H" when accessing the buffer memory of an intelligent device station. Remote station's object • Set "2004H" when accessing the random area access buffer memory of a local station. Buffer memory address Specify the head address of the buffer memory.
Written data
0004H 2004H
User
*3
User
User
REMARKS 1) *1 : For error codes at error occurrence, refer to the following manual. Control & Communication-Link System Master · Local Module type AJ65BT11/A1SJ61BT11 User's Manual 2) *2 : Indicates the maximum number of data written. Set a value within the remote station buffer memory capacity and parameter-set receiving buffer area setting range. 3) *3 : Refer to the manual of the remote station to which data is written. When specifying the random access buffer memory, set the address with the head of the random access buffer memory defined as 0.
Functions
(1)
Writes the points of data specified at D1 +1 from the devices beginning with the one specified at D1 +4 to the buffer memory address specified at [ D1 +3] in the remote station having the station number specified at n2 and connected to the master/local module specified at n1 , and stores that data into. On completion of writing, the bit device specified at D2 switches on only one scan. On abnormal completion, the bit device at D2 +1 switches on only one scan. RIWT instruction execution range
Master/local module n1
AnSHCPU
Remote station n2
RIWT instruction D1 +3
Write to buffer memory D1 +4
Specified device
(2)
Buffer memory
D1 +1
The RIWT instruction may be executed for two or more remote stations at the same time. However, this instruction cannot be executed for the same remote station in two or more locations at the same time.
APP - 28
Page 185
APPENDICES
Execution Conditions
MELSEC-A (3)
Before executing the RIWT instruction, set the network parameters using the RLPA instruction (network parameter setting). If the RIWT instruction is executed without the network parameters set, abnormal completion will occur and "4B00H" will be stored into the completion status.
(4)
No processing will be performed if the number of written points specified at D1 +1 is "0".
When the LEDA instruction is used, the RIWT instruction is executed every scan while the write command is ON. When the LEDB instruction is used, the RIWT instruction is executed only one scan on the leading edge (OFF → ON) of the write command. Note that several scans will be required until the completion of write processing by the RIWT instruction. Therefore, execute the next RIWT instruction after the completion device has switched on. (The RIWT instruction executed before the completion of RIWT instruction execution is ignored.) END processing
END processing
END processing
END processing
Sequence program flow RIWT instruction execution complete
Executed RIWT instruction
ON Completion device
OFF ON
On-completion status display device
OFF
Abnormal completion Normal completion
1 scan During processing of RIWT instruction
Operation Error
Data can be written by RIWT instruction.
The following condition will result in an operation error and the error flag (M9011) switch on. Description
The number of written points specified at D1 +1 is outside the range 0 to 480.
APP - 29
Error code D9008
D9092
50
503
Page 186
APPENDICES Program Example
MELSEC-A The following program writes data 10 and 20 to 111H and 112H of the buffer memory of the intelligent device station having station number 1 and connected to the master module of CC-Link allocated to I/O numbers 000 to 01F. 0
X0020
P K MOV 2
D251
P H MOV 0004
D252
P H MOV 0111
D253
P K MOV 10
D254
Setting of written data "10"
P K MOV 20
D255
Setting of written data "20"
Setting of the number of written points Setting of intelligent device station buffer memory Setting of buffer memory head address
LEDB RIWT SUB
H 0000
SUB
K 1 RIWT instruction designation
LEDC D250 LEDC M250 LEDR CIRCUIT END
APP - 30