Searching \ for 'Interfacing TI calc to PIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Interfacing TI calc to PIC'.

Truncated match.
PICList Thread
'Interfacing TI calc to PIC'
2000\04\25@131610 by Alan B Pearce

face picon face
I recently purchased a TI83 as part of the support requirements for a course I
am doing. I set about looking for what was available on the web about these and
came up with several sites just by entering "TI83" on yahoo. It is claimed that
the interface on the jack plug is I2C, but disassembling the code from a simple
16C84 device that connects it to a serial line for connecting to a PC program
suggests it is not true I2C

If you want further info Andrew, I will look out the info. I assume it is one of
this family of calcs you are talking of.

2000\04\25@143854 by Andrew Seddon

picon face
<x-flowed>Hi, I would be really gratefull if you could tell me where you obtained the
code for the PIC so that I could have a look through it.

>From what I understand it`s not I2C but uses similar hardware, i,e pullups
two data lines etc. That is why there is a bit of software you can get for
the calc that allows you to interface to i2c IC`s, with no external
hardware. I do have the interface specs, I hooked up a simple circuit to
test the way I thought it should work and to cut a long story short it
dosn`t.

I can`t really find any good source of information, you would think TI would
publish it.


{Quote hidden}

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>

2000\04\25@144850 by Ryan Pogge

flavicon
face
you can interface it to an LM75 temp sensor, at least with
the TI-85 you could, ill try to dig up the link with scematic and code...


-----------------------------------------------------------------
"You think thats air your breathing now?"


> Hi, I would be really gratefull if you could tell me where you obtained
the
> code for the PIC so that I could have a look through it.
>
> >From what I understand it`s not I2C but uses similar hardware, i,e
pullups
> two data lines etc. That is why there is a bit of software you can get for
> the calc that allows you to interface to i2c IC`s, with no external
> hardware. I do have the interface specs, I hooked up a simple circuit to
> test the way I thought it should work and to cut a long story short it
> dosn`t.
>
> I can`t really find any good source of information, you would think TI
would
{Quote hidden}

these
> >and
> >came up with several sites just by entering "TI83" on yahoo. It is
claimed
{Quote hidden}

2000\04\25@234229 by Wesley Moore

flavicon
picon face
I have experimented with this and my TI-89. I haven't got anything
functinal out if it but I know how it works. There is a page on my site
realating to this however the source code on that page is a bit old. I
also
have a zip file that I got just the other day with all the documents on
ticalc.org relating to the ti protocol, I can send you this if you want.
If you want a copy of my newest source code I can send it too you
(assuming I can find it) as well. My page it at:
http://minyos.its.rmit.edu.au/~s9906768/pic/proj_ti.html

___________________________________________
Wesley Moore
RMIT - BEng/BApp.Sc. 2nd Year

@spam@wmooreKILLspamspamcs.rmit.edu.au
http://wmoore.tsx.org/

On Tue, 25 Apr 2000, Andrew Seddon wrote:

{Quote hidden}

2000\04\26@080235 by Andrew Seddon

picon face
<x-flowed>Is that zip called ti_protocol or something similar. It`s just that I think
you probably have an outdated version if you got it from ticalc.org. Take a
look at http://gtktilink.ticalc.org. The guy who runs that has compiled a
stack of information on the protocol using a DSP board. Quite a lot extra in
his version of the zip as to the one in the archives of ticalc.

Out of curiosity what kind of electrical interface are you using? Direct
hookups to the PIC pins or pullups/diodes etc. At the minute I have mine
directly connected.


{Quote hidden}

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>

2000\04\26@091801 by Wesley Moore

flavicon
picon face
Thanks for the link. I have updated the source code on my pag (below) this
is my current version (old still). My interface is set up the same way as
Sami did his PICLink (http://sami.ticalc.org/). It uses 2 diodes and 2
pullup resistors.

This following is a desription of the link protocol used by all TI calcs,
it was from a text file called system.txt:

II.6 ) The link microcontroler

Note: This section was written by Sami Khawam
      <EraseMEsKhawamspamspamspamBeGonebigfoot.com>
      <RemoveMEa9501901KILLspamspamunet.univie.ac.at>

All TI calculators have two open-drain lines. There is a method under
Fargo
to access each line individually for input and output (see
"lowlevel.txt"),
but in most cases where byte-transfers are needed, TI's built-in link
routines are simple en effective to use. The protocol used by these
routines
will be described here:

When the lines are not active they are high. You should remember that if
an end of an open-drain line is pulled-down (connected to the ground) by
a device, all devices that are attached to that line (including the
device that pulled the line down) will read a low signal even if they are
trying to pull the line up.

We will assume that Calculator1 (C1) want to send a byte to Calculator2
(C2).
The lines will be refered by L1 and L2. In the text "10" means L1 high
and L2 low, and "01" means L1 low and L2 high.


-In idle mode, both lines are high. Depending on the bit that C1 wants to
send, it will pull-down different lines:

  * .L2 will be pulled-down if the bit is 1.
    .C1 reads now 10.

  * .L1 will be pulled-down if the bit is 0.
    .C1 reads now 01.

C1 will wait until it reads a 00.


-C2 was waiting for a signal change on L1 or L2.

  * .If it reads 10 it knows that the bit sent is 1.
    .L1 will be pulled-down by C2
    .Now C2 reads 00. It will wait for a 01

  * .If it reads 01 it knows that the bit sent is 0.
    .L2 will be pulled-down by C2
    .Now C2 reads 00. It will wait for a 10


-C1 was waiting for a 00. Now it pull-up both lines. After this
C1 will read either 01 or 10.


-C2 will also pull-up the lines, and reads 11.

-C1 reads also 11.


This will be repeated 8 times in order to transfer a bit.

This protocol used by TI on their calculators, is an effective protocol.
But in most cases you do not need to go through those details when
programming, since everything is made by the built-in ROM routines.
To learn more on the byte level protocol, look at \doc\ti-prot.txt

---- End Text ----

That takes a bit of looking at to work out what's going on but eventually
you will se that it quite an intelligent system because each bit is sort
of verified. I hope this was the info you were after. BTW: doesn't look
like I2C to me.

___________________________________________
Wesley Moore
RMIT - BEng/BApp.Sc. 2nd Year

wmooreSTOPspamspamspam_OUTcs.rmit.edu.au
http://wmoore.tsx.org/

On Wed, 26 Apr 2000, Andrew Seddon wrote:

{Quote hidden}

2000\04\26@092843 by Alan B Pearce

face picon face
>That takes a bit of looking at to work out what's going on but eventually
>you will se that it quite an intelligent system because each bit is sort
>of verified. I hope this was the info you were after. BTW: doesn't look
>like I2C to me.

Your description exactly matches what I had worked out was happening. It is
definitely not I2C which really had me puzzled as I had found the item someone
else pointed out where an LM75 temperature sensor had been interfaced to a calc,
but the software provided for the calc actually runs the interface as proper
I2C. It was this that had me scratching my head and wondering what I was
missing.

2000\04\26@095409 by Wesley Moore

flavicon
picon face
Yes, You can use the two data lines however you please if you program the
mem addr directly in assembly, however I can't see the point when tere are
perfectly good ROM calls to tx and rx a whole byte. Just my 2c worth. What
exactly are you planning on using the calc for?

___________________________________________
Wesley Moore
RMIT - BEng/BApp.Sc. 2nd Year

TakeThisOuTwmooreKILLspamspamspamcs.rmit.edu.au
http://wmoore.tsx.org/

On Wed, 26 Apr 2000, Alan B Pearce wrote:

{Quote hidden}

2000\04\26@102057 by Alan B Pearce

face picon face
>What exactly are you planning on using the calc for?

I had been going to try some I2C things with it, and was investigating the
hardware interface side.

However on pondering the interface method used, I get the feeling I have
discovered a very simple protocol to get two PICs to talk to each other, without
the overhead of going to a full deal I2C or SPI interface, which is what I had
been thinking of doing. The sort of loop I'm thinking of here is where there is
a master PIC handling important time critical bits, and offloading stuff like
driving a graphics LCD and handling front panel functions to a slave PIC. It
could even be that a "do you have anything for me" - "no" type of interchange
could be handled with less than 8 bits each direction, where most messages to
transfer actual information would use 8 bit char messages.

2000\04\26@115004 by Andrew Seddon
picon face
<x-flowed>Funny you should talk about that actually as I recently programmed two SX`s
to talk to each other. This was before I even thought about interfacing to
my TI. And without knowing it I basically used the TI protocol, usefull as
most other methods are asynchrounous. Worked well untill I got up to very
high speed transfers. Don`t worry tho way out of range of a PIC i`m talking
changing at 30-40mhz. Probably could of got higher with good PCB design.


{Quote hidden}

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>

2000\04\27@183417 by Andrew Seddon

picon face
<x-flowed>Sorry for the large post but I have no website.

Well there`s good news and bad news. First off I have kind of got the
interface routines working. I say that because it sometimes works and
sometimes dosn`t. When I program my TI-83+ to read a byte then spew it back
out everything works fine. However when I try to make two TI`s, a 83+ and a
TI-82 talk through the PIC it dosn`t work!! Dammned if I know whats up..
Below is the code that I am using if anybody is interested or can find a bug
in it.

BTW it`s in C2C but most of the custom function calls are self explanitary.
Sorry about the lack of comment.

The calc variable is used as I have two calculators connected to one PIC,
both operating off the lower four bits of the A and B ports. The electrical
connection is just

CALC 1 - WHITE - A0 + A2
       - RED   - A1 + A3

CALC 2 - WHITE - B0 + B0
       - RED   - B1 + B3

there are no resistors, diodes anyting, is that the problem??

Here`s the code. Some redundent code commented out, was used it testing.

//RS232 settings
#pragma RS232_TXPORT RC
#pragma RS232_RXPORT RC
#pragma RS232_TXPIN  0
#pragma RS232_RXPIN  1
#pragma RS232_BAUD 19200

#pragma TURBO_MODE 1
#pragma CLOCK_FREQ 50000000

char tris_a=255;
char tris_b=255;

char bytetemp=0, bytetemp1=0;
char temp4=0;

void sendDECNumber( char data )
{
   putchar( '0' + data/100 );
   putchar( '0' + (data%100)/10 );
   putchar( '0' + data%10 );
}

void sendHEXNumber( char data )
{
   //Send high nibble
   if( (data>>4) > 9 )
       putchar( 'A' - 10 + (data>>4) );
   else
       putchar( '0' + (data>>4) );
   //Send low nibble
   if( (data&0x0F) > 9 )
       putchar( 'A' - 10 + (data&0x0F) );
   else
       putchar( '0' + (data&0x0F) );
}

void printf( const char* text )
{
   char i = 0;
   while( text[i] != 0 ) {
       putchar( text[i++] );
       delay_ms(10);
       }
}

void output_white_high(char calc)
{
   if (calc == 1)
       {
           set_bit(tris_a, 0);
           set_tris_a(tris_a);
       }

   if (calc == 2)
       {
           set_bit(tris_b, 0);
           set_tris_b(tris_b);
       }
       delay_ms(2);
}

void output_white_low(char calc)
{
   if (calc == 1)
       {
           clear_bit(tris_a, 0);
           set_tris_a(tris_a);
       }

   if (calc == 2)
       {
           clear_bit(tris_b, 0);
           set_tris_b(tris_b);
       }
       delay_ms(2);
}

void output_red_high(char calc)
{
   if (calc == 1)
       {
           set_bit(tris_a, 1);
           set_tris_a(tris_a);
       }

   if (calc == 2)
       {
           set_bit(tris_b, 1);
           set_tris_b(tris_b);
       }
       delay_ms(2);
}

void output_red_low(char calc)
{
   if (calc == 1)
       {
           clear_bit(tris_a, 1);
           set_tris_a(tris_a);
       }

   if (calc == 2)
       {
           clear_bit(tris_b, 1);
           set_tris_b(tris_b);
       }
       delay_ms(2);
}

char input_white(char calc)
{
   if(calc == 1)
       {
          if(input_pin_port_a(2)) return 1;
          else return 0;
       }

   if(calc == 2)
       {
           if(input_pin_port_b(2)) return 1;
           else return 0;
       }
       delay_ms(2);
}

char input_red(char calc)
{
   if(calc == 1)
       {
          if(input_pin_port_a(3)) return 1;
          else return 0;
       }

   if(calc == 2)
       {
           if(input_pin_port_b(3)) return 1;
           else return 0;
       }
       delay_ms(2);
}

char get_byte(char calc)
{
   char bitcount=0, tempbit=0;
   while(bitcount < 8)
   {
   while ((input_red(calc) == 1) && (input_white(calc) == 1)){nop();}
   //putchar('1');
   if (input_red(calc)==0)
               {
                output_white_low(calc);
                while(input_red(calc)==0);
                //putchar('2');
                bitcount=bitcount + 1;
                output_white_high(calc);
                delay_ms(5);
               }

   if (input_red(calc)==1)
               {
                output_red_low(calc);
                while(input_white(calc)==0);
                //putchar('3');
                if (bitcount == 0) set_bit(tempbit, 0);
                if (bitcount == 1) set_bit(tempbit, 1);
                if (bitcount == 2) set_bit(tempbit, 2);
                if (bitcount == 3) set_bit(tempbit, 3);
                if (bitcount == 4) set_bit(tempbit, 4);
                if (bitcount == 5) set_bit(tempbit, 5);
                if (bitcount == 6) set_bit(tempbit, 6);
                if (bitcount == 7) set_bit(tempbit, 7);

                bitcount=bitcount+1;
                output_red_high(calc);
                delay_ms(5);
               }
   }

   return tempbit;
}


void transmit_high(char calc)
{
   output_white_low(calc);

   while(input_red(calc)==1){nop();}

   output_white_high(calc);

   while(input_red(calc)==0){nop();}

}

void transmit_low(char calc)
{
   output_red_low(calc);

   while(input_white(calc)==1){nop();}

   output_red_high(calc);

   while(input_white(calc)==0){nop();}

}

void send_byte(char byte, char calc)
{

   bytetemp=byte;

   while((input_red(calc)==0) || (input_white(calc)==0)){nop();}
   delay_ms(2);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00000001
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00000010
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00000100
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00001000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00010000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00100000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%01000000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%10000000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);
}


main()
{
   set_tris_a(255);
   set_tris_b(255);
   set_tris_c(11111110b);

   output_port_a(0);
   output_port_b(0);
   output_port_c(0);

  printf("\n\r START \n\r");


  //while(1){
  //temp4=get_byte(1);
  //sendHEXNumber(temp4);
  //printf("\n\r");
  //}


  while(1){
  if(input_red(1)==0) {temp4=get_byte(1); send_byte(temp4, 2);
sendHEXNumber(temp4);}
  if(input_white(1)==0) {temp4=get_byte(1); send_byte(temp4, 2);
sendHEXNumber(temp4);}
  if(input_red(2)==0) {temp4=get_byte(2); send_byte(temp4, 1);
sendHEXNumber(temp4);}
  if(input_white(2)==0) {temp4=get_byte(2); send_byte(temp4,
1);sendHEXNumber(temp4);}
           }


}



________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>

2000\04\27@193141 by Wesley Moore

flavicon
picon face
I think you need the pullup resistors at least, as these prodive the type
of output that you need. Without them you essentially short the pins of
the PIC when the calc is low and you set a pin high on the pic. (Or vice
verso) At least that's what I think, I could be wrong though.

___________________________________________
Wesley Moore
RMIT - BEng/BApp.Sc. 2nd Year

TakeThisOuTwmoorespamspamcs.rmit.edu.au
http://wmoore.tsx.org/

On Thu, 27 Apr 2000, Andrew Seddon wrote:

{Quote hidden}

2000\04\27@193934 by Joe Dudas

picon face
First off, thanks to to everyone posting on this thread, I've been searching
long and hard for info on TI's linking hardware...

Just a small note about transmitting from the TI83 to the TI82. I'm not 100%
sure, but I recall reading somewhere that either the two lines were
reversed, or their signals were inverted (as in, active low). As I said, I'm
not too sure, and I don't have the references on me, but I hope that helps a
bit.

Good luck,
Joe
{Original Message removed}

2000\04\28@062303 by Andrew Seddon

picon face
I think I can get away without the pullups. I say this as the calc has it`s
own internal ones. To pull the line high I just turn the relevant pin to an
input, e.g high impedence and let the pullups do the rest. This is to avoid
the shorting situation.

Just to check I put two 10k pullups in but unfortunately it didn`t make any
difference.

What I want to figure out know is why Sami Khawam has diodes in his PIC
connection, web address http://sami.ticalc.org . I can`t see why they would
be usefull. Also the homemade parralell link has both resistors and diodes
yet has no internal pullup. This has go me mighty confused.

{Quote hidden}

2000\04\28@063327 by Alan B Pearce

face picon face
>What I want to figure out know is why Sami Khawam has diodes in his PIC
>connection, web address http://sami.ticalc.org . I can`t see why they would
>be usefull. Also the homemade parralell link has both resistors and diodes
>yet has no internal pullup. This has go me mighty confused.

He has the diodes because he uses separate pins as inputs and outputs. RA0 and
RA3 are the outputs in his case. Why He does it this way is anybody's guess,
especially as he has an unused "open collector" output at RA4! I suspect this is
related to another project on his webpage, where he provides only basic PIC code
to try it out, but you have to contact him to get the full featured code, and
then I think he supplies a programmed chip. I remember looking at the circuit,
and figuring this circuit is a cut down version of the other circuit.

2000\04\28@070107 by Michael Rigby-Jones

flavicon
face
part 0 2244 bytes
<P><FONT SIZE=2 FACE="Arial">I think I can get away without the pullups. I say this as the calc has it`s</FONT>
<BR><FONT SIZE=2 FACE="Arial">own internal ones. To pull the line high I just turn the relevant pin to an</FONT>
<BR><FONT SIZE=2 FACE="Arial">input, e.g high impedence and let the pullups do the rest. This is to avoid</FONT>
<BR><FONT SIZE=2 FACE="Arial">the shorting situation.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Just to check I put two 10k pullups in but unfortunately it didn`t make any</FONT>
<BR><FONT SIZE=2 FACE="Arial">difference.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">What I want to figure out know is why Sami Khawam has diodes in his PIC</FONT>
<BR><FONT SIZE=2 FACE="Arial">connection, web address<U> </U></FONT><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial"><A HREF="http://sami.ticalc.org" TARGET="_blank">http://sami.ticalc.org</A></FONT></U><FONT SIZE=2 FACE="Arial"> . I can`t see why they would</FONT>
<BR><FONT SIZE=2 FACE="Arial">be usefull. Also the homemade parralell link has both resistors and diodes</FONT>
<BR><FONT SIZE=2 FACE="Arial">yet has no internal pullup. This has go me mighty confused.</FONT>
</P>
</UL>
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">I suspect that he is using the diodes to effectively turn the pin into an open collector/drain. i.e. the pin can pull down, but not source.&nbsp; Not really need IMHO, he could have toggled the corresponding TRIS bit for that pin, ensuring that the output latch was set low.&nbsp; This would also have negated the need to use 2 pins per line.&nbsp; This is just a semi-eductated guess though.</FONT></P>

<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Mike</FONT>
</P>
<BR>

</BODY>
</HTML>
</x-html>

2000\04\28@085625 by M. Adam Davis

flavicon
face
The TI interface is pulled high by resisters, never driven high.  The proper
connection would use two i/o lines.  They should be input at all times unless
you are driving the line low:

PIN = LOW
TRIS = 0 (output)
delay
TRIS = 1 (input)

-Adam

Andrew Seddon wrote:
{Quote hidden}

2000\04\28@102028 by Wesley Moore

flavicon
picon face
I think you are right there. I copied this design (used diodes) because I
couldn't be bothered manipulating the TRIS bits, so I'm lazy!

___________________________________________
Wesley Moore
RMIT - BEng/BApp.Sc. 2nd Year

RemoveMEwmooreEraseMEspamspam_OUTcs.rmit.edu.au
http://wmoore.tsx.org/

On Fri, 28 Apr 2000, Michael Rigby-Jones wrote:

>
>
> > {Original Message removed}

2000\04\28@102231 by Wesley Moore

flavicon
picon face
That's an interesting point you make. Thanks for that one. Looks like I
need to modify my design.

___________________________________________
Wesley Moore
RMIT - BEng/BApp.Sc. 2nd Year

@spam@wmooreRemoveMEspamEraseMEcs.rmit.edu.au
http://wmoore.tsx.org/

On Fri, 28 Apr 2000, M. Adam Davis wrote:

{Quote hidden}

2000\04\28@114707 by goflo

flavicon
face
Since this keeps coming up, those interested might
take a look at http://www.ti.com/calc/docs/83asm.htm

The linkport routines posted work - I've used them.
Note that this is for the 83, NOT the 83+ - Maybe
the 83+ is similar - I don't know.

Regards, Jack

2000\04\28@115536 by Alan B Pearce

face picon face
>The linkport routines posted work - I've used them.
>Note that this is for the 83, NOT the 83+ - Maybe
>the 83+ is similar - I don't know.

I believe the 83+ uses a different ROM which is coded differently enough that
anything needing to access ROM code requires different code to the 83. I do not
know about  port references, they may be different as well. All the sites I have
seen with code for these calcs has separate codes for the 83 and 83+ unless it
is in the "operator interface" language.

2000\04\28@134455 by Andrew Seddon

picon face
<x-flowed>As far as I can tell that`s how I have it setup. The only reason I am using
the four lines is because Sami did with his IRLINK. I couldn`t see any
reason too but I figured his circuit works so why change it. Unfortunately I
have tried to reach him at evey e-mail address I can find on the site but I
can`t get through.

I have done some more testing on the link and things get weirder and
weirder. Like I said before if I bang a bit out at a time in either
direction everything is fine. However when this is done at high speed either
by an assembly program using it`s own protocol or using TI`s own protocol
everything breaks down. Well not quite, it works on the first 3 or 4 bytes.

This I don`t understand as all my routines only exit when both lines are
high, in their normal state. This leads me to belive something strange is
going on, especially knowing that the home made parrallel link does not work
on fast computers. Can the TI be over faced with data??? Well to test this
theory I put big 30ms delays in but still the same effect.

So much for a quick two-three hour problem!!

{Quote hidden}

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>

2000\04\28@135120 by Andrew Seddon

picon face
<x-flowed>Yeh that is true, the rom calls are at different addresses. If anybody wants
to program the 83+ and the 83 use the ION shell. It takes care of all the
addresses for you.


{Quote hidden}

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>

2000\04\29@193031 by Andrew Seddon

picon face
<x-flowed>I have finally managed to get my code working. I found completely by
accident just by putting an extra port state check in that the problems were
eliminated. I pressume that the TI was putting out some noise when it was
transmitting at faster speeds. Anyway for all those interested here are the
rough and ready routines. It`s 1 at night and I can`t be bothered to
optimize them.

In the routines there is provision for two calcs to communicate. They are
connected like so.

CALC1 - Red   - RE0
     - White - RE1

CALC2 - Red   - RE2
     - White - RE3

There are no external components just direct connections. However if you are
going to interface to a homemade parrallel link put a couple of 10k pullups
on the pins. Also you have to make sure your ground the calc cables or the
link won`t work.

PORTE=0;
tris_e=11111111b;

void output_white_high(char calc)
{
   if (calc == 1)
       {
           set_bit(tris_e, 0);
           set_tris_e(tris_e);
       }

   if (calc == 2)
       {
           set_bit(tris_e, 2);
           set_tris_e(tris_e);
       }
}

void output_white_low(char calc)
{
   if (calc == 1)
       {
           clear_bit(tris_e, 0);
           set_tris_e(tris_e);
       }

   if (calc == 2)
       {
           clear_bit(tris_e, 2);
           set_tris_e(tris_e);
       }
}

void output_red_high(char calc)
{
   if (calc == 1)
       {
           set_bit(tris_e, 1);
           set_tris_e(tris_e);
       }

   if (calc == 2)
       {
           set_bit(tris_e, 3);
           set_tris_e(tris_e);
       }
}

void output_red_low(char calc)
{
   if (calc == 1)
       {
           clear_bit(tris_e, 1);
           set_tris_e(tris_e);
       }

   if (calc == 2)
       {
           clear_bit(tris_e, 3);
           set_tris_e(tris_e);
       }
}

char input_white(char calc)
{
   if(calc == 1)
       {
          asm{
          mov w, re
          and w, #%00000001
          bank _inputtemp
          mov _inputtemp, w
          }

          if(inputtemp==0) return 0;
          else return 1;
       }

   if(calc == 2)
       {
          asm{
          mov w, re
          and w, #%00000100
          bank _inputtemp
          mov _inputtemp, w
          }

          if(inputtemp==0) return 0;
          else return 1;
       }
}

char input_red(char calc)
{
   if(calc == 1)
       {
          asm{
          mov w, re
          and w, #%00000010
          bank _inputtemp
          mov _inputtemp, w
          }

          if(inputtemp==0) return 0;
          else return 1;
       }
    if(calc == 2)
       {
          asm{
          mov w, re
          and w, #%00001000
          bank _inputtemp
          mov _inputtemp, w
          }

          if(inputtemp==0) return 0;
          else return 1;
       }
}

char get_byte(char calc)
{
   bitcount=0;
   tempbit=0;

   while(bitcount < 8)
   {
   while ((input_red(calc) == 1) && (input_white(calc) == 1)){nop();}
   if (input_red(calc)==0)
               {
                output_white_low(calc);
                while(input_red(calc)==0){delay_ms(1);}
                bitcount=bitcount + 1;
                output_white_high(calc);
                while(  (input_red(calc)==0) || (input_white(calc)==0)
){nop();};
               }

   if (input_white(calc)==0)
               {

                output_red_low(calc);
                while(input_white(calc)==0){delay_ms(1);}
                if (bitcount == 0) set_bit(tempbit, 0);
                if (bitcount == 1) set_bit(tempbit, 1);
                if (bitcount == 2) set_bit(tempbit, 2);
                if (bitcount == 3) set_bit(tempbit, 3);
                if (bitcount == 4) set_bit(tempbit, 4);
                if (bitcount == 5) set_bit(tempbit, 5);
                if (bitcount == 6) set_bit(tempbit, 6);
                if (bitcount == 7) set_bit(tempbit, 7);
                bitcount=bitcount+1;
                output_red_high(calc);
                while(  (input_red(calc)==0) || (input_white(calc)==0)
){nop();};
               }
   }
   return tempbit;
}

void transmit_low(char calc)
{
  output_red_low(calc);
  while(  (input_red(calc)!=0) || (input_white(calc)!=0)  ){nop();};
  output_red_high(calc);
  output_white_high(calc);
  while(  (input_red(calc)==0) || (input_white(calc)==0)  ){nop();};
}

void transmit_high(char calc)
{
  output_white_low(calc);
  while(  (input_red(calc)!=0) || (input_white(calc)!=0)  ){nop();};
  output_red_high(calc);
  output_white_high(calc);
  while(  (input_red(calc)==0) || (input_white(calc)==0)  ){nop();};
}

void send_byte(char byte, char calc)
{
   bytetemp=byte;

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00000001
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00000010
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00000100
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00001000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00010000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%00100000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%01000000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);

   asm{
   bank _bytetemp
   mov w, _bytetemp
   and w, #%10000000
   bank _bytetemp1
   mov _bytetemp1, w
   }
   if(bytetemp1==0) transmit_low(calc);
   else transmit_high(calc);
}

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

</x-flowed>

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...