Hello everyone, this is my first post here!

I'm currently experimenting with modding my TI-89t and I've been working through what I can and can't do with it. Since ArTICL doesn't fully support the 89 family yet (and documentation in general is sparse) I'm going to upload this here in case anyone else is following the same journey I am.

This sketch is pretty simple, it sends either a single ASCII character or a special character to the 89, basically typing as if it was entered on the calc's own keyboard. Unlike the 84, the 89t seems to understand and use ASCII character codes, including for backspace and carriage return. Mighty convenient!

Arduino Sketch:

Code:

/* Key forward/Remote control demo, by hwd2002.
 Type into the serial console to send text as if you typed it.
 Enter the ~ followed by a capital letter or number to send a special keypress.
 For example, '~X' will send a backspace, '~A' will open the apps screen, and more.
*/
#include "TICL.h"

TICL* ticl;
int lineRed = 11; //ring
int lineWhite = 10; //tip
uint8_t thiscode = 0;

void setup() {
  Serial.begin(9600);
  ticl = new TICL(lineRed, lineWhite);
  ticl->resetLines();
  ticl->setVerbosity(false, &Serial);

  Serial.println("TI‑89 Remote Control Ready");
}

void loop() {
  if (Serial.available()) {
    char c = Serial.read();
    if (c == '~') {
      //Misc keys that aren't ascii (That I've found)
      while (!Serial.available());
      char c2 = Serial.read();
      switch (c2) {
        case 'X': sendTISpecialKey(0x01); Serial.println(F("Sent: Backspace")); break;
        case 'Z': sendTIKey(0x0D);        Serial.println(F("Sent: Carriage Return (Enter)")); break;
        case 'B': sendTISpecialKey(0x07); Serial.println(F("Sent: Clear")); break;
        case 'M': sendTISpecialKey(0x0A); Serial.println(F("Sent: Mode")); break;
        case 'A': sendTISpecialKey(0x09); Serial.println(F("Sent: Apps")); break;
        case 'E': sendTISpecialKey(0x15); Serial.println(F("Sent: ESC")); break;//maybe not ESC, OS doesn't seem to treat it the same in popups
        case 'C': sendTISpecialKey(0x16); Serial.println(F("Sent: Catalog")); break;
        case '1': sendTISpecialKey(0x0C); Serial.println(F("Sent: F1")); break;
        case '2': sendTISpecialKey(0x0D); Serial.println(F("Sent: F2")); break;
        case '3': sendTISpecialKey(0x0E); Serial.println(F("Sent: F3")); break;
        case '4': sendTISpecialKey(0x0F); Serial.println(F("Sent: F4")); break;
        case '5': sendTISpecialKey(0x10); Serial.println(F("Sent: F5")); break;
        case '6': sendTISpecialKey(0x11); Serial.println(F("Sent: F6")); break;
        case '7': sendTISpecialKey(0x12); Serial.println(F("Sent: F7")); break;
        case '8': sendTISpecialKey(0x13); Serial.println(F("Sent: F8")); break;
        case 'L': sendTISpecialKey(0x52); Serial.println(F("Sent: Left")); break;
        case 'U': sendTISpecialKey(0x51); Serial.println(F("Sent: Up")); break;
        case 'D': sendTISpecialKey(0x54); Serial.println(F("Sent: Down")); break;
        case 'R': sendTISpecialKey(0x58); Serial.println(F("Sent: Right")); break;
       
        default:  Serial.println(F("Unknown key")); break;
      }

    } else if ((uint8_t)c != 0x00 && (uint8_t)c != 0x0A && (uint8_t)c != 0x0D) {//ignore CR, NL, NULL
      sendTIKey((uint8_t)c);
      Serial.print(F("Sent key: "));
      Serial.println(c);
    }
  }
}

//Setting the header's last byte to 1 allows a few special commands, such as HOME, MODE, CATALOG, CLEAR
void sendTISpecialKey(uint8_t keycode) {
  uint8_t header[4] = {COMP89, KEY, keycode, 0x01};  // high byte = 0x01
  int rlen = 0;
  ticl->send(header, NULL, 0);
  int rval = ticl->send(header, NULL, 0);
  if (rval != 0) return;

  ticl->get(header, NULL, &rlen, 0); //ACK
  ticl->get(header, NULL, &rlen, 0); //Notif
}

//Unlike an 84, we can send plain ASCII and the calc will understand it.
void sendTIKey(uint8_t keycode) {
  uint8_t header[4] = {COMP89, KEY, keycode, 0x00};
  int rlen = 0;
  int rval = ticl->send(header, NULL, 0);
  if (rval != 0) return;

  ticl->get(header, NULL, &rlen, 0);  // ACK
  ticl->get(header, NULL, &rlen, 0);  // Key processed notification
}
Right, a number of ASCII-type key codes are understood on the TI-68k series, which is convenient, as you write πŸ™‚

See also https://github.com/debrouxl/tilibs/blob/master/libticalcs/trunk/src/keys89.h and https://debrouxl.github.io/gcc4ti/kbd.html .
Thanks for the info! The keys89.h file answers my question of how the modifiers worked.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement