Beside the SC and CB commands, the I/O can also be controlled with direct Modbus command using the Galil command MB. To do this, Modbus function code 5 is used. If your PLC connected to handle B, and you want to set bit 6, the command would look like this
When using the Modbus commands setting MW1 will insert a small delay between subsequent Modbus commands to allow devices time to process the commands.
The bit number used is simply 6, and does not involve the equation needed for addressing with the SB and CB command. This is because the controller knows which handle to send it to by the letter after the MB.
Reading the status of the digital inputs also relies heavily on determining the address of the bit you are trying to read. Once you have to determine the address the address of the bit you are trying to read using the instruction in “Addressing I/O”, you can then issue commands in two ways. The simplest way is by using MG@IN[address]. This is similar to the SB/CB in that is converts the command into the Modbus command that is sent to the PLC. Modbus function 2 is used for reading digital inputs.