Helix Electronic Systems, Inc.
GHC Manual Computer Communication Rev1
Rev 10-18-01 mrl Page 4 of 1
All functions and operations of the GHC can be controlled by using the supplied graphical control software, GHCTerm. The GHC can also be controlled by manually programming the interface through a terminal emulator, although there is nothing that can be done by manually programming the controller that cannot be done automatically by using the provided graphical control software. The manual programming codes are those that are actually used by the graphical software in communicating with the controller. They are mainly intended for use only as diagnostic tools otherwise. With care it is possible to use them alone to operate the controller.
Make sure that you are using the latest revision of the documentation. The manual references here are for the GHC 4 manual Rev 2. Other models are similar.
Q. Only the 'D' Commands works, why don't the rest work?
A. Since the 'D' Dump all register command works, it appears that the communications are set up OK and that the controller is responding OK. No details are given as to what "doesn't work" means so we'll try a few possibilities.
If the customer is using an early model controller without error detection, and there is no response to the commands from the controller, then it may be that he and is sending the commands in lower case instead of upper case. The commands must be in the case as shown in the manual.
Most likely, the customer is using a current model controller with error detection and the response is an exclamation point followed by a single digit number. This indicates that the required checksum is missing or wrong. Error detection increases the reliability of the computer communications under noisy conditions. The manual says at the end of section C3:
"Note: All of the above commands, with the exception of the D Command, must be appended with an error code consisting of a dash ‘-‘ character followed by the last two significant digits of the hexadecimal checksum."
For example, if the desired command is Set Register 25 (SR25), then the complete command must be followed by a dash and the two digit hexadecimal checksum. That is SR25-0C. The controller should respond with 'S' to acknowledge that the Set command has been properly received.
The method to compute the checksum is the standard used for computer programming. This is done for you by the use of the Helix Checksum Calculator Excel spreadsheet Checksum.xls. The checksum can be calculated manually as follows using decimal arithmetic:
1. Convert each character of the command string to the ASCII code for the character.
2. Add all of the ASCII codes together.
3. Divide the total by 256, Discard the quotient and keep only the remainder. The remainder will be a number from 0 to 255.
4. Divide this by 16.
5. Convert the quotient and the remainder to their hexadecimal codes according to the table
The hexadecimal checksum is then the converted quotient and remainder digits in that order.
Decimal to Hexadecimal ConversionDecimal / Hexadecimal
0 / 0
1 / 1
2 / 2
3 / 3
4 / 4
5 / 5
6 / 6
7 / 7
8 / 8
9 / 9
10 / A
11 / B
12 / C
13 / D
14 / E
15 / F
Character to ASCII Conversion
Character / ASCII / Character / ASCII
Code / Code
A / 65 / , / 44
B / 66 / 0 / 48
C / 67 / 1 / 49
D / 68 / 2 / 50
E / 69 / 3 / 51
F / 70 / 4 / 52
G / 71 / 5 / 53
H / 72 / 6 / 54
I / 73 / 7 / 55
J / 74 / 8 / 56
K / 75 / 9 / 57
L / 76
M / 77
N / 78
O / 79
P / 80
Q / 81
R / 82
S / 83
T / 84
U / 85
V / 86
W / 87
X / 88
Y / 89
Z / 90
These command sequences with error detection checksums are the sequences that the supplied program GHCTerm uses when communication with the controller. The command sequences can be observed by opening the terminal window within the program during normal operation. The terminal window can be opened by double clicking the Status Pane labeled Terminal in the lower right hand corner of the window.
Q. The Dump registers shows 256 registers from R00 to RFF; however the manual talks about 44 registers from R01 to R44. Which is correct?
A. Both! The 44 registers are described in the manual Section D as "Register Definitions for Remote Control and Data Logging". These are the register numbers used for manual communications with the controller and are given in the appropriate units of measure for the particular register. The 'D' Dump all registers command gives all internal registers in address order in native format. The 'D' command is mainly intended for diagnostic purposes.
Q. What are the commands and format for the RS-232 communications?
A. The format and commands are defined in the GHC Manual as follows:
1.1. C. Remote Computer Operation
Remote Computer Control is accomplished through the built in RS-232 Serial Port. Computer operations can be performed by the use of any third party terminal emulator package such as Procomm ™ or HyperTerminal ™. Data communication parameters in the terminal emulator package should be set to 9600 baud, 8 bits, 1 stop bit, no parity. The GHC Controller will echo each valid command as it is sent. Invalid commands are ignored and are not echoed.
Consult the help files or documentation for the particular terminal package you are using. The steps should be similar the following for HyperTerminal ™:
- Open HyperTerminal ™ from the Start/Programs/Accessories command button in Windows 95™.
- Create a new connection from the File Menu if not prompted automatically.
- Use the drop down box for Connect using and select Direct to COMx, where x is the number of the COM port you have plugged the serial cable linking the PC and the GHC Controller.
- Set the Port Settings to 9600 bits per second (Baud), 8 data bits, no parity, 1 stop bit, flow control to none.
- At this point you should be returned to the blank terminal screen, the connection noted in the status bar. The message “Unable to Open COMx” indicates that the connection could not be made. This is a message from Windows and is most likely due to a missing, unconfigured or in use COM port. Consult your Windows documentation or PC supplier for assistance.
- Open the Properties dialog box from the File menu.
- Set emulation to Auto Detect or ANSI
- Select ASCII Setup.
- Uncheck “Send Line Ends with line Feeds.”
- Check “Echo typed characters locally.”
- Check “ Append Line Feeds to incoming line ends.”
- This configuration is saved and can be used by clicking the icon created in the setup process.
- The connection status is indicated in the status bar. The connection can be made or broken by using the toolbar or the Call menu.
- Set the Caps Lock key so that all of the commands you send to the GHC Controller will be in upper case.
- Type in the commands you wish to send. Press Enter or Return to send the command
Commands are sent to the GHC Controller by writing to the appropriate register. These commands instruct the Controller to perform Remote Control or Data Logging functions. The register numbers are defined below. Note that all commands must be upper case letters.
1.1.1. 1. Local/Remote Operation
The Local Remote Switch controls the operation of the computer interface. Set to the Local position to enable the use of local analog setpoint controls and disable Remote Computer Control (Write Register function). Set the switch to the Remote position to disable the local analog setpoint controls and enable remote digital setpoints. Registers can be read and Data Logging is active in either position.
1.1.2. 2. Remote Computer Control
Remote Computer Control is accomplished by sending commands to the GHC Controller by writing to the appropriate register. Typing the required characters into the text screen of the terminal program sends the commands. Commands are sent when the Enter or Return key is pressed. The command syntax is:
WRnn,vvv where WR = W(rite) R(egister)
nn = decimal register number
vvv = decimal value to write.
Note: Leading zeroes are not required.
Example1: Set the temperature setpoint to 86 F.
The temperature setpoint is contained in register number 2. The command required would write the value 86 to register number 2. Send the characters WR2,86.
Example2: Set the calibration offset for the pH sensor to zero.
The calibration offset for the pH sensor is contained in register number 43. The command required would write the value 0 to register number 43. Send the characters WR43,0.
1.1.3. 3. Remote Data Logging
Data logging can either be done once for each Read command or automatically on a programmed interval. The data logged each time is a string consisting of the register numbers and register values ending with the current system time.
Each field is separated with a comma. The resulting data stream can be captured by the terminal emulator for use by a spreadsheet or data base manager. The comma separated variable (CSV) format is widely supported by popular applications.
The registers logged by the Read command are selected by setting a flag for the desired register by using the Set command. Similarly, clearing the corresponding register flag can discontinue logging of a value. Multiple registers are selected or cleared by sending the Set or Clear command for each desired register. All register flags can be set or cleared with a single Set or Clear command with no registers specified. If no register is specified, only the system time is logged.
The Syntax is:
R Where R = R(ead) registers immediate
Rttt Where R = R(ead) registers
ttt = number of seconds between automatic reads
S Where S = S(et) all register flags
SRnn Where S = S(et) R(egister) flag
nn = register number
C Where C = C(lear) all register flags
CRnn Where C = C(lear) R(egister) flag
nn = register number
D Where D = D(ump) all registers
Example3: Begin Remote Data Logging of the Humidity at 30-second intervals.
The current value for the sensed Humidity is contained in register number 9. Sending the characters SR9 sets the Data Logging Flag for this register. The Data Logging Interval is set to 30 seconds by sending the characters R30.
Example4: Add Remote Data Logging of the Temperature to the currently running Data Logging.
The currently sensed Zone Temperature is contained in Register 1. The Zone Temperature is added to the current logged values by sending the characters SR1.
Example5: Change the logging interval for the current set of selected values to 1 second. Send the characters R1.
Example6: Stop logging the currently selected values.
Send the character R.
Note: All of the above commands, with the exception of the D Command, must be appended with an error code consisting of a dash ‘-‘ character followed by the last two significant digits of the hexadecimal checksum.
1.2. D. Register Definitions for Remote Control and Data Logging
Register Value / NumberZone Temp / R1
Temp Setpoint / R2
Fan Temp Diff Setpoint / R3
Fan Heat Deadband Setpoint / R4
Fan Humid Deadband Setpoint / R5
Temp Diff Setpoint / R6
Fan time Hour Setpoint / R7
Fan Time Minute Setpoint / R8
Humidity / R9
Humidity, External / R10
Humidity Setpoint / R11
Humidity Diff Setpoint / R12
CO2 / R13
CO2 Setpoint / R14
CO2 Diff Setpoint / R15
CO2 Time Hour Setpoint / R16
CO2 Time Minute Setpoint / R17
Conductivity / R18
Conductivity Setpoint / R19
Conductivity Diff Setpoint / R20
Nutrient Time Hour Setpoint / R21
Nutrient Time Minute Setpoint / R22
pH / R23
pH Setpoint / R24
pH Diff Setpoint / R25
Timer Interval Hour / R26
Timer Interval Minute / R27
Timer Hour Setpoint / R28
Timer Minute Setpoint / R29
Main Interval Time Hour / R30
Main Interval Time Minute / R31
Hours / R32
Minutes / R33
Seconds / R34
Spare / R35
Configuration / R36
Light / R37
Light Setpoint / R38
CO2 Offset / R39
External Humid Offset / R40
Zone Temp Offset / R41
Humid Offset / R42
pH Offset / R43
Cond Offset / R44
Q. What is the RS-232 interface?
A. The interface between the GHC and the computer is a standard RS-232C interface that uses a standard serial cable. The required connections in that cable are the RX, TX, and GND connections. The interface is operated at a fixed baud rate of 9600 bps with 8 data bits, no parity, and one stop bit. Handshaking should be set to “None”. The voltage levels and timing requirements are as defined in the EIA-232C standard.
Q. How does the PC communicate to the GHC?
A. The GHC communicates by means of a command-response protocol. That is, the PC sends a command to the GHC and then the GHC responds. The command can be a question or an instruction. The GHC will respond with data when appropriate or just an acknowledgement string. The format is described above. The GHC communications programs operate by polling the GHC at regular intervals.
Q. How does the GHCTerm or GH Watch program communicate with the GHC?
A. These programs communicate with the GHC through operating system services provided by Windows 95, 98, NT, or 2000. These services are the COM ports set up during the installation of Windows on the PC. The COM ports must be configured and properly working for the GHC programs to function. These can be checked with the Windows Device Manager. Most errors related to the communications with the GHC are Windows systems errors passed on by the GHC program, not created by it. The GHC program does not install device drivers or modify the operating system. The services that the GHC program uses to communicate with the hardware are those provided by Microsoft.