Windmill Software Ltd |
![]() February 2007 |
Interfacing
|
Modbus devices connect to the PC over a serial line using the Modbus protocol. Our free comDebug software lets you troubleshoot your Modbus connection. You can also use it to check whether the Windmill Modbus driver will work with your device.
comDebug supports any mix of digital and analogue inputs and outputs. These can be distributed across any set of Modbus slave devices. You can configure the slave device address and the parameter number (register number) for each channel individually. The Modbus protocol defines two modes of transmission: ASCII and RTU (Remote Terminal Unit). comDebug supports both modes. In ASCII mode each 8-bit byte in a message is sent as two ASCII characters. It allows intervals of up to 1 second between characters, without causing an error. Messages start with a colon and end with a Carriage Return followed by a Linefeed. The RTU mode uses binary coding. Each message comprises four parts: device address, function code, data, error check. The Device Address identifies your instrument. It contains one byte of information. In ASCII it is coded with two hexadecimal characters, in RTU with one byte. Valid addresses are between 0 and 247. The Function Code specifies the type of message. It contains one byte of information. In ASCII it is coded with two hexadecimal characters, in RTU with one byte. Modbus Communications SettingsASCII RTU Modbus Message Settings when using comDebugUse the prompt grid in the Terminal screen to send commands and data to your Modbus device. If you are sending binary rather than ASCII messages, use the NonPrint menu to enter addresses, codes, etc. For example, to enter a device address, select NonPrint Decimal from the NonPrint menu. Type the device address into the blue box. Address 1, for example, would be shown as Char 001 and Hex 01. To Read a Single Modbus RegisterByte 1 = device address Byte 2 = Modbus function code: 03 or 04 Byte 3 = msb of register Byte 4 = lsb of register Byte 5 = msb of number of bytes to read: normally 0 Byte 6 = lsb of number of bytes to read: for example 2 Byte 7 = CRC: use the CRC menu
Note: The function code 03 reads the holding register. This comprises two bytes and may be used to return measured values such as temperature. 04 reads the input registers. The Reply ComprisesByte 1 = device address Byte 2 = function code Byte 3 = number of bytes read Byte 4 = 1st word, msb Byte 5 = 1st word, lsb Byte 6 = 2nd word, msb Byte 7 = 2nd word, lsb : : Byte n = CRC To Write to a RegisterByte 1 = device address Byte 2 = Modbus function code: 6 Byte 3 = address of word, msb Byte 4 = address of word, lsb Byte 5 = value of word, msb Byte 6 = value of word, lsb Byte 7 = CRC The Reply ComprisesByte 1 = device address Byte 2 = function code: 6 Byte 3 = address of word, msb Byte 4 = address of word, lsb Byte 5 = value of word, msb Byte 6 = value of word, lsb Byte 7 = CRC Logging, Charting and Analysing DataTo log and chart data, or to send it to other programs like Excel for analysis, you need to buy the COMIML Modbus driver. This is available from our internet catalogue. |
Home | Windmill Programs | Monitor | On-Line Shop | Free Literature and Software Demos | Contents | Search
| Copyright Windmill Software Ltd 2001 PO Box 58, North District Office, Manchester, M8 8QR, UK. E-mail: sales@windmill.co.uk, Tel: +44 161 833 2782 http://www.windmill.co.uk/modbussettings.html Designed by Studholme.net |