Modsak Manual - Setup overview
Modsak can be configured to run in one of three modes:
Master mode, where it sends requests to a slave
Slave mode, where it simulates a Modbus device.
Monitor mode, where it relays messages between a master and a slave.
This section gives an overview of how to set up Modsak in each of its three modes of operation.
Setup is done using panels in the configuration window, which is accessed using the → menu option. Each panel has a Help button, which provides context-sensitive help on the panel.
Master mode
In master mode, Modsak acts as a Modbus master, allowing you to send Modbus commands to a Modbus slave (see Commands).
If you only want to send low-level Modbus commands to the slave (i.e. you don't want to use polling or the high-level read or write commands) you can set up master mode using the following steps:
In the General panel (see General settings), set the Mode to Master.
Use the Interface to Slave panel (see Interface settings) to configure the interface to the Modbus slave.
If the slave uses 32-bit or 64-bit values, configure the handling of these using the 32/64-bit Values panel (see 32/64-bit Value Settings).
You may also want to configure the Number of Retries and Response Timeout in the General panel (see General settings).
Click the button to open the connection to the Modbus slave.
You may then send individual Modbus commands to the slave using the Define Command panel (see Commands).
If you want to use polling or the high-level read or write commands, the steps for setting up are a bit more complicated:
In the General panel (see General settings), set the Mode to Master and set the Slave ID to the slave identifier that you want Modsak to send in requests.
Use the Interface to Slave panel (see Interface settings) to configure the interface to the Modbus slave.
If you want to use coils or discrete inputs, or you want to use register addresses that are different from the addresses sent in messages, configure the address mapping using the Address Mapping panel (see Address mapping).
If the slave uses 32-bit or 64-bit values, configure the handling of these using the 32/64-bit Values panel (see 32/64-bit Value Settings).
Define the registers that you want to access (see Defining registers).
If you want to use polling, you may want to configure how Modsak polls registers in the Polling panel (see Polling Settings).
You may also want to configure the Number of Retries and Response Timeout in the General panel (see General settings).
Click the button to open the connection to the Modbus slave.
You may then use polling (see Polling) and all of the command options (see Commands).
You may close the connection to the slave by clicking the button, and re-open it by clicking the button again.
In slave mode, Modsak acts as a Modbus slave, receiving requests from a Modbus master (or masters) and responding to those requests. You can use Modsak in slave mode as a simple Modbus simulator. In this role Modsak provides storage and retrieval of values in registers, but does not provide any logic to operate on those values.
To run Modsak in slave mode, perform the following steps:
In the General panel (see General settings), set the Mode to Slave, and set the Slave ID to the slave identifier that you want Modsak to respond to. Modsak will also act on ) write requests using a zero slave identifier (i.e. broadcasts). Requests using any other slave identifier will be ignored.
Use the Interface to Master panel (see Interface settings) to configure the interface to the Modbus master(s).
If you want to use coils or discrete inputs, or you want to use register addresses that are different from the addresses sent in messages, configure the address mapping using the Address Mapping panel (see Address mapping).
If you want to use 32-bit or 64-bit values, configure the handling of these using the 32/64-bit Values panel (see 32/64-bit Value Settings).
Define the registers that you want to be accessible (see Defining registers).
Click the button to open the interface and start listening for requests.
You may stop servicing of requests by clicking the button (this will close the interface), and restart servicing by clicking the button again.
While running in slave mode, Modsak will update its display of the register values that masters write to, and you may edit the values of the registers that masters read from.
In monitor mode, Modsak acts a Modbus slave, receiving requests from a Modbus master (or masters). Instead of responding directly to a request, Modsak forwards it to a slave device. When the slave device responds to Modsak, Modsak forwards the slave's response to the master that sent the request. Modsak also uses write requests from masters and read responses from the slave to update its display of register values.
In monitor mode, Modsak may be used like a breakout box or protocol analyzer to observe the messages being exchanged between a master and a slave.
Monitor mode also enables Modsak to be used as a gateway or bridge (configure one interface to be a socket and the other interface to be serial). This is useful for prototyping, but is not recommended for production systems because of Modsak's interactive handling of error conditions.
To run Modsak in monitor mode, perform the following steps:
In the General panel, set the Mode to Monitor, and set the Slave ID to the slave identifier that you want Modsak to monitor. Requests using other slave identifiers will also be forwarded, but register values of those slaves will not be displayed. Broadcasts (using slave identifier 0) are always monitored.
Use the Interface to Master panel (see Interface settings) to configure the interface to the Modbus master(s).
Use the Interface to Slave panel (see Interface settings) to configure the interface to the Modbus slave.
If you want to use coils or discrete inputs, or you want to use register addresses that are different from the addresses sent in messages, configure the address mapping using the Address Mapping panel (see Address mapping).
If you want to monitor 32-bit or 64-bit values, configure the handling of these using the 32/64-bit Values panel (see 32/64-bit Value Settings).
Define the registers that you want Modsak to monitor (see Defining registers). Note that Modsak will forward all requests to the slave, not just those for the registers that you have defined. You only need to define those registers whose values you want to observe. Note also that in monitor mode the write flag only affects polling, not whether the master can write to the register.
You may also want to configure the Number of Retries and Response Timeout in the General panel (see General settings).
Click the button to open the interface and start listening for requests.
You may stop servicing of requests by clicking the button (this will close the interfaces), and restart servicing by clicking the button again.
In monitor mode, you may also use the button (see Polling) and all of the menu items (see Commands).