Paul Kocialkowski's coding blog

Free software, programming and stuff

TI

Connecting a TI-82 Stats and a computer, with free software

Written by Paul Kocialkowski - 11 may 2013 - no comments

TI-82 Stats.fr

As I am a student in High School, I was told to buy one of these TI-82 Stats.fr scientific calculators.
Despite the fact that it runs a proprietary operating system, I had to use it in class for nearly 3 years now and it's not even really convenient to use, especially the programming part. TI created the TI-Basic interpreted language, that the user can use directly by writing programs on the calculator, which is awful. As I was looking for a fast way to write large programs, I looked into the possibilities that existed to connect my calculator and my computer and then write the programs on my computer and transfer them to the calculator.

Making the cable

2.5 mm Jack cable

So I ended up making a cable using only a male DB25 port, two diodes and a 2.5 mm stereo jack: I lent the original calculator to calculator transfer cable at the time I wanted to do this, so I used a 2.5 mm audio jack I had instead. This jack had a microphone ring too, that I wired as ground. However, I guess it's better to not cut-off a wire and use a female 2.5 mm stereo jack connector instead.

DB25 connector

Schematics for the connector are easy to find on the internet but they do not mention whether the connector is seen from its front or back. As a result, I soldered the wires in the wrong order and ended up with a non-working cable. However I though this might happen so I inverted the cables layout and it worked!

Schematics

The software part

TILP2

As the cable was ready, I had to figure out the software part. First, I had to find a computer with a female parallel DB25 port (my recent computer didn't have one since printers, that used that port, are now essentially wired with USB). Then, I looked up what software could handle this. I was amazed to see that there is a whole set of free software libraries to handle the TI calculators, so hopefully, not much was to be done here. I found tilp2 to be a nice front-end for all these libs and decided to go with it. At first, it couldn't use the parallel port because lp was already using it, so I had to unload the lp module so that it could work. After that, the automatic detect function detected my calculator just fine, as a TI-83 (while it is in fact a TI-82 Stats).

Downloading and uploading programs with the calculator worked just as well. Though, I discovered that the programs are not in plain text but have headers, a checksum and a special encoding of what's not plain ASCII text (such as the functions names, the operators, etc). Then, what I needed was a compiler for the TI-Basic language, and I could hardly find one. What came closest to it was the tibasic program, that is free software for Windows, but was ported to GNU/Linux (a matter of writing a Makefile and minor modifications). Though, the files produced by that compiler turned out to make tilp segfault when sending them. After looking closer at it, it turned out that there were differences in the produced header compared to the one of files that came out of the calculator.

The ti83c compiler

So I decided to quickly write such a compiler, matching the expected format for the TI-83, to compile my programs. It was very easy and fast and ended up as the ti83c compiler. Since it is based on the tibasic compiler, I kept its same license and added the original author as a copyright holder of ti83c too, so it's not released under the GPL, but another free software license described in the copyright header block. I didn't test ti83c extensively, but for the programs I wrote, it went just fine.