ModBus: Master configuration
To set up a SPLat to be a ModBus master you need to do two things:
- Configure a Communications Control Block.
- Create a control script.
A ModBus master control script is stored in NVEM page 0 memory. You can think of the script as being a simple program in a special purpose language. Most script commands specify a ModBus message to be sent, a slave address, its data content and what is to happen to any data returned by the slave. A small number of script commands perform housekeeping actions.
While control scripts may at first appear rather complicated, they do in fact make life easier. Without control scripts you would have to write a separate task to manage communications. With a control script you essentially specify the messages you need and the system takes care of the rest. Any remaining complexity stems from the nature of ModBus and the need to map out the relationships between various items in master and slave(s).
The full repertoire of ModBus script commands is listed in the programming reference.