CX3G FX3GC PLC Programming Manual
CX3G FX3GC PLC Programming Manual
COOLMAY
CX3G/FX3GC PLC
Programming manual
(Difference comparing with Mitsubishi FX3G)
Content
1. Overview......................................................................................................................................................... 1
1.1 COOLMAY CX3G PLC has the following advantages:................................................................... 1
1.2 Models of CX3G PLC...........................................................................................................................3
1.3 Models of FX3GC PLC........................................................................................................................ 4
2. Soft element.................................................................................................................................................... 5
2.1 Soft element table..................................................................................................................................5
3. Special relay and register................................................................................................................................ 7
3.1 Special relay number and content......................................................................................................... 7
3.2 Special register number and content................................................................................................... 11
4. Function Instructions..................................................................................................................................... 15
5. Application of analog.................................................................................................................................... 22
5.1 Analog input........................................................................................................................................ 22
5.1.1 Analog input (temperature)...................................................................................................... 22
5.1.2 Analog input reading 1 (for software version 26210 and 26220)......................................... 24
5.1.3 Analog input reading 2 (for software version 26220)........................................................... 25
5.1.4 Analog input reading 3 (for software version 26230 and above)..........................................25
5.1.5 Analog input sampling............................................................................................................. 27
5.1.6 Analog input program example:...............................................................................................27
5.2 Analog output...................................................................................................................................... 29
5.3 PID Instruction.................................................................................................................................... 29
5.3.1 Outline...................................................................................................................................... 29
5.3.2 PID instruction format and parameter description................................................................... 29
5.3.3 Function and action description............................................................................................... 30
5.3.4 Notice....................................................................................................................................... 32
5.3.5 Example....................................................................................................................................33
6. Application of high speed counter................................................................................................................ 35
7. Application of high speed pulse.................................................................................................................... 36
7.1 high speed pulse output....................................................................................................................... 36
7.2 Circular interpolation.......................................................................................................................... 36
7.2.1 Continuous interpolation function............................................................................................36
7.2.2 Continuous interpolation function............................................................................................39
7.3 Pulse width modulation (PWM)..........................................................................................................41
7.3.1 Outline...................................................................................................................................... 41
7.3.2 PWM instruction format and parameter description................................................................ 41
7.3.3 Function and action description............................................................................................... 41
7.3.4 Program Example..................................................................................................................... 42
7.3.5 Special Note............................................................................................................................. 42
8. Coolmay CX3G PLC Communication Instructions...................................................................................... 44
8.1 MODBUS instruction interpretation and communication address..................................................... 44
8.1.1 RD3A/WR3A command function and action description:...................................................... 44
8.1.2 ADPRW command function and action description:............................................................... 45
8.1.3 Bit device Communication address number............................................................................ 45
8.1.4 Word device Communication address number........................................................................ 46
I
CX3G/FX3GC PLC Programming manual
8.1.5 ADPRW Command function parameter.................................................................................. 46
8.2 Serial port 1: RS232( PLC programming port)................................................................................... 47
8.3 Serial port 2: RS485(A B)/RS232....................................................................................................... 47
8.3.1 Mitsubishi programming port protocol.................................................................................... 49
8.3.2 Free port protocol function and example................................................................................. 49
8.3.3 Modbus RTU Protocol............................................................................................................. 50
8.3.4 MODBUS RTU ADPRW command....................................................................................... 53
8.3.5 Modbus ASCII Protocol........................................................................................................... 54
8.4 Serial port 3:RS485(A1 B1)................................................................................................................ 55
8.4.1 Mitsubishi programming protocol............................................................................................57
8.4.2 Mitsubishi programming protocol............................................................................................58
8.4.3 Modbus RTU protocol RD3A/WR3A command..................................................................... 58
8.4.4 MODBUS RTU ADPRW Command.......................................................................................60
8.4.5 Modbus ASCII Function.......................................................................................................... 62
8.5 CAN communication port................................................................................................................... 63
8.5.1 Free port protocol function.......................................................................................................65
8.5.2 Modbus RTU Function RD3A/WR3A command.................................................................... 66
8.5.3 Modbus RTU Function ADPRW command............................................................................ 68
8.6 Network communication..................................................................................................................... 69
8.6.1 Modbus RTU Function RD3A/WR3A command.................................................................... 71
II
CX3G/FX3GC PLC Programming manual
1. Overview
1.1 COOLMAY CX3G PLC has the following advantages:
◆Powerful, compatible with FX3G/FX3U/FX3S PLC, high processing speed.
◆Upper computer programming software compatible with Works 2/GX Developer8.86
◆Military level 32 bit CPU adopted, which is faster and more adapted to industrial environment of
high electromagnetic interference.
◆Special encryption, prevent illegal reading thoroughly. 8-bit encryption, 12345678 as
password can thoroughly prevent reading of ladder logic program.
◆Clock supported, rechargeable battery adopted.
◆With two PLC programming ports. CX3G PLC has one MiniB USB port with faster
downloading speed; one Rs232 programming port with 8 mouse hole sockets.FX3GC PLC has
one MiniB USB port with faster downloading speed; one Rs422 programming port with 8 mouse
hole sockets.
◆Support Mitsubishi programming port protocol/Modbus protocol/Rs protocol/BD board
protocol,easily achieve PLC communication with plc and other devices.
CX3G-16M/24M/32M/48M PLC is with 2 com ports. Default is with 2 RS485, or customized as 1
RS485+1 RS232, or 1RS485+ 1 CAN port, or 1RS232 + 1 CAN port.
CX3G-34M/64M/80M PLC is with 3 com ports. Default is with 2 RS485,or customized as 1
RS485+1 RS232,CAN port is optional for connecting HMI,VFD and other equipment.
For FX3GC-30M, 1 Rs485 can be added;
For FX3GC-16M, com ports/ analog can be added, at most 2 Rs485+1 CAN port+6AD4DA can be
added; or 1 Rs485+1 CAN port+8AD4DA can be added; or 1 RS485 +8AD6DA can be added, or 2
RS485 +1 CAN port can be added.
◆High speed counter, regular as single phase 6 channels 60KHz or AB(Z) phase 2 channels
60KHz+ AB phase 1 channel 10KHz.
◆High speed pulse, regular as 8 channels Y0-Y3 in 100KHz,Y4-Y7 in 10KHz, could be
customized as 8 channels 10-100KHz;
Note: High speed counter+High speed pulse should be less 480KHz.
◆Support multiple types analog individually or mixed ones for analog output and input.
Precision of AD/DA is 12bit.Temperature/current/voltage for input. current/voltage for output.
For CX3G PLC, at most 16DI/8DO. For FX3GC-16M, com ports/ analog can be added, at most 2
Rs485+1 CAN port+6AD/4DA can be added; or 1 Rs485+1 CAN port+8AD/4DA can be added; or
1 RS485+8AD/6DA can be added or 2 RS485+ 1 CAN port can be added.
◆Up to 40DI/40DO for CX3G PLC, up to 16DI/16DO for FX3GC PLC. Relay/transistor or
mixed relay and transistor for output.
1
CX3G/FX3GC PLC Programming manual
◆Convenient for wiring. CX3G adopts 5.00mm pluggable terminals. FX3GC adopts 3.5mm
pluggable terminals.
◆Easy installation. DIN-Rail (35mm width) installation and fixed hole installation.
◆Flexible, can be customized accordingly.
2
CX3G/FX3GC PLC Programming manual
Image
3
CX3G/FX3GC PLC Programming manual
Image
Dimension 90*60*32mm
Installation Fixed hole installation and DIN-Rail (35mm)
Digital I/O Up to 8DI/8DO Up to 16DI/14DO Up to 16DI/16DO
4
CX3G/FX3GC PLC Programming manual
2. Soft element
2.1 Soft element table
Name Contents
I/O relay
Input relay X000~X047 40points Soft element number is octal
Output relay Y000~Y047 40points Total 80points for I/O
Auxiliary relay
General M0~M383 384 points
EEPROM hold M384~M1535 1152 points
General*1 M1536~M7679*2 6144 points
Special*3 M8000~M8511 512 points
Status
Initial state (EEPROM hold) S0~S9 10 points
EEPROM hold S10~S899 890 points
Signal Alert (EEPROM hold) S900~S999 100 points
General*1 S1000~S4095 3096 points
Timer (ON delay timer)
200
100ms T0~T191 0.1~3,276.7s
points
10ms T200~T245 46 points 0.01~327.67s
1ms accumulative (EEPROM hold) T246~T249 4 points 0.001~32.767s
100ms accumulative
T250~T255 6 points 0.1~3,276.7s
(EEPROM hold)
1ms T256~T319 64 points 0.001~32.767s
Counter
General up counter (16bit) C0~C15 16 points 0~32,767 counter
EEPROM hold up counter 184
C16~C199 0~32,767counter
(16 bit) points
General bi-direction (32 bit) C200~C219 20 points -2,147,483,648~+2,147,483,647 counter
High-speed counter
Single-phase single counter input
C235~C245
Bi-direction (32 bit) (EEPROM -2,147,483,648~+2,147,483,647 Counter Software
hold) counter
Single-phase double counter input Single phase:at most 6 channel, 60kHz
C246~C250
Bi-direction (32 bit) (EEPROM Double phase:Double frequency:at most 2-3
hold) channels,60KHz; M8198 is 4 times frequency sign of
Double –phase double counter C251.
input C251~C255 Quad frequency:at most 2-3 channels,
Bi-direction (32 bit)(EEPROM 24kHz,M8199 is 4 times frequency sign of C253.
hold)
5
CX3G/FX3GC PLC Programming manual
Name Contents
Data register(32 bit when using in pair)
General(16bit) D0~D127 128 points
EEPROM hold (16 bit) D128~D7999 7872 points
Special (16 bit) D8000~D8511 512 points
Index (16 bit) V0~V7,Z0~Z7 16 points
Extended register·extended file register
R0~R22999 23000points Maintain when power off not supported
Extended register(16 bit) R23000~
1000points for system internal
R23999
Pointer
P0~P255 256 points CJ instruct、CALL
JUMP、CALL branch
P0~P1280 1281 points(26232 and above) instruct
Input interrupt I0□□~I5□□ 6points
Timer interrupt I6□□~I8□□ 3points
Counter interrupt I10□□~I60□□ 6points
Nest
Master control N0~N7 8points MC instruct
Constant
16 bit -32,768~+32,767
Decimal (K)
32 bit -2,147,483,648~+2,147,483,647
16 bit 0000~FFFF
Hexadecimal (H)
32 bit 00000000~FFFFFFFF
Real number(E)*3 -1.0×2128~-1.0×2-126,0,1.0×2-126~1.0×2128
32 bit
Can be in the form of a decimal point and index
*1: The 10ms timer will be affected by the scan cycle. If the scan period is 12ms, the timer becomes 12ms and is executed once.
6
CX3G/FX3GC PLC Programming manual
7
CX3G/FX3GC PLC Programming manual
9
CX3G/FX3GC PLC Programming manual
11
CX3G/FX3GC PLC Programming manual
13
CX3G/FX3GC PLC Programming manual
14
CX3G/FX3GC PLC Programming manual
4. Function Instructions
Applied instructions【Sequence is according to instruct variety】
15
CX3G/FX3GC PLC Programming manual
3. Comparison instructions
Mnemonic FNC No. Function Support
LD= 224 Contact compare LD (S1)=(S2) ★
LD> 225 Contact compare LD (S1)>(S2) ★
LD< 226 Contact compare LD (S1)<(S2) ★
LD<> 228 Contact compare LD (S1)≠(S2) ★
LD<= 229 Contact compare LD (S1)≦(S2) ★
LD>= 230 Contact compare LD (S1)≧(S2) ★
AND= 232 Contact compare AND (S1)=(S2) ★
AND> 233 Contact compare AND (S1)>(S2) ★
AND< 234 Contact compare AND (S1)<(S2) ★
AND<> 236 Contact compare AND (S1)≠(S2) ★
AND<= 237 Contact compare AND (S1)≦(S2) ★
AND>= 238 Contact compare AND (S1)≧(S2) ★
OR= 240 Contact compare OR (S1)=(S2) ★
OR> 241 Contact compare OR (S1)>(S2) ★
OR< 242 Contact compare OR (S1)<(S2) ★
OR<> 244 Contact compare OR (S1)≠(S2) ★
OR<= 245 Contact compare OR (S1)≦(S2) ★
OR>= 246 Contact compare OR (S1)≧(S2) ★
CMP 10 Compare ★
ZCP 11 Zone Compare ★
ECMP 110 Floating Point Compare ★
EZCP 111 Floating Point Zone Compare ★
HSCS 53 High speed counter set ★
HSCR 54 High speed counter reset ★
HSZ 55 High Speed Counter Zone Compare ★
HSCT 280 High speed counter table compare ★
BKCMP= 194 Block compare (S1)=(S2) ★
16
CX3G/FX3GC PLC Programming manual
17
CX3G/FX3GC PLC Programming manual
7. Rotate instructions
Mnemonic FNC No. Function Support
ROR 30 Rotation Right ★
ROL 31 Rotation Left ★
RCR 32 Rotation right With Carry ★
RCL 33 Rotation Left with Carry ★
8. Shift instructions
Mnemonic FNC No. Function Support
SFTR 34 Bit Shift Right ★
SFTL 35 Bit Shift Left ★
SFR 213 Bit Shift Right with Carry ★
SFL 214 Bit Shift Left with Carry ★
WSFR 36 Word Shift Right ★
WSFL 37 Word Shift left ★
SFWR 38 Shift Write [FIFO/FILO Control] ★
SFRD 39 Shift Read [FIFO Control] ★
POP 212 Shift Last Data Read [FILO Control] ★
20
CX3G/FX3GC PLC Programming manual
21
CX3G/FX3GC PLC Programming manual
5. Application of analog
This section refers to the software version query, the version number is stored in the special
register D8001, if necessary, please query the value of D8001.
The transmitter which is integrated inside PLC is one of the above table or mixed ones, it is up
to customers’s need when ordering.
23
CX3G/FX3GC PLC Programming manual
5.1.2 Analog input reading 1 (for software version 26210 and 26220)
Support FROM instruction or register directly read. Such as: FROM K0 K0 D400 K16, read
out 16 analog input, 0-10V.
The K-type thermocouple registers read values are shown in the following table:
NO Register Value
AD0 R23680
AD1 R23681
AD2 R23682
AD3 R23683
AD4 (Environment R23684
temperature)
AD5 R23685
AD6 R23686
AD7 R23687
AD8 R23688
AD9 R23689
AD10 R23690
AD11 R23691
AD12 R23692
AD13 R23693
AD14 R23694
AD15 R23695
When it is less than 3.8mA, the value is 32760, that is break value.
5.1.4 Analog input reading 3 (for software version 26230 and above)
Support FROM instructions or register read directly. Such as: FROM K0 K0 D400 K16 read
16 analog input, 0~10V.
The analog input of current, voltage, PT type and thermocouple type directly reads the register:
D[8030]~D[8045]. Constant scan time changed to D8059, started by M8039 (version 26232 and
higher).
NO Register Value
AD0 D8030
AD1 D8031
AD2 D8032
AD3 D8033
25
CX3G/FX3GC PLC Programming manual
AD4 D8034
(Environment temperature)
AD5 D8035
AD6 D8036
AD7 D8037
AD8 D8038
AD9 D8039
AD10 D8040
AD11 D8041
AD12 D8042
AD13 D8043
AD14 D8044
AD15 D8045
When the analog input has a thermocouple type, it can only do up to 15 channels, of which
AD4 is the ambient temperature of the thermocouple. 16 channels are possible without the
thermocouple type.
The value of the thermistor NTC is read in the 16th registers starting at R23660.
NO. Register value
AD0 R23660
AD1 R23661
AD2 R23662
AD3 R23663
AD4 R23664
(Environment temperature)
AD5 R23665
AD6 R23666
AD7 R23667
AD8 R23668
AD9 R23669
AD10 R23670
AD11 R23671
AD12 R23672
AD13 R23673
AD14 R23674
AD15 R23675
Except the thermistor NTC,all types of analog readings are read directly by D[8030]~D[8045],
so analog input type needs to be set as below:
Register No Read value Signal type Remark
R23940~R23955 0 0~10V(or 0~20mA) These 4 types analog
26
CX3G/FX3GC PLC Programming manual
Connect the signal terminal of the temperature sensor to the AD0 input of the PLC and the
other end to the GND of the analog input port.
When the PLC is running, the value of the data register D8030 corresponding to AD0 will be
transmitted to D0, the value of D0 will be put into D10 after floating point operation,
and then the floating point number division operation will be performed on D10, and then
operation result will be put into D20, the result D20 is the actual Temperature value.
In the ladder diagram, you can also directly divide the value of D8030.
Note: When the input is 0-10V analog, the actual analog value = register reading / 400;
When the input is temperature, the actual temperature value = register reading/10;
When the input is 0-20mA analog, the actual analog value = register reading / 200;
When the input is 4-20 mA analog, the actual analog value = register reading / 250 + 4.
The analog correction is corrected for the size. The following figure is an example of correcting
the AD0 temperature after acquisition:
If the current temperature is 37.9℃,the actual test is 47.9 ° C, the error is 10 ° C, you need to
modify the size correction register, show as below:
28
CX3G/FX3GC PLC Programming manual
In the above figure, when M0 is closed, the value -100 is transmitted to the correction register
R23960, and now you can see that the value of the actual measured temperature D20 is close to the
actual temperature which is 37.9 °C.
For example:
At this point, use a multimeter to check the voltage of the DA0 terminal, that is, the
multimeter's red pen is connected to the DA0 terminal, and the black pen is connected to the GND
terminal. The multimeter is displaying 5V voltage value.
Parameter Description:
Word software
Operand Type Content Data Type
component
Save data register number of the
S1. BIN16 bit D,R
target value (SV)
Save data register number of the
S2. BIN16 bit D,R
measured value (PV)
Save the data register number of the
S3. BIN16 bit D,R
parameter
Save data register number of the
D. BIN16 bit D,R
output register (MV)
Setting item
Occupied
Setting item Content
points
Target Set target value (SV)
S1. 1 point
value(SV) PID instruction does not change the setting contents
Measured
S2. The input value of the PID operation 1 point
value(PV)
Auto-tuning: step response method
a) ACT setting:when bit1,bit2,bit5 are all not "0",occupy 25points
25 points
Soft Component starting from the Initial Soft Component specified in
S3. Parameter
S3.
20 points
b) ACT setting:when bit1,bit2,bit5 are all "0",occupy 20points Soft
Component starting from the Initial Soft Component specified in S3.
30
CX3G/FX3GC PLC Programming manual
31
CX3G/FX3GC PLC Programming manual
5.3.4 Notice
When using multiple instructions: It can be executed multiple times at the same time (the
number of loops is not limited), but note that the S3 and D devices used in the operation cannot be
repeated.
Occupied points of parameter S3. : Step response method
1) ACT setting:when bit1,bit2,bit5 are all not "0",occupy 25points Soft Component starting from
the Initial Soft Component specified in S3.
2) ACT setting:when bit1,bit2,bit5 are all "0",occupy 20points Soft Component starting from the
Initial Soft Component specified in S3.
Step response mode: The self-tuning mode in the PID instruction has only a step response
32
CX3G/FX3GC PLC Programming manual
mode, and the step value is S0+22, which is the upper limit value.
When specifying the soft component in the power failure holding area:If D. is specified in
the program to hold the data register in the power failure, needs to clear the specified register at the
time of program startup.
Action flag:(version number is viewed in D8001)
version below 26232,bit 0=0 of S3+1 is positive action,bit0=0 is reverse action;;
version in and after 26232,bit 0=0 of S3+1 is a positive action, and bit0=1 is a
reverse action;
When heating, is reverse action.
5.3.5 Example
33
CX3G/FX3GC PLC Programming manual
34
CX3G/FX3GC PLC Programming manual
35
CX3G/FX3GC PLC Programming manual
Pulse point
Function Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
Description
Pulse operation M8340 M8350 M8360 M8370 M8151 M8152 M8153 M8154
monitoring
Position pulse D8340 D8350 D8360 D8370 D8140 D8142 D8144 D8160
(32bit) D8341 D8351 D8361 D8371 D8141 D8143 D8145 D8161
accelerate / D8348 D8358 D8368 D8378 D8148 D8148 D8148 D8148
decelerate time D8349 D8359 D8369 D8379
Pulse stop bit M8349 M8359 M8369 M8379 M8450 M8451 M8452 M8453
D8343 D8353 D8363 D8373 D8146 D8146 D8146 D8146
Maximum speed
D8344 D8354 D8364 D8374 D8147 D8147 D8147 D8147
The direction and coordinates of the center and radius interpolation are as shown in the following
table: (26234 version has no interpolation function)
26233 version and above 26235 version and above
Clockwise M8348 = 0 Clockwise M8435 = 0
Anticlockwise M8348 = 1 Anticlockwise M8435 = 1
Relative coordinate M8344 = 0 Relative coordinate M8434 = 0
Absolute coordinate M8344 = 1 Absolute coordinate M8434 = 1
D8340 shows the current address of X axis,D8350 shows the current address of Y axis。
In CoolMay 3G PLC,interpolation motion still adopts DPLSR for pulse output.
37
CX3G/FX3GC PLC Programming manual
In the Center interpolation: D100 speed, D102 is the X-axis target address, D104 is the Y-axis
target address, and D106 is the center X address. D108 is the center Y address. Y0 and Y1
respectively pulse the X-axis and Y-axis.
Note 1: The current address of X and Y must be on the same circle as the destination address.
Note 2: When the current address coincides with the target address, it indicates that the motion track
is a full circle.
In the radius interpolation: D100 speed, D102 is the X-axis target address, D104 is the Y-axis target
address, and D106 is the radius length. Y0 and Y1 respectively pulse the X-axis and Y-axis.
38
CX3G/FX3GC PLC Programming manual
pulse output.
In continuous interpolation mode, M8432~M8435 are determined by the 5th parameter (ie S.+10).
The function description of each bit of the 32-bit register S2.+8 is as follows:
32bit
b31~b28 b27~b24 b23~b20 b19~b16 b15~b12 b11~b8 b7~b4 b3~b0
position
Continuous interpolation
Position Interpolation Interpolation
Function execution and stop
mode direction mode
Flag position
When S2.+8 is used, it is expressed in hexadecimal. The bit values of each group are as below:
=1:linear mode interpolation
b3~b0 =2:center mode interpolation
=3: radius mode interpolation
=0: clockwise rotation
b7~b4 =1: counterclockwise rotation
= any other value: linear mode
=1:relative position
b11~b8
=2:absolute position
=00000:continuous interpolation execution
b31~b12
=AAAAA:continuous interpolation stop
PS: When using linear mode interpolation, b7~b4 is ignored and can be set to any value from 2~F.
S1. and S2. may be set discontinuous. For example, S1.=D100, S2.=D120.
S2. Must be consecutive with the next four 32-bit registers. For example, it must be set to D102,
D104, D106, D108, D110.
39
CX3G/FX3GC PLC Programming manual
Program as below :
40
CX3G/FX3GC PLC Programming manual
Parameter description:
Operand
Content Data type Word software component Range
type
Notes.
Value of the pulse width S1. and the period S2. should be set: S1.≦S2.。
When instruction input is OFF, Output from D. is also OFF.
Do not operate the setting switch of the pulse output mode during pulse emission.
41
CX3G/FX3GC PLC Programming manual
In this example, the data range of D10 is changed from 0 to 50, and the average output of Y0 is
0 to 100%. If D10 data >50, it will be wrong.
R >> P
t = R(KΩ)* C(µF) = 470ms >>T0
Compared to the pulse period T0,the time constant τ of the filter is a very large value.
43
CX3G/FX3GC PLC Programming manual
ADPRW :
S. indicates the station number of the slave device to be read and written, the range is 0-247;
S1. indicates the function code (that is, the functions NO 01-06, 15, and 16 );
S2. The function parameter corresponding to each function code (the operand indicates the
MODBUS start address when the function is 01);
S3. The function parameters corresponding to each function code (the operand indicates the number
of access points when the function is 01, and the parameter is fixed to 0 when the 05 function is
used);
D. indicates the starting position of the data storage device.
completion
RD3A\WR3A
M8129 M8409 M8429 Need manual reset
communication over-time
ADPRW command
M8029 M8029 M8029 Command execution end mark
completion mark
Bit12=0:MODBUS
Communication RTU(Default)
D8120 D8400 D8420
parameters Bit12=1:MODBUS ASCII
(26236 and higher version)
Communication mode - D8401 D8421
D8434 D8434:CAN slave station NO
Master-slave station
D8121 D8414 D8440 D8440\D8442 multi-device
number
D8442 mode ID NO
RD3A/WR3A overtime D8129 D8409 D8429 Unit: ms
RD3A/WR3A interval
D8126 D8406 D8426 26232 or higher version
period
RD3A\WR3A end
0 1 2
operation -1
ADPRW command
D8126=0 D8126=1 D8126=2 26232 or lower version
settings
ADPRW command
D8397=0 D8397=1 D8397=2 26232 or higher version
settings
CAN data frame - - M8427
M8196: the activation mark of using programming port protocol and other protocol. (26232 or
higher version is power lost not retentive.)
M8125: the activation flag of using MODBUS and the original Mitsubishi function.
M8122: RS2 command send mark (this bit needs to be set 1 when using the RS instruction).
M8123: RS2 command receiving completion mark, needs manual reset.
M8124: RS2 command data is receiving.
M8161: 8-bit/16-bit mode distinguishing flag for RS/RS2 instruction (used in version 26230 and
above, always in 8-bit mode in versions 26210 and 26220)
M8128: RD3A/WR3A Receive correct , needs manual reset.
M8129: RD3A/WR3A communication overtime mark (this mark is ON while communication
overtime).
M8029: Communication completion flag (communication completion flag when using ADPRW
instruction, needs to be reset by hand).
D8120: The detailed communication parameter settings of saving Modbus RTU protocol are seen as
below.
D8121: Save the host or slave station number. (It must be set as max. K255 as master)
D8129: RD3A and WR3A time-out period. (Unit: ms. Better not over 100ms while setting).
D8126: When using the serial port 2 in the ADPRW instruction, set D8126 to 0. (26232 or lower
version)
48
CX3G/FX3GC PLC Programming manual
D8126: Interval period. Default as 10 times. (26232 or higher version uses this register.)
D8397: When using the serial port 2 in the ADPRW instruction, set D8397 to 0. (26232 and higher
version)
For the Mitsubishi protocol, the D8120 only needs to set the lower 8 bits.
b7 b6 b5 b4 b3 b2 b1 b0
Demo program:
49
CX3G/FX3GC PLC Programming manual
Use the serial port tool by serial port 2 to monitor the data obtained is
[2017:11:01:10:49:16][receive]31 32 33
Master program:
Program explanation:
D300 saves the numbers of registers read, which means that 10 data is read.
D299 must be set to 0.
This program represents that 10 data of the registers D100-D109 in the PLC with the slave station 1
are read and stored in the registers D301-D310 of the master station PLC.
51
CX3G/FX3GC PLC Programming manual
WR3A Program example (refer to 8.1.1):
Slave program:
Master program:
Program explanation:
This program represents that 1 data of the register D301 in the master PLC is written to the PLC in
52
CX3G/FX3GC PLC Programming manual
Master program:
Slave program:
53
CX3G/FX3GC PLC Programming manual
Use the serial port tool to monitor serial port 2 for below data:
[2017:11:01:17:48:54][receive]01 03 00 00 00 06 C5 C8
[2017:11:01:17:48:54][receive]01 03 0C 00 0C 00 17 00 22 00 38 00 4E 00 63 C4 29
Master program:
Slave program:
54
CX3G/FX3GC PLC Programming manual
Data of the Master D300~D303 before and after the program execution is showed as below.
port 3. Parameter zone settings are valid only for this channel. Invalid for serial port 2.
D8400 Parameter set
Bit number Content
Data length
b0 0:7 bit
1:8 bit
b1 Parity (b2,b1)
b2 00:None 01:Odd 11:Even
Stop bit
b3 0:1 bit
1:2 bit
Baud rate (b7 b6 b5 b4)
0100:600bps
0101:1200bps
b4 0110:2400bps
b5 0111:4800bps
b6 1000:9600bps
b7 1001:19200bps
1010:38400bps
1011:57600bps
1101:115200bps
Program example:
Use the serial port tool to monitor serial port 3 for data:[2017:11:01:11:49:16][receive]37 38 39
Last parameter of RS2 instruction =0: serial port 2;
=1: Serial port 3;
=2: CAN.
58
CX3G/FX3GC PLC Programming manual
Master program:
Use the serial port tool to monitor serial port 3 for below data:
[2017:11:01:09:00:11][receive]01 03 00 64 00 0A 84 12
[2017:11:01:09:00:11][receive]01 03 14 00 42 00 4D 00 58 00 58 00 63 00 37 00 2C 00 21 00 16
00 0B 9F C7
59
CX3G/FX3GC PLC Programming manual
Master program
Use the serial port tool to monitor serial port 3 for below data:
[2017:11:01:09:25:20][receive]01 10 00 64 00 08 10 00 0B 00 16 00 21 00 2C 00 37 00 42 00 4D
00 58 D1 6C
[2017:11:01:09:25:20][receive]01 10 00 64 00 08 10 00 0B 00 16 00 21 00 2C 00 37 00 42 00 4D
00 58 D1 6C
Master program
Slave program
Use the serial port tool to monitor serial port 3 for below data:
61
CX3G/FX3GC PLC Programming manual
[2017:11:01:17:38:34][receive]01 04 00 00 00 06 70 08
[2017:11:01:17:38:34][receive]01 04 0C 00 15 00 20 00 2B 00 41 00 57 00 00 5F A7
8.4.5 Modbus ASCII Function
When used as Modbus ASCII protocol,specific parameter setting pls refer to 8.4.3,Only the 8th
bit of D8401 is set differently,checking D8120 parameter setting in section 8.4.3.
Master program:
Slave program:
Data of the Slave D100~D109 before and after the program execution is showed as below
62
CX3G/FX3GC PLC Programming manual
63
CX3G/FX3GC PLC Programming manual
Master/Slave setting
b4 0: MODBUS Master
1: MODBUS Slave
b5~b7 Unavailable, Set 0
65
CX3G/FX3GC PLC Programming manual
Program example:
Master Program:
66
CX3G/FX3GC PLC Programming manual
Slave Program:
Monitoring the Master station program, the master station 16 data of D301-D316 change between
300-200 at a rate of minus 1 per second.
Master Program:
67
CX3G/FX3GC PLC Programming manual
Slave Program:
Monitoring the Slave station program, the slave station 16 data of D100-D115 change between
200-400 at a rate of plus 1 per second.
Master Program:
68
CX3G/FX3GC PLC Programming manual
Slave Program:
CAN port of the the PLC communicates with the CAN port of the slave PLC, and reads from the 4
bits M0~M3 of the slave PLC to the D0 of the master PLC.
70
CX3G/FX3GC PLC Programming manual
Slave Program:
71