Vous êtes sur la page 1sur 9
14 Serial Communications 14-4 Modbus-RTU Easy Master Function ‘The Modbus-RTU Easy Master Function can be used only with the CP1E N/NACIC\S)-type CPU Unit 14-4-1 Overview Using the Modbus-RTU Easy Master enables easy control of Modbus-compatible slaves, such as inverters, using serial communications. The serial communications mode is set to Modbus-RTU Easy Master. “ Modbus-RTU commands can be sent simply by turning ON a software switch after setting the Modbus slave address, function, and data in the DM fixed allocation words for the Modbus-RTU Easy Master. ‘The response when received is automatically stored in the DM fixed allocation words for the Modbus- RTU Easy Master. 14-4-2 Flow of Operation PLC Setup PLC Setup and transfer the PLC Setup from the CX-Pro- grammer to the CP1E CPU Unit. (Set the serial communi- cations mode to Modbus Easy Master, and set the communications conditions.) + Sot the Mocbus-RTU frame in the DM Fixed Allocation Gyclc tasks Words, + Turn ON the Modbus-RTU Master Execution Bit (A640.00 or A641.00}, Create ladder Program | Interrupt tasks (CPIE CPU Unit Software User's Manual(WA80) 14-11 onoung sasew Kee niaesnapow p-rb bree moyuono, 14 Serial Communications 14-4-3 Setting and Word Allocation DM fixed allocation words and Auxiliary Area words are allocated for the Modbus-RTU Easy Master according to the CPU Unit type and connected port as shown below. ‘CPIE CPU Unit serial port DM fixed allocation words | Auxiliary Area bits (CPIEN14/20 or Builtin RS-2320 pot | D1200 to D1299 ‘9640.00 10 AG40.02 N30/40/60S CPU Unit CPTENSO/40/60(S1) [Buitin RS-2326 pon _ [D120 10 D1299 ‘A640.00 10 AG40.02 orNA20.CPU Unit [Serial option port or _[D¥300 10 D1999 ‘AG4T.00 10 AGAT.O2 built-in RS-485 port @ DM Fixed Allocation Words on ees conn eae ee D1200, 11300, 00 to 07 [Command Slave address (00 to F7 hex) 08 to 15 Reserved (Always 00 hex.) |(See error codes in the following table. ) 08 to 15 Reserved (Always 00 hex.) Di254t0 01299 _|D1354t0 D1399 |00to 15 [Response data (92 bytes maximum) 14-12 (CPIE CPU Unit Software User's Manual(W480) 14 Serial Communications © Error Codes Code peal Daa 00 hox _| Normal ena Ot hex | egal aderess “The lave arose speciod nthe parartar is logal 48 or hae 2 hex [egal function code “The funtion code specified in he parameters eval z 03 hex _| Data length overflow There are more than 94 data bytes. = Othex | Serial communications mode | The Madbus-ATU Easy Waster funclion was exeouled whentho error ‘serial communications mode was not the Modbus-RTU Easy Mas- & ter Mode or when the option board is not equipped 5 Go hax | Response tconk “responce was rot oceved fom ho av < Bt hex |Party error ‘A parily error occurred. 4 82 hex | Framing eror A traming err ocoured i Ba hex | Overun error “An overrun eter occured g Bt hex ORC enor "ACRC error occured Fi @5hex | Incorrect confirmation address | The slave address in the response ls different fromthe oneinthe = request Se hex | Inored confrmation Funaon | The function code inthe responses ferent rom the one nthe code request B7 hex _| Response size oveiow | The response fam i larger than the storage area (G2 be) 88 hex | Exception response “A exception response was received from the save 89 hex | Service being executed ‘A service is already being executed (reception traffic congestion). BA hox | Execution cancoled Erecting fhe service has been carceled BF hex [her enor Other FINS response code was revaved © Related Auxiliary Area Words and Bits The Modbus-RTU command set in the DM fixed allocation words for the Mdbus-RTU Easy Master is automatically sent when the Modbus-ATU Master Execution Bit is turned ON. The results (normal oF error) will be given in corresponding flags. Word Bit Port Contents A640 02 |Bulttin RS-292C port of | Modbus-RTU Master Execution Error Flag ‘CPIEN14/20/30/40/60(S0) | on: Execution error. ‘or NAZ0 CPU Unit OFF: Execution normal or still in progress. oF Modbus-RTU Master Execution Normal Flag (ON: Execution normal OFF: Execution error or stil in progress. 00 Modbus RTU Master Execution Bit ‘Turned ON: Execution started ‘ON: Execution in progress. OFF: Not executed or execution completed. Bat (02 | Serial option port or bulltin | Modbus-RTU Master Execution Error Flag RS-485 port of CPIE ‘ON: Execution error. N30140/60(S1) or NAZ0 Seu une OFF: Execution normal or stil in progress a Modbus-RTU Master Execution Normal Flag (ON: Execution normal OFF: Execution error or sill n progress. 00 Modbus-RTU Master Execution Bit ‘Turned ON: Execution started (ON: Execution in progress. OFF: Not executed or execution completed. (CPIE CPU Unit Software User's Manual(WA80) 14-13 14 Serial Communications 14-4-4 Programming Examples ‘A bobbin winder on a spinning machine will be used in the following example. The speed of the bobbin winder must be controlled as the thread is wound because the speed of the thread is constant. ‘Constant thread speed — — 1 Fast rotation Slow rotation 60.0082 95.00H42 Speed 50.0042 Stopped I i i Contact A Contact B Contact Contact Z ON. ON ON ‘ON (wo100) 0.01) (wo.02) (wo.is) The target speed is changed according to inputs from multiple contacts. Acceleration and deceleration are controlled using the acceleration and deceleration of an inverter. I Wiring Examples The CP1E and OMRON 3G3MV Inverter are connected using RS-485 for frequency and start/stop con- trol © CP1E NOD type CPU Unit 14-14 (CPIE CPU Unit Software User's Manual(Wé80) © CP1W-CIF11/12 Settings 14 Serial Communications Set the DIP switch as shown in the following table (Back) = ‘a ‘SPU Unit conn DIP switch for operation sottinas No. Setting ‘ON/OFF Description 1__ | Terminating resistance selection ‘ON Connects terminating resistance 2_[274-wire selection ‘ON 2-wire connections 3_| 2i4-wire selection ON 2awire connections | 4 = OFF [Always OFF 3_|RS control for RD ON Enabled @_[ RS conivoifor SD ON Enabled © 3G3MV Settings Set the DIP switch as follows: + $W2, pin t ‘communications * Set the following parameters. ON (terminating resistance connected) Terminating resistance for RS422/485 No. Name Setting Description’ ‘n003 | RUN command selection 2__| RS-422/485 communications is enabled, ‘n004 | Frequency reference selection | 6 _| Frequency reference through RS-422/RS-485 TOTS | Acceleration time 1 5.0__ | Acceleration time in seconds 11020 | Deceleration time 1 5.0__ | Deceleration time in seconds 161 | RS-422/485 communications 1 | Detect timeouts, detect fatal errors, and the Inverter timeover detection selection decelerates to a stop using deceleration time 1 (default), nt62 | RS-422/485 communications 1 __| Select the unit for communications of requency frequency referenceldispray references and frequency monitoring data. Unit: 0.01H2 unit selection {default 1163 | RS-422/485 communications 1 | Slave address (unit number), unit number 1 Slave address isa | RS-422/485 communications 2 _ | Communications baud rate: 9,600 bps (detaul) baud rate selection 185 | RS-422/485 communications 0 [Even party parity selection 156 | RS-422/485 communications 10 _| Sets the response wait time for request messages: send wait time received from the master. 10 ms (default). 187 | RS-422/485 communications (0 | RTS control enabled (derault) RTS contol selection (CPIE CPU Unit Software User's Manual(WA80) 14-15 f : 5 3 F 14 Serial Communications 14-16 © PLC Setup Click the Serial Option Port Tab in the PLC Settings Dialog Box. \NoteThe builtin RS-485 port of the NCIOIS'-type CPU Unit should be set in the Serial Option Port tab. Serial Option Port Tab Page ‘Set the Modbus communications settings to match thase of Inverter, It the Inverter is set to 9,600 bps, one stop bit, and even parity, select the Custom Option and sot the baud rate to 9,600. Sot tho format to 8, ,£. Mode Select Modbus Fasy Master Response Timeout _| Set the default value of 0100 ms. (GPAE CPU Unit Software User's Manual(W480) © Programming Example P First cycle my Mov 1 t ‘0000 1806 MOV ‘0000 i807 Mov ‘0000 Bat wo.00 + Mov Gomact A won7 206 Mov #7000 i807, + Mov wos 1306 #7000 i807, wong 1306 Mov ‘78800 1307, wo.ts omactZ 0000 i806 Mov ‘0000 i307 Start and continue Modbus communications from 1 second after urring ON the power supply. P_On I TH f 0010 + ser 73.00 A541.01 (CPIE CPU Unit Software User's Manual(WA80) 14 Serial Communications Stop operation when communications start } RUN command (0: Stop) Frequency reference:00.00H2 |, RUN command ttt Frequency reference: 60.00H2(1770 Hex) | FUN command (1 Star Frequency reference: 55.00H2(157C Hex) |, RUN command (Start Frequency reference: 50.00H2(1388 Hex) UN command (0:Stop) } Foquencyrtoronco: 00. 00He Moceus-ATU Master Execution Bit 14-17 uonoung se1seW Ase NL-snapoW PPL souexg GumuesBoig FL 14 Serial Communications © Flags for Modbus-RTU Easy Master for Serial Option Port or Built-in RS-485 Port ‘A641.00 Execution Bit |A6é1.01 Execution Normal Flag ‘A641.02 Execution Ettor Flag oO @ @ (1)Turn ON 641.00 (Execution Bit) to send command data stored starting at 01300. For details, refer to DM Area Data on page 1.4/9. Serial Option Pork | aa 1300 001007 | Command | Siave address (00 to FT hex) 081015 Reserved (Aways 00 hex) Dior 001007 Funetion code 081015 Reserved (Aways 00 hex) i802 D010 15 ‘Number of communications data bytes (0000 to 005E hex) D180 to DISD Dot 1S ‘Communications data (04 byles max) (FF Precautions tor Correct Use The Execution Bit will automatically turn OFF. Do not turn OFF the bit through the ladder. (2)When a command has been sent successfully, A641.01 (Execution Normal Flag) will turn ON, and the response data will be stored starting from D1350. Words J si Setting Serial Option Port 1350 (0010.07 | Response | Slave address (01 to F7 hex) 0810 15 Reserved (Aways 00 hex) Dist 001007, Funation code 810 15 Reserved i862 001007, Error code 0810 15 Raserved (Aways 00 hex) 1353 0010 15 ‘Number of response bytes (0000 to O3EA hex) D154 to D1999 0010 15 Response data (92 bytes max) (3)If a communications error occurs, A41.02 (Execution Error Flag) will turn ON, and the error code will be stored in D1352. 14-18 (CPIE CPU Unit Software User's Manual(W480) 14 Serial Communications © DM Area Data DM Fixed Allocation Words for Modbus-RTU Easy Master DM Area data in words 1301 to D1305 are set before the execution of the ladder program. 1D1306 and D1307 do not need to be set. They are modified by MOV instructions, and are used to change, start, and stop frequency references. Serial Option Port or Built-in RS-485 Port: Command ‘setting | Stave | Function Perea ‘Communications data: D1308 to 01349 (maximum) ® | address | code ata byes 94 bytes (47 words) max. aasress | 1900 | ora01 | o1a02 | ora09 | oro | o1905 | o1s08 | oor Value oo | 10 Data for next reigister (e.g. set 60.0 Hz (0258 hex) for register 0002 ((roquency reference)) Data for starting register (e.g. set 0001 hex for register 0001 (RUN command, see below)) oo | oot op fo | oo! or | oo | a2 | o 00 | or: 0 | 5a a S 9 ey Inverter slave address: t hex Inverter data write: 10 hex Use the 9 bytes from the upper byte ‘of D1303 to the upper byte of D1307 Attached data size in bytes 4 (4 bytes from lower byte of D1305 to upper byte of 01307) Number of registers written: 2 (data for registers 0001 and 0002) Register number for starting data write: (0001 (Specifies to start writing data to Inverter starting at register 0001.) RUN Command (Register 0001) Allocation and Details for Inverter 363MV Bit No. Setting UN command (1: Start) [ Normatireverse rotation (1: Reversed) External error (1: EFO) Error reset (1: Error reset) Multfunction input 1 (1= ON) Multifunction input 2 (1= ON) ‘Multifunction input 3 (1: ON) ‘Mulitunction input 4 (1: ON) ‘Mutfunetion input § (7: ON) 3 ‘Multfunction input 6 (1= ON) 10 Multifunction input 7 (1= ON) Tito 15 [(Notused) For this example, only the RUN command (bit 00) will be used. + With the Modbus-RTU Easy Master, a CRC-16 checksum does not need to be set in the DM Area, because itis calculated automatically. (CPIE CPU Unit Software User's Manual(WA80) 14-19 onoung sasew Kee niaesnapow p-rb souexg GumuesBoig FL

Vous aimerez peut-être aussi