
This describes a number of utilites for testing communications.
They are offered as is.  For further assistance 
contact Power Measurement Technical Service.
	POWER MEASUREMENT
	Tel: 250-652-7100
	Fax: 250-652-0411
	Support e-mail: support@pwrm.com
	Website:	http://www.pwrm.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

MBMasterV15.exe
MBMasterV21M3.exe

These two versions of MBMaster.exe are simple programs that provide
a quick method of testing Modbus communications.  They run only in DOS
under the Windows operating system. They send read or write requests to
Modbus slave devices over serial or IP connections. MBMasterV15 supports
ModbusRTU and MBMasterV21M3 supports both ModbusRTU and ModbusTCP.
MBMasterV15 is better to use because it shows you the actual byte stream
in the packets.


1. Open a DOS prompt and change into the directory that you
placed the MBMaster.exe program.
(To get a DOS prompt press the Windows Start button.... Select Run and
type in "cmd".  Press enter and you will have a DOS prompt.)

2.  Change directory into the location that you unzipped the program.
 To change directories in DOS you use the "cd" command.  For example 
 	cd \
 will change to the root directory, and
 	cd downloads\troubleshooting 
 will change to the downloads\troubleshooting directory.
 To change drives from C: to D: just type the drive letter followed by a
 colon (:).

3. Run mbmaster  with "-?" to get help.
	mbmaster -?
You will see something like this:

	H:\Bin\troubleshooting>mbmasterv15 -?
	MBMASTER v1.5:  Compiled at Jun  5 1997 09:55:07

	Generates and sends Modbus request and displays the return data.

	MBMASTER [-COMx] [-Bxxx] [-FNxxx] [-IDxxx] [-SRxxxx] [-NRxxx] [v1 v2 ...]

	  [-COMx]     Selects comm port (default 'COM2')
	  ...OR...
	  [-SKxxx]    Sets TCP/IP socket (example '-SK192.168.2.184/3722')

	  [-Bx]       Selects baud rate (default 9600)
	  [-FNxxx]    Sets the Modbus function code (default READ).  Options are:
	                 READ:      Read Registers
	                 WRITE:     Write Registers
	  [-IDxxx]    Sets the slave unit ID (default 100).
	  [-SRxxx]    Sets the start register (default 400011).
	  [-NRxxx]    Sets the number of regs to transfer (default 3).
	  [-PKxxx]              Sets packet dump to ON or OFF (default ON)
	  [-RDxxx]    Sets register dump to ON or OFF (default ON).
	  [-RQxxx]    Sets the number of request to perform (default 1).
	  [-RTxxx]    Sets the time to wait for a response (default 5000 ms).
	  [-TDxxx]    Sets the minimum time between requests (default 100 ms).
	  [v1 v2 ...] List of values for a WRITE request.

	This utility is not a product, is never intended for sale, and
	will remain unsupported forever.
	Exiting.

4.  Test your communications.  You will likel run the program like this
	mbmasterv15 -COM1 -ID2
The program will send a request out PC's COM1 serial port and address a
simple request to Modbus slave device #2.  The program's defaults
provide the other parameters.  

5. For ModbusTCP communications use version 2.1  For example,
	MBMasterV21M3 -SK<ip>/502 -SR<base address> -NR<number of registers to read>


Here are two more samples
	mbmaster -COM2 -ID1 -SR45202 -NR5
Reads 5 registers from device #1 from address 45202

	mbmaster -COM1 -FNWRITE -SR43001 -NR2  1 16
Writes a 1 and 16 to 43001.




-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	Basics of Modbus packet analysis

Requests
-	First byte is slave's unit ID
-	Second byte is function code (typically 0x03 for 4xxxx Holding registers)
-	Next two bytes give base address - zero based 
		e.g. 40011 is sent as 0x00 0x0A
-	Next two bytes give number of registers requested
-	Finish with two byte CRC

Responses
-	First byte is slave's unit ID
-	Second byte is byte count (number of bytes in the data portion)
-	N bytes for data. Each register takes 2 bytes.
-	Finish with two byte CRC.

