[TI-H] Re: PIC Interfacing - Web page update(hardware ?)


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

[TI-H] Re: PIC Interfacing - Web page update(hardware ?)




Hi Cullen,

I hope this helps:

Basically, the 2 lines used by the calculator are called open-drain
lines (some people call this also wired-OR networks). To make it
possible for the 2 devices (ie PIC & calc) to communicate in both
directions, those lines have only two possible states: high-impedance
or ground.
This makes sure that when device_1 is putting the line in high-Z
state, device_2 is able to lower the line to ground, without making
a "short circuit". When Device_1 is in high-z mode, it can
senses when the line is lowered by device_2, and thus information
is transmitted.

A line in high-Z state in itself cannot be "measured" by the PIC (or
the calc); it is just as if nothing is connected. The 18k resistor is
a pull-up resistor; it ensures that when the line is in high-Z mode the
voltage on the line is 5V (which can be sensed by the PIC). However,
when the line is connected to ground (by one of the drivers) the
voltage on the line is 0V ( the large value of 18k is to limit the
current flowing between Vdd and 0V when this happens).

If the cables between the calc and the PIC are short, then you dont
need the 18k resistors, as the calculator has already pull-up
resistors inside it.


Now, to make an open-drain line using a PIC (or similarly
in the homemade parallel link) you have two choices:

1-Use only one pin of the PIC: When the line needs to be in
  high-z mode, put that pin in input state. You can now read
  data from this input to see when the other device has lowered
  it.
  If you need to lower the line, just put the pin in output state
  and output 0 (which connects the line to ground). In this case,
  you are sure that the other device is reading 0.

2-Use two lines: one fixed output (RA3) and one fixed input (RA2),
  and a diode in between. The input pin RA2 is always in high-z
  mode.
  When you output 5V to RA3, then the voltages on both sides of the
  diode are the same (at 5V), and the diode does not conduct; so the
  line is in high-z mode (with pull-up) and you are able to read its
  state through RA2. (the diode is also blocking when the line is
  0 and RA3 is high).
  When 0V is output to RA3, then the diode will conduct (5V on +ive
  side and 0V on the -ive) and effectively it will connect the line
  to 0V.
  This is the same thing as in the homemade parallel-link.


Regards,

Sami Khawam
http://sami.ticalc.org




Cullen Logan wrote:
> 
> Sami,
>         Could you explain why you need the 18K ohm resistors on the
> serial lines???  I see that VDD is on the other node but I don't
> understand why the serial lines cannot be directly connected???  Also
> what is the purpose of the Diode that is on RA3?  Sorry to sound so dumb
> but I'm still kinda learning and I would really appreciate any feedback
> you could provide.
> 
> Thanks,
> Cullen Logan
> 
> -----Original Message-----
> From: ti-hardware-bounce@lists.ticalc.org
> [mailto:ti-hardware-bounce@lists.ticalc.org] On Behalf Of Sami Khawam
> Sent: Friday, November 23, 2001 6:42 PM
> To: ti-hardware@lists.ticalc.org
> Subject: [TI-H] Re: PIC Interfacing - Web page update(hardware ?)
> 
> Hi,
> 
> It is possible to use only one pin per line - on the PIC you
> either put the line in input mode (to get the high-Z state)
> or you put it in output mode with zero out (to get the 0 state).
> 
> This is what I did in the PIXpander (using a PIC16F84). Check
> the schematic and asm code on my page.
> 
> Regards,
> 
> Sami Khawam
> http://sami.ticalc.org
> 
> Carlos Becker wrote:
> >
> > At 17:42 23/11/2001 -0600, you wrote:
> >
> > >OK,
> > >         On your schematic you have each calc serial channel tied to
> two
> > >separate pins on the IC.  Is this really necessary?  If both channels
> > >are bidirectional and each pin on the chip is bidirectional then why
> do
> > >you need to use two pins per channel.  From what I understood the
> pins
> > >on the PIC can be input or ouput.  If this isn't so then I understand
> > >the need for it, please correct me if I am wrong.  These PICS are
> very
> > >particular.
> >
> > You're right, pins are bidirectional. To change from input to output
> you
> > have to change the trisa / trisb registers. It was the first approach
> I
> > made, and after trying for about two weeks I thought of changing to
> two
> > inputs and two outputs and it worked. So, in conclusion, it didn't
> work
> > with only two pins. I tried pullups, pull- downs (if they're called
> like
> > that) and everything I could think of. But it didn't work, and
> curiously it
> > did when I changed to two outputs and two inputs.. strange.
> > The software (pic program & ti-92+ program) were the same in both
> cases, so
> > it's even more strange. (well, the pic code was changed to fit to two
> or
> > four pins, just that).
> >
> > You could try it, it's just question of typing some code. If you make
> it,
> > let me know.
> >
> > Cya
> >
> > Carlos Becker




Follow-Ups: References: