14.08.2013 Views

snap ethernet-based i/o units protocols and programming guide

snap ethernet-based i/o units protocols and programming guide

snap ethernet-based i/o units protocols and programming guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 5<br />

Chapter 5<br />

Advanced Modbus Programming<br />

Introduction<br />

Opto 22 form #1460, the SNAP Ethernet-<strong>based</strong> I/O Units User’s Guide, shows basic<br />

communication with a Modbus master using Modbus/TCP. However, if you need to read <strong>and</strong><br />

write data in other areas of the brain’s memory map not covered by the Modbus memory map,<br />

you can do so with a SNAP-UP1-ADS or SNAP-B3000-ENET brain. This chapter shows you how.<br />

This chapter assumes that you already have an underst<strong>and</strong>ing of Modbus/TCP <strong>programming</strong> <strong>and</strong><br />

communications. Use this chapter in conjunction with the Open Modbus/TCP Specification <strong>and</strong><br />

the Modicon Modbus Protocol Reference Guide, both available from Modicon, Inc., Industrial<br />

Automation Systems. Information is also available at www.modbus.org/modbus tcp.htm.<br />

NOTE: Digital-only brains do not support advanced Modbus <strong>programming</strong>. Use an<br />

analog/digital/serial brain instead.<br />

Accessing Other Data in the Brain’s Memory Map<br />

If you need to read <strong>and</strong> write data in areas of the brain’s memory map not included in the Modbus<br />

memory map, you can do so with a SNAP-UP1-ADS or SNAP-B3000-ENET brain. This section<br />

shows you how.<br />

All of the brain’s regular memory map addresses are available for reading <strong>and</strong> writing, with the<br />

exception of PID module <strong>and</strong> data logging addresses.<br />

As explained in the Modbus appendix in the SNAP Ethernet-<strong>based</strong> I/O Units User’s Guide, SNAP<br />

Ethernet-<strong>based</strong> brains use a Modbus packet inside TCP/IP. The Modbus checksum is not used;<br />

instead, the Ethernet TCP/IP link layer checksum guarantees data. The size of the packet is<br />

limited to 256 bytes.<br />

The Modbus master needs to support Class 0 comm<strong>and</strong>s <strong>and</strong> the following function codes:<br />

03<br />

06<br />

10<br />

Read holding registers<br />

Preset single register<br />

Preset multiple registers<br />

SNAP Ethernet-Based I/O Units Protocols <strong>and</strong> Programming Guide 99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!