Esis Pty Ltd ph 02 9481 7420 fax 02 9481 7267 www.esis.com.au Notes on Monibus Protocol The Monibus is a three wire interconnect system for all µsmart sensors and loggers manufactured by Monitor Sensors. The three wires are :1 2 3 red blue or yellow green or white +ve supply (usually 5 volts) serial data bus Common / Ground The Monibus can be operated in three ways :1 2 3 With a Monitor Sensors logger controlling the bus. With a Monitor Sensors SI8 Monibus to RS232 serial interface unit. In stand alone mode, without a logger or SI8 unit 1 When the monibus is controlled by a logger, the power to operate the sensors is supplied by the logger and this is set at 5 Volts regulated. Communications with the system is established via a dedicated RS232 port on the logger. The logger will detect all sensors connected to the bus. It will resolve address conflicts, if required. It will detect new sensors added to the bus, or note the removal of sensors by making periodic searches. New sensors will be interrogated and their profiles stored in non volatile memory. Appropriate data recording schedules will be applied to each sensor. Should the need arise to talk directly to any sensor on the monibus, the logger must first be instructed to enter transparent mode. Short messages can then be sent, and the replies relayed via the logger RS232 port. 2 When the Monibus is used with the Monitor Sensors SI8 Monibus to RS232 serial interface unit, The SI8 unit provides +5 volts regulated to the Monibus. If there are only a few sensors connected and the SI8 unit is plugged directly into a Communications port of a Computer, the SI8 unit will "steal" the power required to operate itself and the Monibus from the port. For a larger system, it will be necessary to connect a plugpack power supply to the socket provided on the SI8. Communications is possible with any of the sensors on the Monibus by running a terminal emulation programme such as Windows "terminal" or Windows 95 "hyperterminal". The terminal programme will need to be set up as follows :baud speed start bits data bits stop bits Parity flow control local echo 1200 baud 1 8 1 none none off When only one sensor is connected to the monibus, pressing the space bar (sending ASCII code 32, hex 20) will cause the sensor to return it's current reading. The exact format of the response will depend on the settings, held in non volatile memory in the sensor. For example the normal (or default) response from a temperature sensor would appear as:27.39 °C (hex string is 20,20,20,32,37,2e,33,39,20,b0,43,2c,0d,0a) The engineering units may occupy from zero to six bytes depending on the sensor type. If the value is negative the second space (hex 20) is replaced by the negative sign (hex 2d). The length of the string remains unchanged. Leading zeroes (hex 30) are replaced by spaces (hex 20) which also keep the length of the string the same. The string ends with a carriage return (hex 0d) and line feed (hex 0a) characters. Options include increasing the resolution :- 27.392 °C (hex string is 20,20,20,32,37,2e,33,39,32,20,b0,43,2c,0d,0a) Substituting a comma in place of the engineering units :27.39, (hex string is 20,20,20,32,37,2e,33,39,2c,0d,0a) Prefacing the sensor's clock time :12:35 27.39 °C Appending a derived unit :27.39 °C 81.3 °F Appending data from an attached rain gauge :27.39 °C 0.6 mm Or any combination of the above. Sending a question mark (ASCII code 63, hex 3f) will cause the sensor to respond with it's identification message. e.g. :Address is 7 Type of sensor is TA1 Serial number is 00163 Date of last cal was 08Jan 99 Software ver 3.04 http://ats.com.au/monitor When more than one sensor is connected to the Monibus, it is not possible to use the space bar to read the sensors, as all the sensors will respond simultaneously, causing a garbled message. In this case, it is only necessary to send the single number or letter which has been assigned as the sensor's unique address, in order to read that particular sensor. In the above example the temperature sensor has been assigned the address 7, so sending 7 (ASCII code 55, hex 37) will cause the sensor to respond :27.39 °C Upper and lower case letters are treated as different addresses and no two sensors should be given the same address. This limits the number of sensors on the Monibus to 62 using the number and letter keys. For systems using more than 62 sensors, addresses outside the normal range of numbers and letters will need to be assigned. This completes the single character commands. All other commands sent to the sensors consist of a combination of characters, which must be sent as a string without time gaps between characters. These strings cannot be sent directly from the keyboard. (Note: the strings can be sent from a keyboard when talking to the sensors through the logger in transparent mode, as the logger packages the messages and converts the baud speeds automatically) Most terminal programmes include a facility to send a short command sequence. Windows 3.1x terminal.exe is good in this regard, as it permits command sequences to be stored and sent by clicking buttons at the bottom of the screen and the buttons can be assigned labels, indicating function. Windows 95 Hyperterminal does not include this function unfortunately, however the 3.1x version will run happily under Windows 95. An alternative method of sending the string is to create a file consisting of the command, and then send the file from the terminal programme. These multiple character commands enable the user to access more advanced features of the sensors. For example, sending the sequence 7}mm will cause sensor 7 to return it's max and min report :Today: max 30.35 °C, min 24.20 °C, average 27.28 °C, Yesterday: max 26.77 °C, min 26.05 °C, average 26.52 °C, A list of commands is included in the appendices. Most of these commands begin with the right hand curly bracket symbol "}" (ASCII code 125, hex 7d). This symbol alerts the sensors that a command is following. All sensors will obey that command, unless they have been put into bus mode. If only a single sensor is required to obey, the address of that sensor must immediately precede the } symbol. The sensors continuously listen on the Monibus for any message that begins with their address or the } symbol or space bar or question mark. Other messages are ignored. Any character sent after a two character gap is considered a new message. When set to bus mode, the sensors ignore all messages, unless beginning with their address. The address of a sensor may be changed by the user at any time using a special command sequence. e.g. 7}ur=5 This command changes the address of sensor 7 to 5, but the sensor checks first, by replying :are you sure? The command sequence must then be sent again within a few seconds for the action to be taken:7}ur=5 This time the sensor (which is now 5) will respond:done In the above example, had sensor 7 been the only sensor on the bus, it would have been possible to send only the sequence }ur=5 and repeated this, in order to effect the address change. The command }ur= will only be accepted if followed by an address in the range 0 to 9 or A to Z or a to z. The special command }ur=? causes the sensor to adopt a random address in the range ASCII code 128 to 159, (hex 80 to 9f). This command is used to resolve address conflicts in situations where it is not desired to physically remove one of the conflicting sensors from the Monibus. 3 Operating the Monibus without either a logger or the SI8 Monibus to RS232 serial interface unit will require the use of a custom interface unit. In order to implement such an interface, the designer will need to know the hardware constraints of the µsmart sensors. The µsmart sensors will generally accept a supply voltage in the range 5 to 28 volts.This supply does not need to be regulated as each sensor has it's own internal regulator whose output is set to 4.2 volts. The internal regulator has low drop out, but malfunction can be expected if the voltage reaching the sensor gets down to 4.5 to 4.6 Volts. The current draw on each sensor is typically 1 mA, but may be much higher for certain types e.g water level. The specification sheets should be checked for each sensor type in use. Where long cable runs are to be used, care must be taken to ensure that all sensors receive at least 5 volts. It should be noted that when sensors are supplied with 4-20 mA output options, these sensors require a narrower range of supply, usually 5 to 15 volts, and draw much higher current. The serial data bus operates at quasi TTL levels. The processor in each sensor operates at a supply rail of 4.2 volts and hence the maximum sending voltage on the bus is limited to this value. The Monibus uses positive logic and hence a voltage of 4.2 volts represents a logic one. Logic zero is at or near zero volts. When not sending, the sensors tri state their bus driver to a high impedance state. There are no pull up or pull down resistors in the sensors. The logger or SI8 unit provides a single pull up resistor for the bus of approx 18 Kohms to a 5 volt rail. The Monibus uses Asynchronous serial communications with the following parameters:baud speed 1200 baud start bits 1 data bits 8 stop bits 1 parity none flow control none The processors in the sensors use a true UART with a dedicated 2 byte buffer in hardware, and are interrupt driven, thus ensuring that bus traffic is not missed. The sensors may be sent to sleep by the appropriate command (if not masked) but an interrupt line is tied to the bus, such that any activity will commence wake up. This will require the start up timer to complete it's cycle and thus the first character sent will not be received. To send a command to a sleeping sensor, therefore, it is necessary, first, to send any dummy byte to wake up the sensor, then a pause of at least 2 bytes, and finally the command. It is possible to combine two or more commands to a sensor in a single file by inserting two null characters between the commands. The nulls are treated in a different manner to other characters negating the requirement for a two byte gap, however, this only applies to the addressed sensor, ensuring that other sensors ignore the entire string. The list of user commands appended, are intended for use from a manual terminal. The bus logger rarely uses any of these commands. Instead it uses a series of commands, rather like the peek and poke, deek and doke commands of old fashioned Basic. It can read or write to any bit or byte in volatile or non volatile memory in any sensor, including the special function registers. It can also increment or decrement any single or double byte, starting at any bit. This gives enormous power to the programmer. There are 192 registers in each smart sensor and every bit of every register is used. There are 512 bytes of calibration and configuration information held in non volatile memory. For example :bit 0 of EE 00h switches off/on dither on the analogue output. bit 1 of EE 00h switches off/on the xtimer. The last 8 bytes in EE memory hold the max, min, average values, and the event counter for the previous 24 hours. Some more examples :bit 7 of ram 26 switches off/on the digital noise blanking filter bit 3 of ram 26 determines if the temperature compensation will be referenced to 20 or 25 degrees. bit 6 of ram 2e determines if the sensor will act as master or slave in autocal mode bit 5 of ram 2e determines which of 2 possible sources the sensor will use as the offset value for the analogue output. Fortunately, most of these tedious details never have to be changed, but they can be, if necessary. The Gold Line sensors have four to six extra wires for control and sensing. The outputs are normally controlled by the thresholds or timer, but they can be reconfigured on the fly to be polled inputs or controlled outputs. The analogue and frequency outputs can be switched to synthesize voltages,currents or frequency of high accuracy or follow the measured parameter. These functions are used in the factory for calibration and testing, and are not intended for the average user. Appendix 1 Other Commands }au = autocal mode (if in maimtenance mode) }hh = toggles resolution }ii = toggles interval timer }jj = toggles daisy chain }kk = max/min/av reset }mm = max/min/av report }mr = rain report }pp = read p2, or if p2 is off, reads p1 in different units new = changes to smart mode (only used with sensor in dumb mode) }s1 = auto zero and store }s0 = restore default zero }ta = read threshold A }tb = read threshold B }tt = read time }t1 = toggle insert time in spacebar read }t2 = toggle append p2 to spacebar read }t3 = toggle append p3 to spacebar read }t4 = threshold fast up }t5 = threshold fast down }t6 = threshold slow up }t7 = threshold slow down }t8 = threshold very slow up }t9 = threshold very slow down }tS = store threshold setup }ta = read threshold A }tb = read threshold B }tc = xtimer off/on }td = set time down very slow (approx 1 min) }te = set time up very slow }tf = set time down slow (approx 9 min) }tg = set time up slow }th = set time down fast (approx 2 hours,23min) }ti = set time up fast }tj = xtimer every 24hr }tk = xtimer every 4¾ hr }tl = thresA&B software reporting off/on }tm = thresB event,up/down }tn = thresB triggers/stops }to = thresB controls yes/no }tp = thresA off/on }tq = ThresB off/on }tr = ThresA norm/reverse }ts = ThresB norm/reverse }tt = send time }tu = ThresA sep/combined }tv = verbosity off/on }tw = ThresB sep/combined }tx = reset event counter