Re: TI-H: PC side code for TI calc communications


[Prev][Next][Index][Thread]

Re: TI-H: PC side code for TI calc communications




Do I need to do everything for you?!  Don't you know how to use their
search engine!  I don't know where the stupid file is, but since you want
to waste my 5 minutes, I'll go find it.

// Initialize Link port
int init_ti(void) {
  _outp(lpt_out,3);
  return 0;
}

// Send a byte out to the TI
int put_ti(unsigned char data) {
  int bit,titime=0;

  for (bit=0; bit<8; bit++) {
    _inp(lpt_in);
    _inp(lpt_in);
    _inp(lpt_in);
    if (data&1) {
//      getkey();
//      printf("Bit %d is a 1\n",bit);
//      fflush(stdout);
      _outp(lpt_out,2);
      while (_inp(lpt_in)&0x10) if(titime++>TIMAXTIME) return -1;
      _outp(lpt_out,3);
      while ((_inp(lpt_in)&0x10)==0x00) if(titime++>TIMAXTIME) return -1;
    } else {
//      getkey();
//      printf("Bit %d is a 0\n",bit);
//      fflush(stdout);
      _outp(lpt_out,1);
      while (_inp(lpt_in)&0x20) if(titime++>TIMAXTIME) return -1;
      _outp(lpt_out,3);
      while ((_inp(lpt_in)&0x20)==0x00) if(titime++>TIMAXTIME) return -1;
    }
    data>>=1;
  }
  return 0;
}

// Receive a byte from the TI
int get_ti(void) {
  int bit,titime=0;
  unsigned char data=0, v;

  for (bit=0; bit<8; bit++) {
    while ((v=_inp(lpt_in)&0x30) == 0x30) if(titime++>TIMAXTIME) return -1;
    if (v==0x10) {
      data=(data>>1)|0x80;
      _outp(lpt_out,1);
      while ((_inp(lpt_in)&0x20)==0x00) if(titime++>TIMAXTIME) return -1;
      _outp(lpt_out,3);
    } else {
      data=data>>1;
      _outp(lpt_out,2);
      while ((_inp(lpt_in)&0x10)==0x00) if(titime++>TIMAXTIME) return -1;
      _outp(lpt_out,3);
    }
    _inp(lpt_in);
    _inp(lpt_in);
    _inp(lpt_in);
  }
  return data;
}


>Um... file names?
>directories?
>please stop the sarcasm
>you are a great guy grant, but sometimes you can get a little bit sarcastic.
>
>(you hurt my feelings!! :)
>
>Jonathan
>
>At 08:39 PM 10/8/98 -0800, you wrote:
>>
>>Um...  ftp.ticalc.org
>>
>>
>>>Hello. Does anyone know of any code for the PC that allows bytes to be sent
>>>and recieved via the parallel/serial cable (all three types: homemade par,
>>>homemade serial, and graphlink)?  This would be greatly appreciated.  I
>>>think I can figure out for the graphlink, but the others would take
>>>considerable more time.  They have to ba able to communicate using the TI
>>>protocl.
>>>
>>>Any help would be appreciated.
>>>thank you,
>>>
>>>-Jonathan Kaus
>>>kaus@cybrzn.com
>>>jedsmeny@hotmail.com
>>>jedsmeny on IRC  (DALNet or EFNet)
>>>ICQ: 15973088 (jedsmeny)
>>>AIM: Jedsmeny
>>
>>
>>
>>




Follow-Ups: References: