HP-ASCII and Trigraphs | Back to Index |
As mentioned elsewhere, HP calculators use a non-standard version of ASCII which does not directly map to the Macintosh's ASCII based disk file system and is difficult to input on a standard keyboard. Fortunately, HP also provides a work around for these limitations: When you send or receive HP objects as text files, HPConnect will translate these special characters into "trigraphs" - groups of three standard ASCII characters. These trigraphs can be readily input with any standard keyboard and even a simple text editor:
ASCII Code |
Trigraph | Description | ASCII Code |
Trigraph | Description |
---|---|---|---|---|---|
92 | \\ | Backslash | 128 | \<) | Angle |
129 | \x- | Mean (bar-x) | 130 | \.V | Inverted Triangle |
131 | \v/ | Square Root | 132 | \.S | Integration |
133 | \GS | Sigma | 134 | \|> | Solid Triangle |
135 | \pi | Pi | 136 | \.d | Derivative |
137 | \<= | Less or Equal | 13 | \>= | Greater or Equal |
139 | \= | Not Equal | 140 | /\Ga | Alpha |
141 | \-> | Right Arrow | 142 | \<- | Left Arrow |
143 | \|v | Down Arrow | 144 | \|^ | Up Arrow |
145 | \Gg | Gamma | 146 | \Gd | Delta |
147 | \Ge | Epsilon | 148 | \Gn | Nu |
149 | \Gh | Theta | 150 | \Gl | Lambda |
151 | \Gr | Rho | 152 | \Gs | Lower Case Sigma |
153 | \Gt | Tau | 154 | \Gw | Omega |
155 | \GD | Delta Triangle | 156 | \PI | Upper Case Pi |
157 | \GW | Upper Case Omega | 158 | \[] | Square Dot |
159 | \oo | Infinity | 171 | \<< | Start Program |
176 | \^o | Degree | 181 | \Gm | Micro |
187 | \>> | End Program | 215 | \.x | Multiplication |
216 | \O/ | Phi | 247 | \:- | Division |
All others | \### where "###" is the three digit ASCII code of the character. For example, the euro symbol is "\160" |
HP ASCII File Format | Back to Index |
An HP formatted text file has two main attributes. First, it probably uses trigraphs to indicates special HP ASCII symbols such as infinity and right arrow. Second, it begins with a special one line header that tells the HP what calculator settings should be used to interpret the file.
The one line header has the form "%%HP: T(t)A(a)F(r);" where t, a, and r are the translation mode, angle mode and radix mode:
Translation Mode | Angle Mode | Radix Mode | |||
---|---|---|---|---|---|
Value | Description | Value | Description | Value | Description |
0 | No translation | D | Degree Mode | . | Period is used as the decimal point: 123,456.789 |
1 | Translate linefeeds (ASCII #10) to carriage-return + linefeed (#13 #10) | G | Gradian Mode | , | Comma is used as the decimal point: 123.456,789 |
2 | Translate some special characters. (HP ASCII characters less than 160 are translated into trigraphs) | R | Radian Mode | ||
3 | Translate all special characters. |
Note that while HPConnect can read files written with any translation mode and send them to the HP, when accepting files from the HP it will always uses translation mode #3.
To use these trigraphs to write HP calculator software on your Mac, use your favorite text editor and use the trigraphs whenever you need a special HP symbol or character. To copy the software to the HP, make sure the text file has a proper header (for example, "%%HP: T(3)A(R)F(.);"). Next, start HPConnect normally,select ASCII transfer mode and send the file to the HP. When the HP receives the file, it will attempt to compile it into an HP object.NOTE: Please note that if the ASCII file is not syntactically correct, the HP calculator will reject it. This is a limitation of the HP, not HPConnect.
© 2005, Michael W. Heinz, Sr - aka "Porkchop D. Clown". All rights reserved. | Back to Index |