CX3G FX3GC PLC Programming Manual - V9.51
CX3G FX3GC PLC Programming Manual - V9.51
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................................................................................................................................ 6
3.1 Special relay number and content......................................................................................................... 6
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
6. Application of high speed counter................................................................................................................ 30
7. Application of high speed pulse.................................................................................................................... 31
7.1 high speed pulse output....................................................................................................................... 31
7.2 Circular interpolation.......................................................................................................................... 31
7.2.1 Continuous interpolation function............................................................................................31
7.2.2 Continuous interpolation function............................................................................................34
8. Coolmay CX3G PLC Communication User Manual.................................................................................... 36
8.1 Serial port 1: RS232( PLC programming port)................................................................................... 36
8.2 Serial port 2: RS485(A B)/RS232....................................................................................................... 36
8.2.1 Mitsubishi programming port protocol.................................................................................... 37
8.2.2 Free port protocol..................................................................................................................... 38
8.2.3 Modbus RTU Protocol............................................................................................................. 38
8.2.4 MODBUS RTU ADPRW command....................................................................................... 42
8.3 Serial port 3:RS485(A1 B1)................................................................................................................ 44
8.3.1 Mitsubishi programming protocol............................................................................................47
8.3.2 Mitsubishi programming protocol............................................................................................47
8.3.3 Modbus RTU protocol RD3A/WR3A command..................................................................... 48
8.3.4 MODBUS RTU ADPRW Command.......................................................................................51
8.4 Modbus Communication address number........................................................................................... 52
8.4.1 Bit device:................................................................................................................................ 52
8.4.2 Word device:............................................................................................................................ 53
8.4.3 ADPRW Command function parameter.................................................................................. 53
8.5 CAN communication port................................................................................................................... 54
8.6 Network communication..................................................................................................................... 57
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. For CX3G PLC,regularly single phase 4 channels 60KHz、2 channels
10KHz or double phase 2 -3channels up to 60KHz, and could be customized as single phase 100khz
or 2 channels double phase 60khz+ 1 channel 10khz; For FX3GC PLC, regularly single phase 1
channels 100KHz、4 channels 20KHz or double phase 1 channels 60KHz、2 channels 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.
1
CX3G/FX3GC PLC Programming manual
◆Up to 40DI/40DO for CX3G PLC, up to 16DI/16DO for FX3GC PLC. Relay/transistor or
mixed relay and transistor for output.
◆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
T246~T249 4 points 0.001~32.767s
(EEPROM hold)
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
C200~C219 -2,147,483,648~+2,147,483,647
General bi-direction (32 bit) 20 points
counter
EEPROM hold bi-direction C220~C234 -2,147,483,648~+2,147,483,647
15 points
(32 bit) counter
High-speed counter
Single-phase single counter input -2,147,483,648~+2,147,483,647 Counter Software
C235~C245
Bi-direction (32 bit) (EEPROM counter
hold) Single phase:at most 6 channel, 60kHz
Single-phase double counter input Double phase:Double frequency:at most 2-3
C246~C250
Bi-direction (32 bit) (EEPROM channels,60KHz; M8198 is 4 times frequency sign of
hold) C251.
Double –phase double counter C251~C255 Quad frequency:at most 2-3 channels,
input 24kHz,M8199 is 4 times frequency sign of C253.
5
CX3G/FX3GC PLC Programming manual
Bi-direction (32 bit)(EEPROM
hold)
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
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 0~FFFF
Hexadecimal (H)
32 bit 0~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
10
CX3G/FX3GC PLC Programming manual
D8042 AD12 analog input value D8349 1st pulse deceleration time
D8043 AD13 analog input value D8350 Low
2nd position pulse amount
D8044 AD14 analog input value D8351 High
Y1 deviation speed
D8045 AD15 analog input value D8352
Initial value:0
D8050 DA0 analog output value D8353 Low
2nd pulse maximum speed
D8051 DA1 analog output value D8354 High
Y1 crawling speed
D8052 DA2 analog output value D8355
Initial value: 1000
D8053 DA3 analog output value D8356 Y1 Origin return speed Low
D8054 DA4 analog output value D8357 Initial value:50000 High
D8055 DA5 analog output value D8358 2nd pulse acceleration time
D8056 DA6 analog output value D8359 2 nd
pulse deceleration time
D8057 DA7 analog output value D8360 Low
3rd position pulse amount
D8058 When DA is current,Bit setting Refer to 2.7 D8361 High
Y2 deviation speed
D8059 Constant scan time D8362
Initial value:0
D8074 X0 Rising edge ring counter value Low D8363 Low
3rd pulse maximum speed
D8075 [1/6μs unit] High D8364 High
Y2 crawling speed
D8076 X0 falling edge ring counter value Low D8365
Initial value: 1000
[1/6μs unit]
D8077 High D8366 Y2 Origin return speed Low
D8078 X0 pulse width / pulse period Low D8367 Initial value:50000 High
D8079 [10μs unit] High D8368 3rd pulse acceleration time
D8080 X1 Rising edge ring counter value Low D8369 3 rd
pulse deceleration time
D8081 [1/6μs unit] High D8370 Low
4th position pulse amount
D8082 Low D8371 High
X1 falling edge ring counter value
Y3 deviation speed
D8083 [1/6μs unit] High D8372
Initial value:0
D8084 X1 pulse width / pulse period Low D8373 Low
4th pulse maximum speed
D8085 [10μs unit] High D8374 High
Y3 crawling speed
D8086 X3 Rising edge ring counter value Low D8375
Initial value:1000
[1/6μs unit]
D8087 High D8376 Y3 Origin return speed Low
12
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] ★
19
CX3G/FX3GC PLC Programming manual
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)
AD4 D8035
AD5 D8036
AD6 D8037
AD7 D8038
AD8 D8039
AD9 D8040
AD10 D8041
AD11 D8042
AD12 D8043
AD13 D8044
AD14 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
R23940~R23955 1 4~20mA input type uses
26
CX3G/FX3GC PLC Programming manual
27
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.
5.3 PID instruction
Detailed information please refer to <Mitsubishi FX3G Programming Manual>
The self-tuning method in the PID instruction has only a step response mode. The step value is
S0+22.
29
CX3G/FX3GC PLC Programming manual
30
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.
32
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.
33
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
shown :
=1:relative position
b3~b0
=2:absolute position
=0: clockwise rotation
b7~b4
=1: counterclockwise rotation
=1:linear mode interpolation
b11~b8 =2:center mode interpolation
=3: radius mode interpolation
=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.
34
CX3G/FX3GC PLC Programming manual
Program as below :
35
CX3G/FX3GC PLC Programming manual
36
CX3G/FX3GC PLC Programming manual
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 receiving completion mark, 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)
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)
37
CX3G/FX3GC PLC Programming manual
For the Mitsubishi protocol, the D8120 only needs to set the lower 8 bits.
b7 b6 b5 b4 b3 b2 b1 b0
Demo program:
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
38
CX3G/FX3GC PLC Programming manual
39
CX3G/FX3GC PLC Programming manual
Program example:
Slave program:
Host program:
40
CX3G/FX3GC PLC Programming manual
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.
Use the serial port tool to monitor the results:
[2017:07:05:17:41:20][receive]01 03 00 64 00 0A 84 12
[2017:07:05:17:41:20][receive]01 03 14 00 6F 00 DE 01 4D 01 BC 02 2B 02 9A 03 09 03 78 03 E7
00 00 7D 69
(This example sets the data of the slave D100-D109 to 111-999).
Program example:
Slave program:
41
CX3G/FX3GC PLC Programming manual
Master program:
Program explanation:
This program represents that 1 data of the register D301 in the master PLC is written to the PLC in
Slave 1, and is stored in the register D100 of the slave PLC.
Use the serial port tool to monitor the results:
[2017:10:31:16:47:22][receive]01 06 00 64 00 6F 88 39
[2017:10:31:16:47:22][receive]01 06 00 64 00 6F 88 39
No. 05: Force a single coil to force the on/off state (write bit) of a logic coil, range 1
No. 06: Load specific binary values into a retentive register (write register), range 1
No. 15: Force multiple coils, forcibly open and close a series of continuous logic coils (write
multiple bits), range 1-512
No. 16: Preset multiple registers, load specific binary values into a series of consecutive holding
registers (write multiple registers). Range 1-32
S. indicates the station number of the slave device to be read and written, the range is 0-32;
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.
Master program:
43
CX3G/FX3GC PLC Programming manual
Slave program:
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
differentiation
M8426=0 master-slave mode,
RS command CAN
- - M8426 M8426=1 multi-device
master-slave
mode
RS command end
0 1 2
operation settings
M8196=1
MODBUS RTU function M8192=1 -
M8125=1
RD3A\WR3A receiving
M8128 M8408 M8428 Need manual reset
completion
RD3A\WR3A
M8129 M8409 M8429 Need manual reset
communication over-time
ADPRW command Command execution end
M8029 M8029 M8029
completion mark mark
Communication parameters D8120 D8400 D8420
Communication mode - D8401 D8421
D8434 D8434:CAN slave station NO
Master-slave station number D8121 D8414 D8440 D8440\D8442 multi-device
D8442 mode ID NO
RD3A/WR3A overtime D8129 D8409 D8429 Unit: ms
RD3A/WR3A interval period D8126 D8406 D8426 26232 or higher version
RD3A\WR3A end
0 1 2
operation -1
ADPRW command settings D8126=0 D8126=1 D8126=2 26232 or lower version
ADPRW command settings D8397=0 D8397=1 D8397=2 26232 or higher version
CAN data frame - - M8427
M8192:the activation mark of using programming port protocol and other protocol. (26232 and
higher version is power lost not retentive)
M8402:Send mark (use when RS2 command).
M8403:Communication completion mark (communication completion flag when using RS
command, needs manual reset).
M8404: Data is receiving.
M8408:Communication completion mak (Valid while using ADPRW command and needs manual
reset).
M8409: Communication time out.
M8029: Communication completion mark (communication completion mark while using ADPRW
instruction and needs manual reset).
M8161: 8-bit/16-bit mode distinguishing mark for RS/RS2 command (version 26230 and above,
always in 8-bit mode)
D8400: Save the communication parameters of the Modbus RTU protocol
D8401: Save the communication mode of serial port 3. D8401=H11 represents PLC as Slave.
D8401=H1 represents PLC as Master; D8401=H0 represents the RS free communication mode.
D8406: Interval period. Default as 12 times.
45
CX3G/FX3GC PLC Programming manual
D8409: Time-out period. (Unit: ms. Better not over 100ms while setting.)
D8414: Save the master or slave station number (The value mast be set as max K255 as master).
D8126: When using the serial port 3 in the ADPRW instruction, set D8126 to 1. (26232 or lower
version)
D8397: When using the serial port 3 in the ADPRW instruction, set D8397 to 1. (26232 and higher
version)
46
CX3G/FX3GC PLC Programming manual
Master/Slave setting
b4 0: MODBUS Master
1: MODBUS Slave
b5~b15 Unavailable, Set 0
Program example:
Use the serial port tool to monitor serial port 3 for below 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.
47
CX3G/FX3GC PLC Programming manual
Program Example:
Slave program:
48
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
49
CX3G/FX3GC PLC Programming manual
Program Example
Slave program
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
50
CX3G/FX3GC PLC Programming manual
51
CX3G/FX3GC PLC Programming manual
Slave program
Use the serial port tool to monitor serial port 3 for below data:
[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
52
CX3G/FX3GC PLC Programming manual
53
CX3G/FX3GC PLC Programming manual
RD3A\WR3A receiving
M8128 M8408 M8428 Need manual reset
completion mark
RD3A\WR3A
communication M8129 M8409 M8429 Need manual reset
over-time mark
ADPRW command Command execution end
M8029 M8029 M8029
completion mark mark
Communication
D8120 D8400 D8420
parameters
Communication mode - D8401 D8421
D8434:CAN slave station
D8434
Master-slave station NO
D8121 D8414 D8440
number D8440\D8442 multi-device
D8442
mode ID NO
RD3A/WR3A time-out
D8129 D8409 D8429 Unit: ms
period
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
When RS2 support CAN, multiple channels can communicate with each other, ID(read 29
bit )=D8442;ID(write 29 bit)=D8440,at most 8 length.
29 digits indicate that the first three are useless. Multi-channel interconnection example:
LD M8000 RS2 D600 K8 D800 K8 K2
LD M8002 MOV H10 D8421
LDI M8422 ANI M8424 SET M8422
56
CX3G/FX3GC PLC Programming manual
also be set. Note: MAC addresses on the same network cannot be duplicated, otherwise
communication will be abnormal.
R23807,R23808 is the local IP address. Default:192 .168. 1 .250.Namely R23807=0XC0A8,
R23808=0X01FA.
R23810,R23811 is the MODBUS target IP,
R23812 Port default =502
R23813 default=100 (Cycle numbers) is the WR3A RD3A sequential execution interval.
R23814 default=20(200ms), is the MODBUS timeout setting, only retry twice, each time =
( R23814 * 5) ms.
R23815 is MODBUS InfoPacketSend. (26235 and higher version)
R23816 is MODBUS InfoPacketReceive. (26235 and higher version)
For specific operation explanation, please refer to WR3A and RD3A instructions of serial
port 2 or serial port 3
S.-1 address value must be set to 3. (=0: serial port 2; =1: serial port 3; =2: CAN; =3: MODBUS)
For example: WR3A D300 D400 D500,RD3A D300 D400 D500. The S.-1 address value
must be set to 3, Namely D499=3.
D499=0, It is serial port 2 MODBUS.
D499=1, It is serial port 3 MODBUS.
D499=2, It is CAN_MODBUS.
D499=3, It is Network MODBUS.
The slave response function code does not support 0X7 0X8 0XB 0XC 0X11, all others are
supported.
Currently the 26231 version has only 600 (GM_80)
58