Download as pdf
Download as pdf
You are on page 1of 9
Communicating with the PLC 62 MODBUS communication 6.2 MODBUS communication ‘Overview: In MODBUS. only the master can start a communication and the slave will answer it, There are two ways of sending a message to a slave. One is unicast mode (address 1 t0 247). where the master addresses the slave directly; the ather is broadcast mode (address 0), where the master addresses all slaves, When a slave has received a message. which was addressed al it, the Function Code tells if whal to do. For the task defined by the Function Code, the slave may receive some data. And for error checking a CRC code is alsa included. After receiving and processing a unicast message, the MODBUS slave will send a reply, but only if'no error was detected in the received message. If a processing error occurs, the slave will reply with an error message. The following fixed framing characters in a message can not be altered: 8 data bits, 1 parity-even bit and 1 stop bit Slart pause Application Data Unit End pause Protocol Data Unit crc >=35 unction Code >= 35 Characterran | |_Adress _] Faneton Gos ae 2 bytes Character run time time t byte ‘byte 0... 252 bytes [ERC low JERE high ‘Supported Function Codes The SINAMICS V20 supports only three Function Codes, Ifa request with an unknown Function Code is received. an error message will be retuned FC3- Read Holding Registers When a message with FO FC3 has 4 bytes of data ‘© 2bytes for the starting address D x 03 is received, then 4 bytes of data are expected, thats, '* Zbytes for the number of registers Byte 3 4 Byte 5 Byte 6 Byte 7 FC(Ox |Startaddress | Startaddress | Number of Humber of crc fore 03} (most signitcant | lesstsignificant [registers (most | registers (least byte} pytel significant byte) [signiteant byte) SILAMICS V20 Inverter 126 ‘Operating instructions, 112012, ASE98728167 Communicating with the PLC 6 2 MODBUS communication FC6 - Write Single Register When a message with FC = 0 x 06 is received, then 4 bytes of data are expected. that is, FCB has 4 bytes of data: © 2 byles for the register address © 2 byles for the register value Byte 1 _|Byte2 [Byes Byte 4 Byte 5 Byte 6 Bye7 [Bytes ‘Address: Slat address [Slartaddress |New register value | New register vale [CRC [CRC 083 (most significant {least signficant | (most signficant — | (east significant byte bytei byte) bytel FC16 - Write Multiple Registers When a message with FC = 0.x 10 is received, then 6 + N bytes of data are expected, that is, FC16 has 5 + N bytes of data © 2 byles for the starting address ‘© 2 bytes for the number of registers © 1 byle for the byle count © Nobyles for the register values Byto1 ]Byto2 |Byo3 | Byte4 [Byte5 [Byo6 |Byto7 |Byte7+n [Byto8+n |Byto9 | Byte +n__[10+n ‘Addres [FC (0x Start Start Humber [Number [Humber [nthvalue [nihvaue [ORO [ORC js 10) facdress address Jot of ofbytes. | (mos ose (most | feast registers | regsters sigaiteart_| significant significant [significant |tmost | byte} byte} byte) byte) signiiean | signitican tbyiei | tbyter SINAMICS ¥20 Inverter ‘Qverating etructons, 112072, ABEOB? 2167 127 Communicating with the PLC 62 MODBUS communication Exception Responses If an error is detected through the MODBUS processing, the slave will respond with the FC. of the request, but with most significant bit of the FC high and with the Exception Code in the data field. However, any error detected on the global address 0 does not result in a response since all slaves cannot respond at once. Ian error is detected ‘and so on), then NO F ilhin the received message (for example, parity error, incorrect CRC sponse is sent to the master Note that if a request with FC16 is received which contains a write that the inverter cannot perform (including write to a zero entry), other valid writes will stil be performed even though an exception response is returned. The following MODBUS Exception Codes are supported by SINAMICS V/20: Exception Code | MODBUS name Meaning 01 legal function code The function code is not supported — only FCS, FOS and FO16 are supported 02, ‘An invalid address was queried os ‘An invalid data value was recognized. oa {An unrecoverable error occurred while the device waa processing the eation, ‘The table below shows the cases in which an Exception Code is retumed: Brror description Exoepiion Code Unknown Function Code 01 Read registers, which are out of soundary 02 Wite register, which is out of boundary 02 Read request of foo many registers (> 125) 03 White request of too many reqisters (723 03 Inconest message length 03 rte toa read-only register 04 Wite register, efor in parameter access oa Read register. error in Parameter Manager 04 20 a zero entry m7 Unknown error 04 SILAMICS V20 Inverter 128 ‘Operating instructions, 112012, ASE98728167

You might also like