GM05 Serial Interface Protocol The GM05 serial interface can operate in two modes: Mode 1 - This transmits a copy of the information on the GM05 display, in plain ASCII. No commands are accepted by the GM05 when it is operating in this mode, except the command that is used to switch to mode 2 Mode 2 - This mode is based around a set of commands, each of which controls a particular area of the GM05. When each command is sent, an exchange of data between the GM05 and its host takes place. To enter mode 2 from mode 1, send a '*' character to the GM05. It will reply with the first status byte (a zero) and is then ready to receive commands from the host. Mode 1 Communications The output from the GM05 in mode 1 is: SRRR.R abc<cr><lf> or, with the time and date option enabled using the CommFlags command: SRRR.R abc hh:ii:ss dd/mm/yy<cr><lf> The fields in the line are defined as follows: S - Sign character (' ' or '-') R - Number, part of the reading. - Decimal point a - Range number (see range command for list of ranges) b - Units number (see units command for a list of units) c - Function number (see function command for a list of functions). and for the time and date: hh ii ss dd mm yy - Hour - Minute - Second - Day - Month - Year Note that the time and date will only be correct if it has been set up using the GMTIME program, or using the Time command. Mode 2 Communications The GM05 communication protocol uses a strict order of information exchange, which functions as a software handshake system. Every command over the serial link takes the following form:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÒÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ Host Transmits º GM05 Transmits ³ ÆÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͵ ³ º Status/Ready ³ ³ º Byte ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ Command byte º ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ º Data Byte A ³ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ³ Data Byte B º ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÐÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ After the command sequence of byte exchanges, the sequence can be repeated. From the above overview it can be seen that data can flow from the GM05 to the host and vice versa. All data is made up of single bytes, and commands are expressed as a single byte. A description of each byte follows: Byte Description Status/Ready This byte is transmitted by the GM05 when it is ready to receive another command. No commands should be sent until this byte has been received. The value of the byte depends on the last command that the GM05 serviced. If it was successful, 0 is sent as the Status/Ready byte. If any errors occurred, bits will be set in the Statu/Ready byte indicating what error occurred. Error codes are specific to each command and are detailed in the command descriptions below. Command This gives the number of the command that the GM05 is required to perform. The commands and their numbers are
given below in each command description. Data Byte A This is a byte of data from the GM05 to the host. Details of what it conveys depends on the command executed. Further information is given below. Data Byte B This is a byte of data from the host to the GM05. Details of what it conveys depends on the command executed. Further information is given below.
Serial Interface Structure ========================== The serial interface commands can only exchange single bytes of information. To reduce the limits that this imposes on information exchange, the GM05 serial protocol has, in the GM05, several registers that can be used to hold values larger than one byte. These registers are detailed below: Register Name: DATA Size: 16 bits This register is used to transfer 16 bit values to the GM05 (see the auto power down commands for an example). In addition, there is an 8 byte area of RAM called the Time Buffer, which is used to hold a time and date, or a copy of a store register. Serial Interface Commands ========================= Command Name: Null Command Number: 0 Description: This command does nothing. Command Name: Mode1 Command Number: 1 Status Codes: No status code is transmitted for this command as mode 1 communications is in force after it is executed. Description: This command puts sets the communications mode to 1. After data byte B has been transmitted, mode 2 communications are no longer in force. It is therefore not possible for this command to return a status code. Command Name: SetDataLo Command Number: 8 Data Byte B: Low byte of DATA register Description: This command is used to set the LS byte of the DATA register.
Command Name: SetDataHi Command Number: 9 Data Byte B: High byte of DATA register Description: This command is used to set the MS byte of the DATA register. Command Name: GetDataLo Command Number: 10 Data Byte A: Low byte of DATA register Description: This command is used to read the LS byte of the DATA register. Command Name: GetDataHi Command Number: 11 Data Byte A: High byte of DATA register Description: This command is used to read the MS byte of the DATA register. Command Name: Range Command Number: 12 Data Byte A: Current Range Settings Data Byte B: New Range Settings Description: This command is used to set the GM05 range. Current Range Settings Byte ³ ³ ³ ³ ³ ³ Auto ³ R1 ³ R0 ³ ³ ³ ³ ³ ³ ³ Range³ ³ ³ Auto Range: 0 - Fixed Range 1 - Auto ranging R0,1 Current Range New Range Settings Byte
³Set/ ³ ³ ³ ³ ³ Auto ³ R1 ³ R0 ³ ³Read ³ ³ ³ ³ ³ Range³ ³ ³ Set/Read: Auto Range: 0 - Read Range Settings only, do not set new ones 1 - Use new range settings 0 - Fixed Range 1 - Auto ranging R0,1 New Range Command Name: PadDisable Command Number: 13 Data Byte A: Current keypad disable flag Data Byte B: New keypad disable flag Description: This command can be used to enable or disable the keypad. If the keypad disable flag is zero, the keypad is enabled, if it is non-zero, the keypad is disabled. New KP disable flag byte: ³Set/ ³ ³ ³ ³ ³ ³ ³ KPD ³ ³Read ³ ³ ³ ³ ³ ³ ³ ³ Set/Read: KPD: 0 - Read KP Disable Settings only, do not set new ones 1 - Use new KP disable settings 0 - Keypad enabled 1 - KeyPad disabled The keypad is enabled after an auto zero or a null has been performed. Command Name: SimKey Command Number: 14 Data Byte A: Current keycode. Data Byte B: Key code of key to simulate Description: This command can be used to simulate keypresses and also read the keypad. The keycodes are as follows: Key ASCII Decimal === ===== ======= Menu 'M' 77 Next 'N' 78 Off 'O' 79 Range 'R' 82 Reset '0' 48 Enter 'E' 69
The ON key cannot be simulated. When reading the keypad, if the MS bit is set, the key has been processed, if it is not set, the key has not yet been processed. The keypad cannot be read if the keypad is disabled. In order to read the keypad, set the key to simulate as 00 hex. The Off keypress will turn the GM05 off, stopping serial communications immediately. Command Name: LoBat Command Number: 17 Data Byte B: The required battery measurement setting Description: This command allows the battery measurement functions to be stopped. If the data byte sent is 0 then the battery measurement will not be done, and the LOBAT symbol will not be updated. If the data byte is 1 then the LOBAT symbol will be updated. Command Name: Units Command Number: 19 Data Byte A: Current Units Setting Data Byte B: New Units Setting Status Codes: Non-zero if Argument is out of range Description: This command is used to set the GM05 units Current Units Settings Byte ³ ³ ³ ³ ³ ³ ³ U1 ³ U0 ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ U0,1 Current Units New Units Setting Byte ³Set/ ³ ³ ³ ³ ³ ³ U1 ³ U0 ³ ³Read ³ ³ ³ ³ ³ ³ ³ ³ Set/Read: 0 - Read Units Settings only, do not set new ones 1 - Use new units settings
U0,1 New Units The U0,1 field can take the following values: U1 U0 Decimal Units ============================= 0 0 0 Tesla 0 1 1 Gauss 1 0 2 A/m 1 1 3 Oe Command Name: Function Command Number: 20 Data Byte A: Current Function Setting Data Byte B: New Function Setting Status Codes: Non-zero if Argument is out of range Description: This command is used to set the GM05 function, i.e. DC, AC, DCPeak etc. Current Function Settings Byte ³ ³ ³ ³ ³ ³ F2 ³ F1 ³ F0 ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ F0,1,2 Current Function New Function Setting Byte ³Set/ ³ ³ ³ ³ ³ F2 ³ F1 ³ F0 ³ ³Read ³ ³ ³ ³ ³ ³ ³ ³ Set/Read: F0,1,2 0 - Read Function Settings only, do not set new ones 1 - Use new function settings New Function The F field can take the following values: F2 1 0 Decimal Function ================================= 0 0 0 0 DC 0 0 1 1 DC Peak 0 1 0 2 AC 0 1 1 3 AC MAX 1 0 0 4 AC Peak
Command Name: Language Command Number: 21 Data Byte A: Current Language Setting Data Byte B: New Language Setting Status Codes: Non-zero if Argument is out of range Description: This command is used to set the GM05 Language. Current Language Settings Byte ³ ³ ³ ³ ³ ³ L2 ³ L1 ³ L0 ³ ³ ³ ³ ³ ³ ³ ³ ³ ³ L0..2 Current Language New Language Setting Byte ³Set/ ³ ³ ³ ³ ³ L2 ³ L1 ³ L0 ³ ³Read ³ ³ ³ ³ ³ ³ ³ ³ Set/Read: L0..2 0 - Read Range Settings only, do not set new ones 1 - Use new Language settings New Language The L field can take the following values: L2 1 0 Decimal Language ================================= 0 0 0 0 English 0 0 1 1 French 0 1 0 2 German 0 1 1 3 Italian 1 0 0 4 Spanish 1 0 1 5 Portuguese Command Name: ResPeak Command Number: 22 Description: This command initiates a peak detector reset. The peak detector takes 1 second to reset, so no actions to do with the measurement functions of the GM05 should be performed for this period after the issuing of this command.
Command Name: DoNull Command Number: 23 Description: This command starts a Null function off. It returns immediately, so a delay equal to the menu 'Null' function should be inserted after issuing this command, before any measurement actions are taken. **NOTE: It is necessary to send a SIMKEY '0' (RESET) command to the GM05 when the 'Press RESET' prompt appears on the GM05 display. Command Name: DoAZ Command Number: 24 Description: This command starts an auto zero function off. It returns immediately, so a delay equal to the menu 'Auto Zero' function should be inserted after issuing this command, before any measurement actions are taken. **NOTE: It is necessary to send a SIMKEY '0' (RESET) command to the GM05 when the 'Press RESET' prompt appears on the GM05 display. Command Name: APD Command Number: 25 Data Byte B: The APD command to execute Description: This command performs one of the following APD commands: APD Command Description =========== =========== 1 PSUAPDRef: Auto power down refresh 2 PSUAPDOn: Auto power down on, DATA register holds delay in 20mS intervals to power down after. 4 PSUAPDOff: Auto power down off 8 PSUAPDConst: Returns in DATA register the APD delay menu setting 9 PSUAPDCount: Returns the number of seconds remaining in DATA register. Command Name: Time0 Command Number: 26 Data Byte A: The current contents of register 0 in the TIME registers. Data Byte B: The new contents of register 0 of the TIME registers. Status Codes: Non-zero if no clock detected
Description: This command sets register 0 of the TIME registers. It does Command Name: Time1 Command Number: 27 Data Byte A: The current contents of register 1 in the TIME registers. Data Byte B: The new contents of register 1 of the TIME registers. Status Codes: Non-zero if no clock detected Description: This command sets register 1 of the TIME registers. It does Command Name: Time2 Command Number: 28 Data Byte A: The current contents of register 2 in the TIME registers. Data Byte B: The new contents of register 2 of the TIME registers. Status Codes: Non-zero if no clock detected Description: This command sets register 2 of the TIME registers. It does Command Name: Time3 Command Number: 29 Data Byte A: The current contents of register 3 in the TIME registers. Data Byte B: The new contents of register 3 of the TIME registers. Status Codes: Non-zero if no clock detected Description: This command sets register 3 of the TIME registers. It does Command Name: Time4 Command Number: 30 Data Byte A: The current contents of register 4 in the TIME registers. Data Byte B: The new contents of register 4 of the TIME registers. Status Codes: Non-zero if no clock detected Description: This command sets register 4 of the TIME registers. It does Command Name: Time5 Command Number: 31 Data Byte A: The current contents of register 5 in the TIME registers. Data Byte B: The new contents of register 5 of the TIME registers. Status Codes: Non-zero if no clock detected Description: This command sets register 5 of the TIME registers. It does Command Name: Time6 Command Number: 32 Data Byte A: The current contents of register 6 in the TIME registers. Data Byte B: The new contents of register 6 of the TIME registers.
Status Codes: Non-zero if no clock detected Description: This command sets register 6 of the TIME registers. It does Command Name: Time7 Command Number: 33 Data Byte A: The current contents of register 7 in the TIME registers. Data Byte B: The new contents of register 7 of the TIME registers. Status Codes: Non-zero if no clock detected Description: This command sets register 7 of the TIME registers. It does Command Name: Time Command Number: 34 Data Byte A: Always 0 Data Byte B: A TIME command, see below Status Codes: Non-zero if no clock detected in the GM05 Description: This command performs a TIME command as detailed below. If no clock is detected, due to a hardware error or lack of a clock device in the GM05, the returned status code is non-zero. The time keeping device used in the GM05 is the Dallas DS1216 SmartWatch. All registers in the watch are programmable. Refer to the Dallas Semiconductor databook for details about programming this device. TIME Commands ============= The TIMEn commands can read and write to an area of RAM in the GM05 called the TIME registers. These are a copy of the registers in the GM05 time keeping device. The register contents can be written into the clock device using the PUT_TIME TIME command. The clock device registers can be copied into the TIME registers using the GET_TIME command. Value Description ===== =========== 0 ONLY_RD This command prevents the TIMEn commands from writing new data into the TIME registers. 1 ALLOW_WR This command allows the TIMEn commands to write data into the TIME registers. The value returned by the TIMEn commands will be overwritten by the new value passed in the TIMEn command. 2 PUT_TIME This copies the TIME registers into the clock device. 3 GET_TIME
This copies the clock device registers into the TIME registers. Command Name: SampleNow Command Number: 35 Data Byte A: Always 0 Description: This command stores the current reading in the next sample register. The register pointer is incremented to point to the next register. Command Name: CommFlag Command Number: 36 Data Byte A: The current contents of the COMMFLAG register Data Byte B: The new contents of the COMMFLAG register Description: This command sets and reads the COMMFLAG register. the bit assignments within the register is as follows: Bit Desc === ==== 0 0 - Mode 1 format is: SRRR.R abc 1 - Mode 1 format is: SRRR.R abc hh:mm:ss dd/mm/yy This bit controls the format of the Mode 1 comms, when set to 1 the current time and date in the GM05 is transmitted with the sample information. Command Name: GetReg Command Number: 37 Description: This command copies a block of 8 register bytes into the TIME buffer. The TIMEn commands can then be used to read the bytes out to the host. Command Name: RegPtr Command Number: 38 Data Byte A: Current register pointer Data Byte B: New register pointer Status Codes: Non-zero if Argument is out of range Description: This command is used to set the pointer to the registers that is used to determine which register the GetReg command will copy to the TIME buffer. New register Pointer Byte
³Set/ ³ P6 ³ P5 ³ P4 ³ P3 ³ P2 ³ P1 ³ P0 ³ ³Read ³ ³ ³ ³ ³ ³ ³ ³ Set/Read: 0 - Read Units Settings only, do not set new ones 1 - Use new units settings Pn New register pointer (max value 99) Command Name: SaveSetup Command Number: 39 Description: This command saves the current setup (units etc.) int the non-volatile memory, so that it will be used at the next power on setup. If this isn't done, any settings that have been changed using the serial commands will be lost at power down. Command Name: Mode1Interval Command Number: 40 Data Byte A: The current interval Data Byte B: The new interval Description: This command sets the new interval between Mode 1 printouts. The interval is in units of 1/3 second samples. The maximum value is 255.