can i use my arduino to send programs to a ti83+? because i dont have the required link cable, but i do have a spare 3.5mm headset. and i got a 2.5 to 3.5 mm adapter Razz
legodude wrote:
can i use my arduino to send programs to a ti83+? because i dont have the required link cable, but i do have a spare 3.5mm headset. and i got a 2.5 to 3.5 mm adapter Razz
Technically you certainly could using an Arduino and this code. The trick would be writing computer-side software to tell the Arduino what to send, or using something like an LCD and an SD card to choose files to send Arduino-side.
ah ok, thanks. that is way out of my reach Razz
Dear all,


I'm having troubles resolving the REAL A var using KermMartian's routines.
I'm getting hex numbers but these hex numbers are wrong. Does anybody know what i'm doing wrong? Here is my code:


Code:
void resetLines(); 
static int par_put(uint8_t *data, uint32_t len); 
static int par_get(uint8_t *data, uint32_t len); 
#define TIring 6 //White
#define TItip 7 //Red
#define ERR_READ_TIMEOUT 1000 
#define ERR_WRITE_TIMEOUT 2000 
#define TIMEOUT 4000 
#define GET_ENTER_TIMEOUT 30000 

void setup(){
resetLines();

}

void loop(){
 
  Serial.begin(9600);
  resetLines();
 
 /*
  uint8_t A [19] = {0x73,0xA2,0x0D,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00};  //request dir
  resetLines();
  par_put(A, 19); //send the packet

 
  par_get(A,4); // get the ACK
  if (A[1] == 0x56) {
    par_get(A,8); //get free memory
    uint8_t A [4] = {0x73,0x56,0x00,0x00};   //Acknowledgement of variable header
    par_put(A, 4);
   
    int var=0;
    while (var!=1)
    {
      par_get(A, 19);
      Serial.print(A[1]);
     
      if(A[1] == 0x92){
       var=1;
      }
      uint8_t A [4] = {0x73,0x56,0x00,0x00};   //Acknowledgement of variable header
      par_put(A, 4);
    }
    Serial.print("karel");
*/   
    uint8_t C [19] = {0x73,0xA2,0x0D,0x00,0x09,0x00,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4A,0x00};  //packet for pulling str1 
    par_put(C, 19); //send the packet
 
    // get the ACK
    par_get(C,4);
    if (C[1] == 0x56) {
      //Serial.print("ok1");
      par_get(C,19);
      uint8_t C [4] = {0x73,0x56,0x00,0x00};   //Acknowledgement of variable header
      par_put(C, 4);
      uint8_t B [4] = {0x73,0x09,0x00,0x00};   //Acknowledgement of variable header
      par_put(B, 4);
      par_get(B,4);
      if (B[1] == 0x56) {
        //Serial.print("ok");
        par_get(C,19);
        uint8_t D [4] = {0x73,0x56,0x00,0x00};   //Acknowledgement of variable header
        par_put(D, 4);
        Serial.print(C[0]);
        Serial.print(C[1]);
        Serial.print(C[2]);
        Serial.print(C[3]);
        Serial.print(C[4]);
        Serial.print(C[5]);
        Serial.print(C[6]);
        Serial.print(C[7]);
        Serial.print(C[8]);
        Serial.print(C[9]);
        Serial.print(C[10]);
        Serial.print(C[11]);
        Serial.print(C[12]);
        Serial.print(C[18]);
        Serial.println(C[19]);
      }
     
    }
   
   
  //}
  delay(2000);
}
 



//TI LINK PROTOCOL CODE
void resetLines() { 
   pinMode(TIring, INPUT);           // set pin to input 
   digitalWrite(TIring, HIGH);       // turn on pullup resistors 
   pinMode(TItip, INPUT);            // set pin to input 
   digitalWrite(TItip, HIGH);        // turn on pullup resistors 

static int par_put(uint8_t *data, uint32_t len) { 
   int bit; 
   int i, j; 
   long previousMillis = 0; 
   uint8_t byte;     

   for(j=0;j<len;j++) { 
      byte = data[j]; 
      for (bit = 0; bit < 8; bit++) { 
         previousMillis = 0; 
         while ((digitalRead(TIring)<<1 | digitalRead(TItip)) != 0x03) { 
            if (previousMillis++ > TIMEOUT) 
               return ERR_WRITE_TIMEOUT+j+100*bit; 
         }; 
         if (byte & 1) { 
            pinMode(TIring,OUTPUT); 
            digitalWrite(TIring,LOW); 
            previousMillis = 0; 
            while (digitalRead(TItip) == HIGH) { 
               if (previousMillis++ > TIMEOUT) 
                  return ERR_WRITE_TIMEOUT+10+j+100*bit; 
            }; 

            resetLines(); 
            previousMillis = 0; 
            while (digitalRead(TItip) == LOW) { 
               if (previousMillis++ > TIMEOUT) 
                  return ERR_WRITE_TIMEOUT+20+j+100*bit; 
            }; 
         } else { 
            pinMode(TItip,OUTPUT); 
            digitalWrite(TItip,LOW);      //should already be set because of the pullup resistor register 
            previousMillis = 0; 
            while (digitalRead(TIring) == HIGH) { 
               if (previousMillis++ > TIMEOUT) 
                  return ERR_WRITE_TIMEOUT+30+j+100*bit; 
            }; 

            resetLines(); 
            previousMillis = 0; 
            while (digitalRead(TIring) == LOW) { 
               if (previousMillis++ > TIMEOUT) 
                  return ERR_WRITE_TIMEOUT+40+j+100*bit; 
            }; 
         } 
         byte >>= 1; 
      } 
      //delayMicroseconds(6); 
   } 
   return 0; 


static int par_get(uint8_t *data, uint32_t len) { 
   int bit; 
   int i, j; 
   long previousMillis = 0; 

   for(j = 0; j < len; j++) { 
      uint8_t v, byteout = 0; 
      for (bit = 0; bit < 8; bit++) { 
         previousMillis = 0; 
         while ((v = (digitalRead(TIring)<<1 | digitalRead(TItip))) == 0x03) { 
            if (previousMillis++ > GET_ENTER_TIMEOUT) 
               return ERR_READ_TIMEOUT+j+100*bit; 
         } 
         if (v == 0x01) { 
            byteout = (byteout >> 1) | 0x80; 
            pinMode(TItip,OUTPUT); 
            digitalWrite(TItip,LOW);      //should already be set because of the pullup resistor register 
            previousMillis = 0; 
            while (digitalRead(TIring) == LOW) {            //wait for the other one to go low 
               if (previousMillis++ > TIMEOUT) 
                  return ERR_READ_TIMEOUT+10+j+100*bit; 
            } 
            //pinMode(TIring,OUTPUT); 
            digitalWrite(TIring,HIGH); 
         } else { 
            byteout = (byteout >> 1) & 0x7F; 
            pinMode(TIring,OUTPUT); 
            digitalWrite(TIring,LOW);      //should already be set because of the pullup resistor register 
            previousMillis = 0; 
            while (digitalRead(TItip) == LOW) { 
               if (previousMillis++ > TIMEOUT) 
                  return ERR_READ_TIMEOUT+20+j+100*bit; 
            } 
            //pinMode(TItip,OUTPUT); 
            digitalWrite(TItip,HIGH); 
         } 
         pinMode(TIring, INPUT);           // set pin to input 
         digitalWrite(TIring, HIGH);       // turn on pullup resistors 
         pinMode(TItip, INPUT);            // set pin to input 
         digitalWrite(TItip, HIGH);        // turn on pullup resistors 
      } 
      data[j] = byteout; 
      //delayMicroseconds(6); 
   } 
   return 0; 


Thanks in advance

EDIT

I forgot to output it ias HEX


Code:
void setup(){
resetLines();

}

void loop(){
 
  Serial.begin(9600);
  resetLines();
 
 /*
  uint8_t A [19] = {0x73,0xA2,0x0D,0x00,0x00,0x00,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x00};  //request dir
  resetLines();
  par_put(A, 19); //send the packet

 
  par_get(A,4); // get the ACK
  if (A[1] == 0x56) {
    par_get(A,8); //get free memory
    uint8_t A [4] = {0x73,0x56,0x00,0x00};   //Acknowledgement of variable header
    par_put(A, 4);
   
    int var=0;
    while (var!=1)
    {
      par_get(A, 19);
      Serial.print(A[1]);
     
      if(A[1] == 0x92){
       var=1;
      }
      uint8_t A [4] = {0x73,0x56,0x00,0x00};   //Acknowledgement of variable header
      par_put(A, 4);
    }
    Serial.print("karel");
*/   
    uint8_t C [19] = {0x73,0xA2,0x0D,0x00,0x09,0x00,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4A,0x00};  //packet for pulling REAL A
    par_put(C, 19); //send the packet
 
    // get the ACK
    par_get(C,4);
    if (C[1] == 0x56) {
      //Serial.print("ok1");
      par_get(C,19);
      uint8_t C [4] = {0x73,0x56,0x00,0x00};   //Acknowledgement of variable header
      par_put(C, 4);
      uint8_t B [4] = {0x73,0x09,0x00,0x00};   //Acknowledgement of variable header
      par_put(B, 4);
      par_get(B,4);
      if (B[1] == 0x56) {
        //Serial.print("ok");
        par_get(C,15);
        uint8_t D [4] = {0x73,0x56,0x00,0x00};   //Acknowledgement of variable header
        par_put(D, 4);
        Serial.print(C[0],HEX);
        Serial.print(" ");
        Serial.print(C[1],HEX);
        Serial.print(" ");
        Serial.print(C[2],HEX);
        Serial.print(" ");
        Serial.print(C[3],HEX);
        Serial.print(" ");
        Serial.print(C[4],HEX);
        Serial.print(" ");
        Serial.print(C[5],HEX);
        Serial.print(" ");
        Serial.print(C[6],HEX);
        Serial.print(" ");
        Serial.print(C[7],HEX);
        Serial.print(" ");
        Serial.print(C[8],HEX);
        Serial.print(" ");
        Serial.print(C[9],HEX);
        Serial.print(" ");
        Serial.print(C[10],HEX);
        Serial.print(" ");
        Serial.print(C[11],HEX);
        Serial.print(" ");
        Serial.print(C[12],HEX);
        Serial.print(" ");
        Serial.print(C[13],HEX);
        Serial.print(" ");
        Serial.print(C[14],HEX);
        Serial.print(" ");
        Serial.print(C[15],HEX);
        Serial.print(" ");
      }
     
    }
   
   
  //}
  delay(2000);
}
 
Just to clarify, did you resolve this issue, or are you still having problems? Was the reason you were getting "wrong" values that you weren't converting to hexadecimal? If not, what errors or incorrect behavior are you seeing now?
KermMartian wrote:
Just to clarify, did you resolve this issue, or are you still having problems? Was the reason you were getting "wrong" values that you weren't converting to hexadecimal? If not, what errors or incorrect behavior are you seeing now?

Yes it's working now.
I just wrote my own routine to talk to an arduino uno. Then I saw your code in the forum and renamed my reset sub to resetlines. While mine works, I find that if I run it twice, either some of the data doesn't get through of the arduino hangs waiting for some data. I have to go through hoops to get the 83+ to work with the uno again. I am following the protocols, but either I am missing something and not cleaning up or ? My question is: can I reset the calculator (not destructively to memory) via the link or can I hit some keys to make sure it is receptive? I am using silent transfers for the data. All my command seem to work. I even have it drawing a circle on screen. I think it is some sort of garbage collection issue. By the way Reset to defaults doesn't help.
Thanks
Docbill, have you considered that the state on your Arduino might be what's "dirty", so to speak, rather than the state on the calculator? Have you tried hitting your Arduino's reset button to see if that makes the transfers resume? I'd be interested in taking a look at your code, if you feel like sharing it in this topic.
Resetting the Arduino has no effect (when you use the serial monitor it does a reset and the hard reset doesn't change anything either). The code is full of debugging code right now and I'd like to clean it up before posting any of it. Maybe in a few days.
It must be the calculator, because, sometimes, if I plug and unplug it I get some I/O--although wrong. I actually wrote a routine to run at the start to read and dump anything the calculator might be sending before my program tries to work, but it didn't help. Maybe it's waiting for input? Also when it is "hung" response to the keyboard is very sluggish. Let me clean up the code and I'll post some of the pertinent routines
Problem solved. It IS the calculator. Apparently my 83+ is not quite right. I tried an 84+ and it works flawlessly. I may tinker with the 83, but at least I know where the problem is.
By the way, I made my cable by buying a 2.5male to 2.5 male on line (ebay I think) and then cut it in half. Works with 83+ and 84+. Now I can clean it up,
New question: When I connect to an 84+ the program works great (maybe I'll release the code when I clean it up), but with my 83+ it has problems. I tried it with a friend's 83+ (also poor condition) and it is even worse. Is there something in the protocol that I am missing for the 83+ or do I have 2 bad apples?
docbill wrote:
New question: When I connect to an 84+ the program works great (maybe I'll release the code when I clean it up), but with my 83+ it has problems. I tried it with a friend's 83+ (also poor condition) and it is even worse. Is there something in the protocol that I am missing for the 83+ or do I have 2 bad apples?
Just to carry over what you discovered from another thread, either adding resistors between the calculator and the Arduino or enabling the internal Arduino pull-up resistors should do the trick here.
Which part of a TI-84+'s link port is TX, RX, and ground? I finally got the needed parts to link my Arduino and calculator, but I need to know what to hook up to where. From what I can tell from the picture on the bottom of the first page, the sleeve is ground, but I don't know about the tip and ring.

Thanks!
The protocol used by TI's OS doesn't have a clear TX / RX separation over the wires like most serial protocols do: it's some kind of a half-duplex protocol where state changes for one of the lines are acknowledged by state changes on the other line.
For more details than my short overview, see the resource known as "linkguide", part of the TILP umbrella Smile

That peculiar protocol is the reason why the serial (BlackLink / "$4 cable") and parallel (ParallelLink a.k.a "$5 cable") cables require direct R/W to the wires' state. Few USB / RS232 (DB9) or USB / parallel (DB25) adapters provide support for reading + writing the wires' state, which is why using an USB adapter and an old link cable, instead of an official (if costly) SilverLink, is usually met with failure.
OK, that makes sense. That's what it seemed like was the case, but I wasn't sure since they didn't sound right to me. Thanks!

When I get a chance to test it I'll report back somewhere on the forum my results.

EDIT: I am unsure of where to find information on packets. I found what appears to be an archive of the myserverathome.com site, but the "packet formats" page for ti-83+ doesn't say much. I've noticed that their example for a lowercase 'm' is "23 87 A6 00", and on the first page lyron's code indicates a capital 'A' is "23 15 9A 00".

I've found the codes for letters and other keys, and I know what "23" does, but I have no idea about "87" or "15", or what other ones there are. If anyone has any information I'd love to know about it.
See:
* https://github.com/debrouxl/tilibs/blob/master/libticalcs/trunk/src/dbus_pkt.h for the packet IDs;
* https://github.com/debrouxl/tilibs/blob/master/libticalcs/trunk/src/calc_73.c (operations), https://github.com/debrouxl/tilibs/blob/master/libticalcs/trunk/src/cmd73.c (helper functions for the operations), https://github.com/debrouxl/tilibs/blob/master/libticalcs/trunk/src/dbus_pkt.c (final packet build).
Thank you very much, those are perfect. I tried writing a simple Arduino sketch to test it and it doesn't work. I'll create a new thread and post my code there. I'm pretty sure the problem is the cable I have, but I want to make sure its not the code too.
yowann wrote:
Thank you very much, those are perfect. I tried writing a simple Arduino sketch to test it and it doesn't work. I'll create a new thread and post my code there. I'm pretty sure the problem is the cable I have, but I want to make sure its not the code too.
Good luck; hopefully that new topic of yours does the tricky in helping you (and us) track down the issue.
I'm working on a project that involves silent reading of data stored in variables on my TI-84+/SE from an arduino. I tried out your code Kerm but I am getting no readings. No values are being pulled from the calc. I tried Biohax17's little code to get the hex data from the A var, didnt work either, the calc just laggs like crazy. I am using an arduino UNO and I am connecting it with a 2.5mm 3 band audio connector I got at radioshack. You said earlier that it can be because the connector isn't not resting snug in the jack, I checked and I don't think thats my problem. Thanks in advance in anyone can help me out with this!
Did you already try swapping the two data lines? Did you make sure you connected ground to the correct pin on the plug? The symptoms you describe (the lagging) is what happens when you short one of the data lines to ground.
  
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 3 of 4
» 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