hardware.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  2. <html>
  3. <head>
  4. <meta name="GENERATOR" content="Visual Page 1.0 for Windows">
  5. <meta http-equiv="Content-Type" content="text/html;CHARSET=iso-8859-1">
  6. <title>TI-73...92+/V200 TI Link Guide</title>
  7. </head>
  8. <body bgcolor="#ffffe8">
  9. <p><b>TI Link Protocol Guide </b>- Hardware Link Protocol </p>
  10. <center>
  11. <h2>
  12. <hr align="center">Hardware Link Protocol<br>
  13. </h2>
  14. </center>
  15. <p>The TI transfer bus (also called DBus) is a two-wire half-duplex
  16. serial interface consisting of a 'red'/'tip' line (wrapped in red
  17. insulation)
  18. and a 'white'/'ring' line (wrapped in white insulation) with a common
  19. ground.<br>
  20. Both lines are bi-directional, so outputs must be of an open-drain or
  21. an open-collector type (such as i&sup2;C
  22. bus for instance). <br>
  23. Each line is connected to the supply voltage via a pull-up resistor. A
  24. line is then logic high when both of the
  25. calculators hold the line high, and logic low if one or more of the
  26. devices drives the line low.</p>
  27. <p><img src="graphics/hard_layer.gif"
  28. alt="[Electrical Schematic of TI-92 Link Circuitry]" align="bottom"
  29. border="0" height="288" width="311"> <br>
  30. In this way the calculator or any external device can put the line to
  31. logical high and monitor the corresponding
  32. input to see whether the line actually becomes high. This
  33. open-collector structure allows the calculator to drive
  34. an I&sup2;C device directly.&nbsp;
  35. </p>
  36. <h4>The Texas Instruments Hardware Byte-Transfer Protocol</h4>
  37. <p>The link port normally operates in a half-duplex mode where a bit is
  38. sent by activating the corresponding line ("ring" or "tip") and the
  39. receiver acknowledges by activating the other line. The sender now
  40. releases its line and finally the receiver releases the acknowledge. <br>
  41. An "error" condition (="abort") is signalled by activating both lines
  42. at the same time for ~250us. Moreover, the DBus protocol specifies a
  43. maximum bit time of 2 seconds else link time-out will occur.<br>
  44. </p>
  45. <p>Thus, each bit is made of two voltage changes on each two different
  46. wires. The order of the first two voltage impulses
  47. determines whether the bit is high (1) or low (0). A logical '0' is
  48. represented by changing the red wire first,
  49. wheras a logical '1' is represented by changing the white wire first. A
  50. sequence of eight bit transfers constitutes
  51. one byte, least significant bit sent first. The protocol does not allow
  52. for a distinction of byte boundaries.<br>
  53. </p>
  54. <p>The graphing calculator models up to the TI-92 (those with a 6MHz
  55. Z80 processor) can transfer data at roughly
  56. 16 to 18 kilobits per second, whereas the TI-89, TI-92 and TI-92+
  57. (those with the 10-MHz processor) can transfer
  58. data at roughly 45 to 50 kilobits per second. This is not very fast but
  59. it was enough for current models like TI89/92+. Later, TI introduced
  60. handhelds with USB embedded port which should allow better rates.</p>
  61. <p><u>An example of a byte transfer:</u> The byte represented in the
  62. figure is 0xC9 (11001001 in binary).<br>
  63. The first bit transmitted is the least significant bit (LSb) and the
  64. last one is&nbsp; the most significant bit
  65. (MSb) as a serial stream.<br>
  66. Remember that a high status represents a closed circuit and that either
  67. one of the calculators can pull it low.
  68. On the other hand, a low status represents a break in the circuit, and
  69. both calculators must close the circuit
  70. in order to bring the line high again.<br>
  71. This figure shows the electrical status of the data lines during a byte
  72. transfer:</p>
  73. <p><img src="graphics/protocol.gif" alt="[protocol diagram]"
  74. align="bottom" border="0" height="74" width="450"></p>
  75. <p><u>Flow charts of 'put' and 'get' routines:</u> <br>
  76. &nbsp;
  77. <table border="1" width="75%">
  78. <tbody>
  79. <tr>
  80. <td>
  81. <p align="center"><img src="graphics/put_chart.gif"
  82. alt="[PUT routine flowchart]" align="bottom" border="0" height="526"
  83. width="315"> </p>
  84. </td>
  85. <td>
  86. <p align="center"><img src="graphics/get_chart.gif"
  87. alt="[GET routine flowchart]" align="bottom" border="0" height="575"
  88. width="315"> </p>
  89. </td>
  90. </tr>
  91. </tbody>
  92. </table>
  93. </p>
  94. <h4>&nbsp;Example C Routines for the Parallel Link</h4>
  95. <p>You will find below 2 examples of routines: one for sending, the
  96. other for receiving a byte with a parallel
  97. link cable. Link cables are described in the next section.</p>
  98. <p><font face="Courier New, Courier, mono">/*</font> <br>
  99. <font face="Courier New, Courier, mono">Send a byte to the calculator</font>
  100. <br>
  101. <font face="Courier New, Courier, mono">*/</font> <br>
  102. <font face="Courier New, Courier, mono">int put92(char data)</font> <br>
  103. <font face="Courier New, Courier, mono">{</font> <br>
  104. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; int bit;</font>
  105. <br>
  106. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; for(bit=0;
  107. bit&lt;8; bit++)</font> <br>
  108. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; {</font> <br>
  109. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  110. if(data &amp; 1)</font> <br>
  111. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  112. {</font> <br>
  113. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  114. outportb(lpt_out,
  115. 2);</font> <br>
  116. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  117. while((inportb(lpt_in)
  118. &amp; 0x10) == 1);</font> <br>
  119. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  120. outportb(lpt_out,
  121. 3);</font> <br>
  122. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  123. while((inportb(lpt_in)
  124. &amp; 0x10) == 0);</font> <br>
  125. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  126. }</font> <br>
  127. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  128. else</font> <br>
  129. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  130. {</font> <br>
  131. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  132. outportb(lpt_out,
  133. 1);</font> <br>
  134. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  135. while((inportb(lpt_in)
  136. &amp; 0x20) == 1);</font> <br>
  137. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  138. outportb(lpt_out,
  139. 3);</font> <br>
  140. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  141. while((inportb(lpt_in)
  142. &amp; 0x20) == 0);</font> <br>
  143. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  144. }</font> <br>
  145. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  146. data &gt;&gt;= 1;</font> <br>
  147. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; }</font> <br>
  148. <font face="Courier New, Courier, mono">}</font></p>
  149. <p><font face="Courier New, Courier, mono">/*</font> <br>
  150. <font face="Courier New, Courier, mono">Reads a byte from the calculator</font>
  151. <br>
  152. <font face="Courier New, Courier, mono">*/</font> <br>
  153. <font face="Courier New, Courier, mono">unsigned char get92(void)</font>
  154. <br>
  155. <font face="Courier New, Courier, mono">{</font> <br>
  156. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; int bit;</font>
  157. <br>
  158. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; unsigned
  159. char v, data=0;</font></p>
  160. <p><font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;
  161. for(bit=0; bit&lt;8; bit++)</font> <br>
  162. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; {</font> <br>
  163. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  164. while((v = inportb(lpt_in) &amp;
  165. 0x30) == 0x30);</font> <br>
  166. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  167. if(v &amp; 1)</font> <br>
  168. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  169. {</font> <br>
  170. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  171. data
  172. = (data &gt;&gt; 1) | 0x80;</font> <br>
  173. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  174. outportb(lpt_out,
  175. 1);</font> <br>
  176. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  177. while((inportb(lpt_in)
  178. &amp; 0x20) == 0x00);</font> <br>
  179. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  180. outportb(lpt_out,
  181. 3);</font> <br>
  182. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  183. }</font> <br>
  184. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  185. else</font> <br>
  186. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  187. {</font> <br>
  188. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  189. data
  190. = data &gt;&gt; 1;</font> <br>
  191. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  192. outportb(lpt_out,
  193. 2);</font> <br>
  194. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  195. while((inportb(lpt_in)
  196. &amp; 0x10) == 0x00);</font> <br>
  197. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  198. outportb(lpt_out,
  199. 3);</font> <br>
  200. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  201. }</font> <br>
  202. <font face="Courier New, Courier, mono">&nbsp;&nbsp;&nbsp; }<br>
  203. }</font></p>
  204. <p>If you want use a link cable for your own project, you should know
  205. that a complete and multi-platform library exists for handling the
  206. different link cables (hardware &amp; virtual) thru a common API. The
  207. libticables library (source and .dll/.so) can be found either on <a
  208. href="http://www.ticalc.org">ticalc.org</a> (unix directory of the
  209. ticalc's archives) or on the <a href="http://lpg.ticalc.org/prj_tilp/">TiLP
  210. (formerly GtkTiLink) homepage</a>. </p>
  211. <h4>More Information</h4>
  212. <p>You will find here, as a separate documentation, various documents
  213. on the parallel and serial port structure:
  214. </p>
  215. <ul>
  216. <li><a
  217. href="http://gladstone.uoregon.edu/%7Etsinger/TI-86/misc/RS232.html">RS232</a>
  218. information </li>
  219. <li><a
  220. href="http://gladstone.uoregon.edu/%7Etsinger/TI-86/misc/LPTx.htm">parallel</a>
  221. port registers on the PC </li>
  222. <li><a
  223. href="http://gladstone.uoregon.edu/%7Etsinger/TI-86/misc/COMx.htm">serial</a>
  224. port registers on the PC
  225. </li>
  226. </ul>
  227. <p>
  228. <table border="0" cellspacing="0" width="100%">
  229. <tbody>
  230. <tr>
  231. <td width="32%">
  232. <p align="center"><a href="intro.html"><img
  233. src="graphics/prevpage.gif" alt="[previous page]" align="bottom"
  234. border="2" height="32" width="32"><br>
  235. Introduction</a> </p>
  236. </td>
  237. <td width="34%">
  238. <p align="center"><a href="index.html"><img
  239. src="graphics/home.gif" alt="[home]" align="bottom" border="2"
  240. height="32" width="32"><br>
  241. Table of Contents</a> </p>
  242. </td>
  243. <td width="34%">
  244. <p align="center"><a href="cable.html"><img
  245. src="graphics/nextpage.gif" alt="[next page]" align="bottom" border="2"
  246. height="32" width="32"><br>
  247. Link Cables</a> </p>
  248. </td>
  249. </tr>
  250. </tbody>
  251. </table>
  252. </p>
  253. <hr align="center"><i>Site maintained by Romain Li&eacute;vin (</i><a
  254. href="mailto:roms@tilp.info"><i>roms@tilp.info</i></a><i>)
  255. and Tim Singer (</i><a href="mailto:tsinger@gladstone.uoregon.edu"><i>tsinger@gladstone.uoregon.edu</i></a><i>)</i>
  256. </body>
  257. </html>