The text of a manual · part 21 of 29
AnS(H) CPU User's Manual: APPENDICES, pages 157 to 166
Pages 157 to 166 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 157
APPENDICES
MELSEC-A
APPENDICES Appendix 1 Instructions Instructions used with the AnSHCPU are listed below. See the following programming manuals for details of the instructions. • ACPU Programming Manual (Fundamentals) • ACPU Programming Manual (Common Instructions) • AnSHCPU/AnACPU/AnVCPU Programming Manual (Dedicated Instructions)
(1)
(IB-66249) (IB-66250) (IB-66251)
Sequence instructions (a)
Contact instruction Contact
(b)
LD, LDI, AND, ANI, OR, ORI
Connection instruction Connection
(c)
ANB, ORB, MPS, MRD, MPP
Output instruction Output
(d)
OUT, SET, RST, PLS, PLF, CHK
Shift instruction Shift
(e)
SFT, SFTP
Master control instruction Master control
(f)
MC, MCR
Termination instruction Program end
(g)
FEND, END
Other instructions Stop
STOP
No operation
NOP
Page feed (page feed operation of printer output)
NOPLF
APP - 1
Page 158
APPENDICES
MELSEC-A (2)
Basic instructions (a)
Comparison instructions 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits
= <> > <= < >=
(b)
BIN arithmetic operation instructions 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits
+ Addition - Subtraction * Multiplication / Division +1 Addition -1 Subtraction
(c)
BCD 4 digits BCD 8 digits BCD 4 digits BCD 8 digits BCD 4 digits BCD 8 digits BCD 4 digits BCD 8 digits
- Subtraction * Multiplication / Division
Two types each for B+ and B+P Two types each for DB+ and DB+P Two types each for B- and B-P Two types each for DB- and DB-P B*, B*P DB*, DB*P B/, B/P DB/, DB/P
BCD - BIN conversion instructions BIN → BCD BCD → BIN
(e)
Two types each for + and +P Two types each for D+ and D+P Two types each for - and -P Two types each for D- and D-P *, *P D*, D*P /, /P D/, D/P INC, INCP DINC, DINCP DEC, DECP DDEC, DDECP
BCD arithmetic operation instructions + Addition
(d)
LD=, AND=, OR= LDD=, ANDD=, ORD= LD<>, AND<>, OR<> LDD<>, ANDD<>, ORD<> LD>, AND>, OR> LDD>, ANDD>, ORD> LD<=, AND<=, OR<= LDD<=, ANDD<=, ORD<= LD<, AND<, OR< LDD<, ANDD<, ORD< LD>=, AND>=, OR>= LDD>=, ANDD>=, ORD>=
16 bits 32 bits 16 bits 32 bits
BCD, BCDP DBCD, DBCDP BIN, BINP DBIN, DBINP
16 bits 32 bits 16 bits 32 bits 16 bits 32 bits 16 bits 16 bits
MOV, MOVP DMOV, DMOVP XCH, XCHP DXCH, DXCHP CML, CMLP DCML, DCMLP BMOV, BMOVP FMOV, FMOVP
Data transfer instructions Transfer Change Undefined transfer Block transfer Repeat data block transfer
APP - 2
Page 159
APPENDICES
MELSEC-A (f)
Program branch instructions Jump Subroutine call Interrupt program enable/disable Microcomputer program call
(g)
CJ, SCJ, JMP CALL, CALLP, RET EI, DI, IRET SuB
Refresh instructions Link refresh Link refresh enable/disable Partial refresh
(3)
COM EI, DI SEG
Application instructions
(a)
Logical operation instructions Logical product Logical product Exclusive logical sum NOT exclusive logical sum 2's complement (reversed sign)
(b)
Left ward rotation
Left ward shift
NEG, NEGP
16 bits 32 bits 16 bits 32 bits
ROR, RORP, RCR, RCRP DROR, DRORP, DRCR, DRCRP ROL, ROLP, RCL, RCLP DROL, DROLP, DRCL, DRCLP
16 bits Per device 16 bits Per device
SFR, SFRP, BSFR, BSFRP DSFR, DSFRP SFL, SFLP, BSFL, BSFLP DSFL, DSFLP
Data processing instructions Data search Bit check
Decode Encode Bit set Bit reset Dissociation Association
(e)
16 bits
Shift instructions Right ward shift
(d)
Two types each for WAND and WANDP DAND, DANDP Two types each for WOR and WORP DOR, DORP Two types each for WXOR and WXORP DXOR, DXORP Two types each for WXNR and WXNRP DXNR, DXNRP
Rotation instructions Right ward rotation
(c)
16 bits 32 bits 16 bits 32 bits 16 bits 32 bits 16 bits 32 bits
16 bits 16 bits 32 bits 2.MDSU/n. MDNM/ bits 16 bits 2.MDSU/n. MDNM/ bits 16 bits 16 bits 16 bits 16 bits
SER, SERP SUM, SUMP DSUM, DSUMP
BSET, BSETP BRST, BRSTP DIS, DISP UNI, UNIP
16 bits 16 bits
FIFW, FIFWP FIFR, FIFRP
DECO, DECOP SEG ENCO, ENCOP
FIFO instructions Write Read
APP - 3
Page 160
APPENDICES
MELSEC-A (f)
ASCII instructions ASCII conversion ASCII print
(g)
Buffer memory access instructions 1 word 2 words 1 word 2 words
Data read Data write
(h)
ASC Two types each for PR and PRC
FOR NEXT instruction Repetition
(i)
FOR, NEXT
Data link module instruction Data read Data write
(j)
1 word 1 word
LEDR
Other instructions WDT reset Fault check Status latch Sampling trace Carry flag set/reset Timing clock
(4)
LRDP, RFRP LWTP, RTOP
Display instruction Display reset
(k)
FROM, FROMP DFRO, DFROP TO, TOP DTO, DTOP
1 bit 1 bit
WDT, WDTP CHK SLT, SLTR STRA, STRAR STC, CLC DUTY
CC-Link dedicated instructions Link parameter setting Refresh parameter setting Read master station buffer memory Write to master station buffer memory Read buffer memory of intelligent remote station Write to buffer memory of intelligent remote station Write to buffer memory of intelligent remote station (with handshaking) Read buffer memory of intelligent remote station (with handshaking) Read to the word station link register Write to the word station link register Monitor the word station link register
APP - 4
RLPA RRPA RIFR RITO RIRD RIWT RISEND RIRCV RDGET RDPUT RDMON
Page 161
APPENDICES
MELSEC-A
Appendix 1.1 CC-Link Dedicated Instructions The instructions dedicated to CC-Link are designed to make automatic refresh setting for the AnSHCPU and master module/local module and to make data communication with a remote station connected to CC-Link. There are 11 different CC-Link dedicated instructions as indicated in Table 1. Table 1 CC-Link dedicated instruction list
Classification
Instruction name
Description
Instruction execution stations
Stations connected to CC-Link
Refer to
M
L
M
L
ID
RD
Network parameter setting
RLPA
Sets the network parameters to the master module of CC-Link.
ϒ
×
×
×
×
×
App 1.1.2
Automatic refresh parameter setting
RRPA
Sets the automatic refresh parameters to the master/local module of CC-Link.
ϒ
ϒ
×
×
×
×
App 1.1.3
Read from automatic updating buffer memory RIFR
Reads the specified points of data from the automatic updating buffer memory of the master/local module.
ϒ
ϒ
×
×
×
×
App 1.1.4
Write to automatic updating buffer memory RITO
Writes the specified points of data to the automatic updating buffer memory of the master/local module.
ϒ
ϒ
×
×
×
×
App 1.1.5
Read from remote device station buffer memory
RIRD
Reads the specified points of data from the specified buffer memory of the remote device station.
ϒ
ϒ
ϒ
ϒ
ϒ
×
App 1.1.6
Write to remote device station buffer memory
RIWT
Writes the specified points of date to the specified buffer memory of the remote device station.
ϒ
ϒ
ϒ
ϒ
ϒ
×
App 1.1.7
RIRCV
Reads the specified points of data from the specified buffer memory of the intelligent device station. Handshake is performed using a handshake signal.
ϒ
×
×
×
ϒ
×
App 1.1.8
Write intelligent device station buffer memory (with handshake)
RISEND
Writes the specified points of data to the specified buffer memory of the intelligent device station. Handshake is performed using a handshake signal.
ϒ
×
×
×
ϒ
×
App 1.1.9
Read from remote device station
RDGET
Reads data from a remote device station.
ϒ
×
×
×
×
ϒ
App 1.1.10
Write to remote device station
RDPUT
Writes data to a remote device station.
ϒ
×
×
×
×
ϒ
App 1.1.11
Remote device station monitoring
RDMON
Monitors a remote device station.
ϒ
×
×
×
×
ϒ
App 1.1.12
Read from intelligent device station buffer memory (with handshake)
REMARKS 1) "M", "L", "ID" and "RD" in Table 1. denote the following : • M : Master station • L : Local station • ID : Intelligent device station • RD : Remote device station 2)
In the "Instruction Execution Stations" and "Object Stations" fields of Table 1, ϒ denotes that the corresponding station is available and × unavailable. However, since the availability of the dedicated instructions in Table 1 changes with the module of the station connected to CC-Link, refer to the manual of the module used to confirm the availability.
APP - 5
Page 162
APPENDICES Instructions for use of the CC-Link dedicated instructions (1)
Different intelligent device stations have different buffer memory capacities. Refer to the manual of the intelligent device station used.
(2)
Only one of the RIRD, RIWT, RISEND and RIRCV instructions may be executed for the same station. If two or more of the RIRD, RIWT, RISEND and RIRCV instructions are executed, the second and subsequent instructions are ignored.
(3)
RDGET, RDPUT and RDMON may be executed for the same station separately. Any of these instructions cannot be executed in two or more locations for the same station. If any of RDGET, RDPUT and RDMON instructions is used in two or more places, the second and subsequent instructions are ignored.
(4)
RIRD, RIWT, RISEND, RIRCV, RDGET, RDPUT and RDMON may be executed for different stations at the same time. Note that up to 64 instructions may be executed simultaneously.
(5)
The data of any devices used by the CC-Link dedicated instruction should not be changed until the completion of the instruction. If the data of the device is changed during execution of the instruction, the CC-Link dedicated instruction cannot be completed properly.
(6)
Specify the head I/O number of the master/local module in the CC-Link dedicated instruction. This head I/O number of the master/local module is the value in the upper 2 digits of the master/local module's I/O number represented in 3 digits. For example, when the master/local module's I/O number is X/Y120, the head I/O number is 12H. Power supply module
1.1.1
MELSEC-A
A n S H C P U
A 1 S X 42
A 1 S X 42
A 1 S Y 42
A 1 S Y 42
A 1 S Y 41
A 1 S J 61 B T 11
X00
X40
X80
YC0
Y100
120 to to to to to to
X3F
X7F
XBF
YFF
Y11F
13F
I/O number
Head I/O number : 12H
APP - 6
Page 163
APPENDICES
X
Y
M
L
S
B
F
T
C
D W R A0 A1 Z
V
Constant
Pointer Levle
K
P
H
I
N
Index
Word device
Subset
Available device Bit device
Number of steps
Network parameter setting .......... RLPA Digit designation
1.1.2
MELSEC-A
Carry flag Error flag M9012
M9011 n 23
D1 D2
Command LEDA/LEDB
RLPA
SUB n
LEDC
D1
LEDC
D2
LEDA·······Executed while ON LEDB·······Executed at leading edge LEDC······ Device number designated SUB·········Constant designated
LEDR
Network Parameter Data
(1)
Data to be set n
Head I/O number of object master module
D1
Head number of devices which stores link parameters
D2
Host station's bit device number which is switched on on completion of execution
Network parameter setting items D1 +0
Synchronous mode valid/invalid
D1 +1
Number of stations connected for communication
D1 +2
Slave station setting information to
Set values for the number of stations connected for communication.
Slave station setting information Sending buffer size Receiving buffer size to
Set values for one local/intelligent device station.
Automatic buffer size to Sending buffer size Receiving buffer size D1 +n
(2)
Automatic buffer size
Number of points required for the network parameter area The following points are required for the network parameter setting : • Synchronous mode...........1 point valid/invalid setting • Communication station .....1 point count setting • Slave station setting..........Number of points for the number of slave information stations connected for communication • Sending buffer size ...........Number of points for the number of local and intelligent device stations • Receiving buffer size ........Number of points for the number of local and intelligent device stations • Automatic update..............Number of points for the number of local buffer size and intelligent device stations
APP - 7
Page 164
APPENDICES
MELSEC-A (3)
Network parameter settings
Item Synchronous mode valid/invalid
Number of stations connected for communication
Setting range
Setting end
Set whether the synchronous mode is valid or invalid. • When synchronous mode is valid : 0 • When synchronous mode is invalid : 1
Set data
0/1
User
Set the number of slave stations connected to the master module of CC-Link.
1 to 64
User
Set the slave station type, number of slave stations occupied, and station number as indicated below : b15 to b12 b11 to b8 b7 to b0, Station number Number of slave stations occupied Slave station type
Slave station setting information b0 to b7 1 to 64 (1H to 40H)
• Station number setting 1 to 64 (Setting with BIN)
User
• Set the number of slave stations occupied Number of slave stations occupied
Setting
1 station
1
2 station
2
3 station
3
4 station
4 b8 to b11 1 to 4
• Slave station type setting Slave station type
Setting
Remote I/O station
0
Remote device station
1
Local station
2 b12 to b15 0 to 2
Intelligent device station
Sending buffer size
Set the number of points transmitted from the master station to a local/intelligent device station.
*
User
Receiving buffer size
Set the number of points transmitted from a local/intelligent device station to the master station.
*
User
Automatic updating buffer size
Set the number of points of the automatic updating buffer used by the master station and local/intelligent device station.
*
User
* : To be set in response to the module used.
APP - 8
Page 165
APPENDICES Functions
MELSEC-A (1)
When the RLPA instruction is executed, the network parameter data set to the devices beginning with the one specified at D1 is set to the master module specified at n . AnSHCPU
Master module n
D1 +0
Network parameter data to
Network parameter setting
Network parameters
D1 +n
(2)
When the slave station type specified is a local/intelligent device station, it is necessary to set the "sending buffer size", "receiving buffer size" and "automatic updating buffer size". When the slave station type is a remote I/O station or a remote device station, it is not necessary to set the "sending buffer size", "receiving buffer size" and "automatic updating buffer size". Local station Remote I/O station Remote device station Intelligent device station Sending buffer size Receiving buffer size Automatic buffer size Sending buffer size Receiving buffer size Automatic buffer size
Sending buffer size, receiving buffer size and automatic buffer size need not be set. Set sizes for local and intelligent device stations successively. For remote I/O and remote device stations, their buffer sizes are not set. When setting for the other stations, therefore, start setting with the frontmost empty position.
(3)
After setting of the network parameters, if the RLPA instruction is executed again during RUN to change the network parameters, new data is not used for communication with the slave stations. When the AnSHCPU is switched to STOP/PAUSE, then to RUN, the new network parameters are used for communication with the slave stations.
APP - 9
Page 166
APPENDICES Execution Conditions
MELSEC-A As shown below, when the LEDA instruction is used, the RLPA instruction is executed every scan while the write command is ON. When the LEDB instruction is used, the RLPA instruction is executed only one scan on the leading edge (OFF → ON) of the write command. Instruction Execution Step 0
Instruction Execution END
Step 0
Instruction Execution END
Step 0
Instruction Execution END
Step 0
Instruction Execution END
Step 0
Sequence program flow ON
Write command
OFF
RLPA (with LEDA)
RLPA (with LEDB)
Program Example
The following program sets the network parameters to the master module of CCLink allocated to I/O numbers 000 to 01F. (1)
Network parameter settings Set item
Set data
Device for storing data
Synchronous mode valid/invalid setting
Synchronous mode
1
D1000
Communication station count setting
1 module
1
D1001
Slave station type
Intelligent device station
2
Number of slave stations occupied
1 station
1
1
1
Slave station setting information
Station number
D1002
Sending buffer size
128 (80H) words
D1003
Receiving buffer size
128 (80H) words
D1004
Automatic buffer size
960 (600H) words
D1005
2)
Program
0
X0020
P H 0001
D1000
Synchronous mode valid setting
P H MOV 0001
D1001
Setting of number of communication stations
MOV
P H 2101
D1002
Setting of slave station setting information
MOV
P H 0080
D1003
Setting of sending buffer size
P H MOV 0080
D1004
Setting of receiving buffer size
P H MOV 0600
D1005
Setting of automatic updating buffer size
MOV
LEDB
RLPA SUB
K 0
LEDC D1000 LEDC L1000 LEDR
APP - 10
Designation of RLPA instruction