Searching \ for '[PIC]:Simple RS232 hardware' 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/ios.htm?key=rs232
Search entire site for: 'Simple RS232 hardware'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:Simple RS232 hardware'
2001\09\08@064306 by Andy Shaw

flavicon
face
Resent missing header!
Hi Folks,
I'm sure this must have been covered before but a search of piclist.com
failed to find anything... Anyway what would you recommend as the
simplest/minimal hardware RS232 interface for use between a PIC and a modern
PC? This is *not* for a production product I would just like to be able to
include a very cheap interface on a home project for occasional
diagnostic/config use. Can I get away without using a MAX* converter? What
are the pros/cons? What would be your suggested circuit?

Thanks

Andy

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


2001\09\08@074230 by Andy N1YEW

picon face
Andy Shaw wrote:
> Resent missing header!
> Hi Folks,
> I'm sure this must have been covered before but a search of piclist.com
> failed to find anything... Anyway what would you recommend as the
> simplest/minimal hardware RS232 interface for use between a PIC and a
> modern PC? This is *not* for a production product I would just like to be
> able to include a very cheap interface on a home project for occasional
> diagnostic/config use. Can I get away without using a MAX* converter? What
> are the pros/cons? What would be your suggested circuit?
>
> Thanks
>
> Andy

Ignore Kat, and try this:

PC:                                 PIC:
TX ---|>|--/\/\/\------ PIC RX
                        |
        GND-/\/\/\-

RX---------------- PIC TX

Works for me every time.

andy

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu


2001\09\08@074451 by Russell McMahon

picon face
part 1 1977 bytes content-type:text/plain; (decoded 7bit)

> I'm sure this must have been covered before but a search of piclist.com
> failed to find anything... Anyway what would you recommend as the
> simplest/minimal hardware RS232 interface for use between a PIC and a
modern
> PC? This is *not* for a production product I would just like to be able to
> include a very cheap interface on a home project for occasional
> diagnostic/config use. Can I get away without using a MAX* converter? What
> are the pros/cons? What would be your suggested circuit?
Andy,

A very common question.
Don't believe all the answers :-).

People will tell you that the receiver can be a resistor from modem tx to
PIC pin as RX.
It indeed "can" be but you violate PIC design specs and in an indeterminate
number of cases it will give you endless problems.

Note that RS232 is "upside down" in polarity to PIC / TTL convention signals
and an inverter is usually used in both TX and RX lines.

As you are coming from a modem you ideally will invert so you get normal
polarity at the PIC so you can use a VERY simple circuit for the receiver -
see attached GIF.
This circuit will convert TRUE RS232 to proper PIC levels.

Diode D1 can probably be omitted in practice.
Resistor values are fairly non critical.
Transistor can be almost any small signal npn - a BC337 is a good choice.
R1 can also quite possibly be omitted but the purists will (justifiably)
complain.

For the transmitter a single resistor could be used if you don't want
inversion.
If you want inversion the same circuit as the receiver can be used with PIC
txdata now on left hand side and output to modem on right hand side. Vcc
could now be replaced by up to +12 v if available.
NB this circuit only switches down to ground and NOT to -12 v as per
"proper" RS232 standard. In practice it will work in just about every case
you will meet.



       regards



                   Russell McMahon



part 2 2576 bytes content-type:image/gif; (decode)


part 3 105 bytes
--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2001\09\08@080551 by Also-Antal Csaba

flavicon
face
Andy Shaw wrote:
>
> Resent missing header!
> Hi Folks,
> I'm sure this must have been covered before but a search of piclist.com
> failed to find anything... Anyway what would you recommend as the
> simplest/minimal hardware RS232 interface for use between a PIC and a modern

pic/sx                                  pc
            17k
Rx----------|||||||----------------Tx
       |
       |
       _
       _
       _ 100k
       _
       |
       | gnd
    _______


Tx----------|||||||----------------Rx
       100 ohm or nothing


On the pic/sx site you must invert the signals.

udv
Csaba

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2001\09\08@104012 by dale

flavicon
face
> I'm sure this must have been covered before but a search of piclist.com
> failed to find anything... Anyway what would you recommend as the
> simplest/minimal hardware RS232 interface for use between a PIC and a modern
> PC? This is *not* for a production product I would just like to be able to
> include a very cheap interface on a home project for occasional
> diagnostic/config use. Can I get away without using a MAX* converter? What
> are the pros/cons? What would be your suggested circuit?

For one-off, home projects, I'm in the "resistor-to-PIC" crowd.  I've used it a dozen or so times with no problems...  but of course people are right, it's not true EIA-232, it's not guaranteed to work, etc etc.  Truth is it will work in the vast majority of cases, but I'd probably not use it in a production device.  I have seen it done in commercial products though, often.  Mice come to mind.

Pros:  Dirt cheap.  Extremely simple.  Dirt cheap.
Cons:  You HAVE to do bit-banged comms, since there is no way to invert UART data.  Also not precisely to PIC datasheet specs.  Of course, neither is at least one of Microchip's app notes using 110VAC directly to a PIC pin via a high-value resistor.  I figure if they do it so can I at less than 10% of the voltage.

In those cases where I had to use the hardware UART and didn't have a MAX232 type device handy, I have (in a pinch, temporarily) used a 74LS04 in place of a MAX232.  Just use two inverter sections to invert the TxD and RxD; I used 330K Ohm resistors between the LS04 and the PC.  I wouldn't say I recommend this, but it has worked for me -- like I said, in a pinch and as a temporary thing.

Dale
--
A train stops at a train station.  A bus stops at a bus station.
On my desk I have a workstation...

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


2001\09\08@112519 by Drew Vassallo

picon face
> > I'm sure this must have been covered before but a search of piclist.com
> > failed to find anything... Anyway what would you recommend as the
> > simplest/minimal hardware RS232 interface for use between a PIC and a
>modern
> > PC? This is *not* for a production product I would just like to be able
>to
> > include a very cheap interface on a home project for occasional
> > diagnostic/config use. Can I get away without using a MAX* converter?
>What
> > are the pros/cons? What would be your suggested circuit?

I've also used the resistor-to-PIC successfully.  Perhaps this information
will help; I got it from the list a while ago:

------------- snip --------------

From: Bob Blick (bobspamspam_OUTTED.NET)
*********************************************************************************
NOTE: THE LOGIC LEVELS BOB INDICATES ARE CORRECT FOR DIRECT-CONNECTIONS MADE
TO
THE SERIAL PORT FROM THE PIC PINS.  YOU DO NOT NEED TO INVERT THE SIGNAL
LEVELS
THAT ARE INDICATED HERE.


Computer:  pin 2 = input (RX), pin 3 = output (TX), pin 5 = ground (GND)
*********************************************************************************
On Sat, 16 Dec 2000, Peter May wrote:
>Is it possible to kook up a one pin out of a 16F84 as a serial out, to a
>serial port on my computer and run a plain old terminal screen so I can
>send
>some values to watch? I gather I would have to hook the pin to the data in
>on the serial and gnd to gnd? It is just for test purposes.

Yes, just hook it up to pin 2 of a regular DB9 connector. The PC wants
to know something is there hardware-wise, so usually I tie pins 7 and 8
together, and also pins 4 and 6 together.

Ground on the DB9 connector is pin 5.

As far as software on the pic, you need to generate time delays equal to
one baud of time, after first sending a start bit(make the pin high) and
shove out the byte one bit at a time by shifting(rotating) right(send the
least significant bits first).

Make sure you send a stop bit(low) after your byte, actually it's good to
delay two stop bits of time.

OK, that sends serial out, but if you use a terminal, it expects ascii, so
you should also create another routine that makes two ascii hex characters
out of a byte so you can send that. A 16 element lookup table works well,
called twice(once for each nibble).

**** NOTE: THIS IS CORRECT IF YOU WANT "5F" TO APPEAR ON YOUR TERMINAL
SCREEN
AS A REPRESENTATION OF A RAW HEX VALUE.  IF YOU WANT TO SEND AND RECEIVE
DATA
DIRECTLY FROM THE TERMINAL TO AN LCD, FOR EXAMPLE, YOU DON'T NEED TO
CONVERT,
AS THE ASCII HEX NOTATION WILL BE CORRECT FOR BOTH SCREENS (ROUGHLY, THERE
ARE A FEW THAT DON'T MIRROR EXACTLY)


--------------- continued snip ----------------------

From: Dale Botkin (@spam@daleKILLspamspamBOTKIN.ORG)

On Sat, 16 Dec 2000, Peter May wrote:
>Is it possible to kook up a one pin out of a 16F84 as a serial out, to a
>serial port on my computer and run a plain old terminal screen so I can
>send
>some values to watch? I gather I would have to hook the pin to the data in
>on the serial and gnd to gnd? It is just for test purposes.

If it's a test lash-up, you can get away with using a 100K Ohm or so
resistor in series with the TxD line to the PC -- that is, TxD on the PIC
conencted to RXD on the PC via a series resistor.  You will need signal
ground also.  Data needs to be sent inverted, which means you can't use
the internal UART on PICs that have them.  I use this with a 16F84 and
others to send data to a PC.  You can do the opposite (receive inverted
data via serial resistor) if you need 2-way communication, same
restriction about not using the internal UART because it can't send or
receive the data inverted.

Some people vehemently oppose this method.  It works quite well every time
for me and several others.  I wouldn't recommend it for a production
system, a MAX232 or similar device works well for that, and you can use
the internal UART.

---------------- end snip ---------------

Good luck.

--Andrew

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2001\09\08@112941 by Jim

flavicon
face
... send to the piclist this time? ...


   "used a 74LS04"

Substitute the 'LS04' with a 74HC14 and
you've got my solution. The HC14 will (Schmitt
Trigger) assure 'clean', sharp tiggering on
slow rise/fall time serial input signals ...

Also, I'm not too sure a *true* "LS04" gate
can actually pulled low through a 330K Ohm
resistor - a true TTL LS (bipolar, Low-power
Schottky) gate is spec'd at more like .4 mA
low-level input current. This would require
a voltage of -132 VDC to be applied to the
330K Ohm resistor to supply .4 mA of current
for a logic low input to the gate!

With a CMOS gate - this is not an issue. Just
make sure the device family includes built-in
"clamping" diodes (normally associated/used
with/for static-protection) ...

Jim



{Original Message removed}

2001\09\08@123422 by James Newton. Admin 3

face picon face
The link from
www.piclist.com/techref/microchip/rs232.htm
to
www.piclist.com/techref/io/serial/ttl-rs232.htm
was broken which may account for your not finding it.

Let me know if there is anything missing.

James Newton, PICList Admin #3
RemoveMEjamesnewtonTakeThisOuTspampiclist.com
1-619-652-0593 phone
http://www.piclist.com

{Original Message removed}

2001\09\08@133408 by Ian Jordan

flavicon
face
Something that works for me on the RX side on the PIC is to use a transistor
do do the inversion and conversion. When I have a project that only does
RS-232 RX, I don't need to deal with the voltage upconversion. One
transistor and two resistors have always worked great for me on the PIC RX
side, even when using the USART.

--Ian

{Original Message removed}

2001\09\08@141437 by Dan Michaels

flavicon
face
Andy Shaw wrote:
>Resent missing header!
>Hi Folks,
>I'm sure this must have been covered before but a search of piclist.com
>failed to find anything...
........


Andy, this topic "has" been beat to death "many" times on piclist
in the past.

However, what you may not understand is that < piclist.com > and the
< PICLIST Mailing List Archives >, ie piclist discussion group, are
not really the same thing. AFAIK, piclist.com does not contain the
archives.

If you want to search the discussion group archives, goto to the
bottom of the page at the folowing site and use the search engine.
You'll find 100s of RS232 references.

http://www.infosite.com/~jkeyzer/piclist/

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamBeGonespammitvma.mit.edu


2001\09\08@145458 by Alexandre Domingos F. Souza

flavicon
face
>This circuit will convert TRUE RS232 to proper PIC levels.

       Of course. But if you see, the parts count is bigger than a MAX-232, so it is easier to use a MAX-232 ;o)))


---8<---Corte aqui---8<----

Alexandre Souza
TakeThisOuTtaitoEraseMEspamspam_OUTterra.com.br
http://planeta.terra.com.br/lazer/pinball/

---8<---Corte aqui---8<----

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestspamTakeThisOuTmitvma.mit.edu


2001\09\08@161042 by James Newton. Admin 3

face picon face
Dan, if you are going to eavesdrop, pay attention. <GRIN>

The piclist.com site DOES have the only COMPLETE piclist archive... all the
way back to December of 1993 with a fast browse, full text search, etc...

There are several other archives which have different good and bad points.
All are discussed at piclist.com

Frankly I have no idea how Andy could have "searched" piclist.com and NOT
come up with literally thousands of hits from the archive and at least one
full FAQ page devoted to this subject.

I found a lot with "RS232 near TTL" as a search phrase and even more with
just "RS232 TTL convert"

James Newton, PICList Admin #3
jamesnewtonEraseMEspam.....piclist.com
1-619-652-0593 phone
http://www.piclist.com


{Original Message removed}

2001\09\08@194957 by Graeme Zimmer

flavicon
face
> For one-off, home projects, I'm in the "resistor-to-PIC" crowd.  I've used
it a dozen or so times with no problems...  but of course people are right,
it's not true EIA-232, it's not guaranteed to work, etc etc.

The sad thing is that it is so easy to arrange a simple interface which IS
true EIA-232.

You need a dual supply (a couple more cells to give the negative line ?) (a
zener to give a voltage drop ?)

and then arrange the switching transistor so that it can go below ground, eg
can switch to both positive and negative voltages.

The important thing is to arrange that the negative going pulse actually
swings a few volts negative.


..................... Zim

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspammitvma.mit.edu


2001\09\08@220553 by Kathy Quinlan

flavicon
face
Ignore Andy as you will be scratching your head until you realise that RS
232 is inverted.

And the MAX * chips are cheap, maxim sends free samples out and all it costs
you is some typing on a web page and a few days later they are at your door
(IIRC you can get 8 chips at a time)


Yes you can use discrete transistors to invert the signal, yes most "New"
equipment accepts 5v RS 232, but older equipment will not, an old Wyse
terminals etc (some ppl use them with monitor programs, some external modems
(one model (number I do not recall)  of netcomes will not work on new PC's
without a level converter.

Andy the reply I sent was correct for the question asked, and follows good
engineering practices of following standards.

Regards,

Kat.

____________________________________________________________________________
The information contained in this email and any files transmitted with it
are confidential and intended solely for the use of the individual or entity
to whom they are addressed. If you have received this email in error please
promptly notify the sender by reply email and then delete the email and
destroy any printed copy. If you have received this email in error, you must
not disclose or use this information in any way.
____________________________________________________________________________


{Original Message removed}

2001\09\09@070437 by steve

flavicon
face
> Don't believe all the answers :-).
>
> People will tell you that the receiver can be a resistor from modem tx
> to PIC pin as RX. It indeed "can" be but you violate PIC design specs
> and in an indeterminate number of cases it will give you endless
> problems.

> Diode D1 can probably be omitted in practice.
> Transistor can be almost any small signal npn - a BC337 is a good
> choice.

Why can't you violate the PIC specs but you can leave out D1 and
violate the transistor specs ?

Steve.

======================================================
Steve Baldwin                Electronic Product Design
TLA Microsystems Ltd         Microcontroller Specialists
PO Box 15-680, New Lynn      http://www.tla.co.nz
Auckland, New Zealand        ph  +64 9 820-2221
email: RemoveMEstevebEraseMEspamEraseMEtla.co.nz      fax +64 9 820-1929
======================================================

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@090724 by mike

flavicon
face
On Sat, 8 Sep 2001 23:45:14 +1200, you wrote:

>> I'm sure this must have been covered before but a search of piclist.com
>> failed to find anything... Anyway what would you recommend as the
>> simplest/minimal hardware RS232 interface for use between a PIC and a
>modern
>> PC? This is *not* for a production product I would just like to be able to
>> include a very cheap interface on a home project for occasional
>> diagnostic/config use. Can I get away without using a MAX* converter? What
>> are the pros/cons? What would be your suggested circuit?
>Andy,
>
>A very common question.
>Don't believe all the answers :-).
>
>People will tell you that the receiver can be a resistor from modem tx to
>PIC pin as RX.
>It indeed "can" be but you violate PIC design specs and in an indeterminate
>number of cases it will give you endless problems.
No you don't - as long as the series resistor is sensible, you do not
exceed the permitted current through the input protection diodes.
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@090726 by mike

flavicon
face
On Sat, 8 Sep 2001 09:39:36 -500, you wrote:

>> I'm sure this must have been covered before but a search of piclist.com
>> failed to find anything... Anyway what would you recommend as the
>> simplest/minimal hardware RS232 interface for use between a PIC and a modern
>> PC? This is *not* for a production product I would just like to be able to
>> include a very cheap interface on a home project for occasional
>> diagnostic/config use. Can I get away without using a MAX* converter? What
>> are the pros/cons? What would be your suggested circuit?
>
>For one-off, home projects, I'm in the "resistor-to-PIC" crowd.  I've used it a dozen or so times with no problems...  but of course people are right, it's not true EIA-232, it's not guaranteed to work, etc etc.  Truth is it will work in the vast majority of cases, but I'd probably not use it in a production device.  I have seen it done in commercial products though, often.  Mice come to mind.
If you KNOW that you will be talking to a PC and not some other serial
device (which may also use nostandard levels), and the cable length
isn't too long (like it's a widget that plugs straight onto the PC
socket, or has a shor (<2M) captive lead, and the baudrate is
sensible, and you're not trying to pull too much power from the
control lines, you should have no hesitation about doing this in
production. It works, period.
>Pros:  Dirt cheap.  Extremely simple.  Dirt cheap.
>Cons:  You HAVE to do bit-banged comms, since there is no way to invert UART data.
> Also not precisely to PIC datasheet specs.  Not enturely true - the data shhets do specify the maximum input clamp
current - although the data I have in front of me lists it in the
'absolute max' parameters, it is entirely reasonable to infer than
operation a couple of orders of magnitude below this is fine.
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@090729 by mike

flavicon
face
On Sat, 8 Sep 2001 10:29:15 -0500, you wrote:

{Quote hidden}

One thing to watch out for - the current consumption of HC series
devices can get a bit high unless you add external clamp diodes. This
is only likely to be an issue for battery powered systems.
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@103810 by Russell McMahon

picon face
> > Don't believe all the answers :-).
> >
> > People will tell you that the receiver can be a resistor from modem tx
> > to PIC pin as RX. It indeed "can" be but you violate PIC design specs
> > and in an indeterminate number of cases it will give you endless
> > problems.
>
> > Diode D1 can probably be omitted in practice.
> > Transistor can be almost any small signal npn - a BC337 is a good
> > choice.
>
> Why can't you violate the PIC specs but you can leave out D1 and
> violate the transistor specs ?

I should learn that if I want a quiet life I should avoid trying to provide
information on dubious short cuts that may save a cent or so :-).
I included that comment for practical completeness. At the cost of a diode
you probably will not want to exclude it .
However, the difference is result between PIC and transistor is substantial.

Note that, even if reverse e-b breakdown does occur, the transistor is NOT
in fact being run OUT of spec - it is just being run in a different part of
its operating range. It is not, in this case, a useful area to run it in but
it is also not harmful per se in a digital circuit.

If you exceed PIC input voltage specs and leak current into the chip via the
protection diodes it can (and sometimes will) cause completely undefined
processor malfunction. In something as complex as a microprocessor the
problem is not that you have exceeded the specs in a defined way on a single
semiconductor device but that you have caused an unknown condition in a
device containing thousands of semiconductor devices in it.

In this circuit, leaving out the diode will cause a reverse voltage to be
placed across the transistor base-emitter junction. Depending on the
transistor this reverse voltage may or may not exceed Vebo max. For small
signal transistors Vebo is typically in the 2 to 10 volt range so in many
cases reverse breakdown will indeed be experienced on RS232 negative input
excursions. If this occurs the transistor will go into "reverse base emitter
breakdown" and the junction will act as a zener diode. Without the input
resistor this could result in transistor destruction. With the input
resistor it will largely just draw some reverse base current. An even
greater current will be drawn if the diode is included. There will be some
minimal transistor heating (typically around a few milliwatt) and some zener
noise generated. BUT the transistor will not turn on. The circuit will still
work as intended. The transistor is NOT in fact being run OUT of spec - it
is just being run in a different part of its specification. It is not, in
this case, a useful area to run it in but it is also not harmful per se in a
digital circuit. Conceivably the small amount of noise generated MAY affect
adjacent sensitive analog circuits but odds are that the RS232 switching
transients are of a far greater magnitude.

Just add the diode! :-)

(Did I pass? :-) )


           Russell McMahon

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@120754 by Olin Lathrop

face picon face
>>
If you KNOW that you will be talking to a PC and not some other serial
device (which may also use nostandard levels), and the cable length
isn't too long (like it's a widget that plugs straight onto the PC
socket, or has a shor (<2M) captive lead, and the baudrate is
sensible, and you're not trying to pull too much power from the
control lines, you should have no hesitation about doing this in
production. It works, period.
<<

While it may work much of the time, claiming it will "work, period" is
rediculous, irresponsible, and just plain wrong.  The valid range of
detection thresholds is from -3V to +3V, with receivers being encouraged to
use some hystersis.  Many receivers deliberately set the detection threshold
to be compatible with TTL levels.  This is perfectly valid as these levels
fall between -3V and +3V even with some hysteresis.  However, receivers that
care more about noise immunity will use negative thresholds too.  I've
personally designed some units that used -2.5V and +2.5V as the detection
thresholds and +-15V as the transmit levels.  These units adhere to the spec
and will work with all other units that also adhere to the spec.  However,
your units would not be able to transmit to them.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, RemoveMEolinspam_OUTspamKILLspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@162332 by steve

flavicon
face
<snip>

> Just add the diode! :-)
> (Did I pass? :-) )

Yeah, yeah. Whatever.  :-)

Steve.




======================================================
Steve Baldwin                Electronic Product Design
TLA Microsystems Ltd         Microcontroller Specialists
PO Box 15-680, New Lynn      http://www.tla.co.nz
Auckland, New Zealand        ph  +64 9 820-2221
email: RemoveMEstevebTakeThisOuTspamspamtla.co.nz      fax +64 9 820-1929
======================================================

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@171101 by Russell McMahon

picon face
>> I'm sure this must have been covered before but a search of piclist.com
>> failed to find anything... Anyway what would you recommend as the
>> simplest/minimal hardware RS232 interface for use between a PIC and a
>modern
>> PC? This is *not* for a production product I would just like to be able
to
>> include a very cheap interface on a home project for occasional
>> diagnostic/config use. Can I get away without using a MAX* converter?
What
{Quote hidden}

// No you don't - as long as the series resistor is sensible, you do not
// exceed the permitted current through the input protection diodes.



This topic (whether you can use the on chip protection diodes for "SAFE"
RS232 reception is a repeating one which has been discussed on list many
times. There are always two groups who take opposing stances. I will
summarise the viewpoint from the point of view of the group who say it is
not a valid thing to do and will suggest partial reasons why.

- Using a series resistor to a PIC pin from an RS232 input exposes the PIC
to voltages in excess of Vcc + 0.6 volts or Ground - 0.6 volts.

- Under these conditions the PIC's internal protection diodes will conduct
to limit the voltage actually appearing at the PIC pins.

- The resultant current entering the PIC die via the protection diodes
creates biases and voltages which are uncontrolled in  the normal sense.

- The allowable voltages guaranteed by Microchip as able to be applied to a
PIC's pins during NORMAL operation vary with device but are usually 0 < V <
Vdd. The GUARANTEED OPERATING voltages are well within the levels at which
the protection diodes conduct

- The ABSOLUTE MAXIMUM voltages guaranteed by Microchip as able to be
applied to a PIC's pins without destroying the PIC or causing permanent
damage  vary with device but are usually 0 - X < V < Vdd + X where X was
originally 0.6 volts and in later data sheets may be 0.3 volts.

- The term "ABSOLUTE MAXIMUM" is an industry standard one and carries the
same meaning here as elsewhere. It loosely means (at the risk of sounding
smart :-) ) "If you apply voltage and current above these levels you are
liable to have a defective chip on your hands. If you apply voltages and
currents at these levels and confidently expect the chip to function
normally while doing so then you are dreaming. If it just happens to work
properly under these conditions then we are very pleased for you, please
don't come any closer, do try to have a nice day. YMMV"

- The ABSOLUTE MAXIMUM conditions guaranteed by Microchip were originally
JUST AT the point where the protection diodes start to conduct and are now
often BELOW the point where the protection diodes conduct.


SO

- Applying RS232 voltages through a straight resistor exceed the NORMAL
guaranteed conditions severely.

- Applying RS232 voltages through a straight resistor place the device ABOVE
the absolute maximum guaranteed voltage for chip survival.

- If the chip DIES during this operation do not be surprised (It is in
practice very unlikely that it will die if you limit the current sensibly
during this operation but MChip do not say it won't).

- If the PIC malfunctions during this operation do not be surprised in any
way whatsoever. The fact that the currents injected may very very very small
compared to "normal" digital signal levels is not relevant. You are
injecting current which goes you know not where, biasing on reverse paths
that do you (and Microchip) know not what, utilising perhaps parasitic
transistors connecting ??? to ??? with outcomes of ???. When multiple
transistors are involved currents in the order of microamps can cause
currents of milliamps to flow. Anything can and sometimes will happen. (Even
a 1 megohm input resistor allows microamps of current to flow.)

Sometimes it works.
Sometimes it doesn't.
I have seen it "not work".
When it doesn't the result may well be inconsistent.
When it goes wrong the result may not be noticed (or only noticed by the
customer when things perhaps only occasionally go wrong).
Your mileage will vary.
Do it if you want to. Don't blame Microchip when it doesn't work.

Note: At least one Microchip application note breaks this "rule".
This does not in any way change any of the above arguments.


regards



       Russell McMahon

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@171920 by David VanHorn

flavicon
face
>
>Note: At least one Microchip application note breaks this "rule".
>This does not in any way change any of the above arguments.

Many projects have died, from following application notes, and ignoring the
specs.

IMHO, there shouldn't be anything in app notes that violates the specs, as
application notes are commonly taken as "how to do (X) with our
chips".  One then assumes that everything shown is in-spec.


--
Dave's Engineering Page: http://www.dvanhorn.org

I would have a link to http://www.findu.com/cgi-bin/find.cgi?KC6ETE-9 here
in my signature line, but due to the inability of sysadmins at TELOCITY to
differentiate a signature line from the text of an email, I am forbidden to
have it.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@172544 by Dale Botkin

flavicon
face
On Sun, 9 Sep 2001, Mike Harrison wrote:

> On Sat, 8 Sep 2001 09:39:36 -500, you wrote:
>
> >Pros:  Dirt cheap.  Extremely simple.  Dirt cheap.
> >Cons:  You HAVE to do bit-banged comms, since there is no way to invert UART data.
> > Also not precisely to PIC datasheet specs.
> Not enturely true - the data shhets do specify the maximum input clamp
> current - although the data I have in front of me lists it in the
> 'absolute max' parameters, it is entirely reasonable to infer than
> operation a couple of orders of magnitude below this is fine.

Yeah, but there's also an absolute maximum voltage for I/O pins listed -
for example, the 'F877 datasheet says -0.3 V to (VDD + 0.3 V).  I think
it's to limit pin current, but the fact is it's listed in teh datasheet...
which is why I said not "precisely" to spec.  I agree it won't break
anything though; for all the hand-waving and prophecies of doom from those
who maintain it's just a bad idea, I have yet to hear anyone claim it's
ever actually damaged a PIC.  Yes, there are some devices that won't work
properly with a 5V single-ended swing on an EIA232 interface, which is why
I'd never say it's a perfect solution.

Dale
--
Hallo, this is Linus Torvalds and I pronounce Linux as Leennuks.
Hallo, this is Bill Gates and I pronounce 'crap' as 'Windows'.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@175038 by Andy Shaw

flavicon
face
> Frankly I have no idea how Andy could have "searched" piclist.com and NOT
> come up with literally thousands of hits from the archive and at least one
> full FAQ page devoted to this subject.
>
> I found a lot with "RS232 near TTL" as a search phrase and even more with
> just "RS232 TTL convert"
>

OK well I'll tell you what I did. I'm not saying what I did was correct and
that there is not a better way to do a search but maybe we could all learn
from my mistake!
1. Went to http://www.piclist.com and typed RS232 into the search box on the front
page. Waited for a while and then got either a page not found or a
connection timed out message (not sure if this was at my end or not but lots
of other sites were Ok at the same time).
2. Thought maybe it was the search engine so I'll try the "advanced" search
just in case that is different. So I typed RS232 into that and got back 2
pages of hits. Looking at them most of them seemed to be about software
issues. Note - looking back at this my mistake may have been not checking
the "full text search option at this stage" sigh!
3. So I typed in RS232 hardware and did the search again. This time I got
back just a single hit which was a reference to an article about an SX
processor.
4. I tried a couple of other search terms but again got timeouts/not found
errors.
5. Decided to do things the hard way so basically browsed around the site
looking for something that covered the topic. I was unable to find anything
that seemed to cover things.
6. Decided to post a quick question half expecting to get told "We've done
this to death, go look at XXXXX" which would have been fine. Instead as
always I got a lot of great answers (and some interesting discussions), from
the other people that looked at the list over the weekend - thanks folks.

So that's my story. I probably should have looked for TTL along with RS232
but I guess it just did not occur to me. I was rather surprised at how few
hits I got on just RS232 and the problems I had with the search engine kind
of made me give up on it. By the way I'm still having problems (at 22:39 (UK
time) 9th Sep), I've been trying to repeat what I did (and try RS232 near
TTL) I can get to http://www.piclist.com and the normal pages but any attempt to
search just gives me a timeout.

Note no criticism of piclist.com here *I know* how much effort it takes to
look after a site like this and I've often found really useful information
there. But James did say he couldn't understand so I thought it may be of
use to explain....

Andy

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\09@200115 by Russell McMahon

picon face
> Yeah, but there's also an absolute maximum voltage for I/O pins listed -
> for example, the 'F877 datasheet says -0.3 V to (VDD + 0.3 V).  I think
> it's to limit pin current, but the fact is it's listed in teh datasheet...
> which is why I said not "precisely" to spec.  I agree it won't break
> anything though; for all the hand-waving and prophecies of doom from those
> who maintain it's just a bad idea, I have yet to hear anyone claim it's
> ever actually damaged a PIC.

I don't think anyone was talking about damaging the PIC - just saying the
product may not work.

> Yes, there are some devices that won't work
> properly with a 5V single-ended swing on an EIA232 interface, which is why
> I'd never say it's a perfect solution.

No - it's worse than that - all the forgoing descriptions were saying that
the PIC receive circuit MAY cause the PIC to malfunction SOMETIMES with
perfectly properly specified RS232 equipment. If a design can live with MAY
and SOMETIMES (and arguably some designs can) then it's a perfect solution
:-) .



       RM

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\09\10@052646 by mike

flavicon
face
On Sun, 9 Sep 2001 10:56:46 -0400, you wrote:

{Quote hidden}

..so your special transceivers are integrated into PCs are they ? I
think you missed the point - I explicitly qualified my comment as
applying only to PCs, which will always use one of a few standard
transceiver chips, not any special 'high noise immunity' one, unless
you're working in a specialised market that uses unusual serial ports
on PCs, in which case you probably don't care about the cost of
transceivers.
I would have no argument whatsoever that if you want to talk to things
other than standard PCs you should use a 'proper' transceiver, but if
you know you're talking to a PC, it is an unnecessary expense.  
I've used PICs with resistors in several products, with many thousands
of units in the field over many years and have had not a single report
of a problem.

_Given the stated limitations_, I stand by my 'it works, period'
statement and would be interested to know of any transciever used in
production PCs that has been found not to work reliably from 5V
levels.
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\09\10@090635 by Olin Lathrop

face picon face
> I explicitly qualified my comment as
> applying only to PCs, which will always use one of a few standard
> transceiver chips, not any special 'high noise immunity' one,

So I suppose you can show us the official specification for a PC that says
the COM port receive levels shalt be 5V logic compatible?


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, EraseMEolinspamspamspamBeGoneembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\09\10@114404 by Russell McMahon

picon face
> > I explicitly qualified my comment as
> > applying only to PCs, which will always use one of a few standard
> > transceiver chips, not any special 'high noise immunity' one,
>
> So I suppose you can show us the official specification for a PC that says
> the COM port receive levels shalt be 5V logic compatible?


I think what he was saying is that the usual / common serial port driver
IC's used in PC's were known to work on 5 volts.
Even if true for PCs, this doesn't necessarily apply to modern laptops.
And it doesn't address the out of spec problem for the PIC when a single
resistor is used in the receive line.

I think we have got to the stage in this thread where we always get to when
this discussion occurs :-).

- A few say that the simple resistor only schemes don't violate PIC specs
(but (seriously) they don't understand how to read spec sheets).

- Some say that the theory is one thing but in practice they have built
zillions and they all worked fine.

- Others (like me) point out that you are asking for trouble by violating
PIC specifications and say that they have seen actual real world problems
caused by doing this. We wonder why THEY have never had the real world
problems that we have seen.

From this point on it is unlikely that anyone is going to change their
positions. The specification violators will keep on violating
specifications. The purists will shake their heads sadly and walk away.

There may be a minor good result - hopefully some will learn to understand
spec sheets a little better :-)



           Russell McMahon

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\09\10@132427 by jamesnewton

face picon face
Before this gets out of hand...

A) Both sides of this argument have valid and useful points.

B) Making unprovable assertions or asking for un-produceable standards is
not going to help anybody get work done.

Let us not focus on the war, but rather on the results. Having said that, I
am impressed that everyone has kept calm and non-personal so far. If it gets
out of hand, I probably won't have time to do more than just unsubscribe the
people who are shouting.

Can we just leave it at...
A) TTL RS232 does NOT adhere to the standard and is probably not acceptable
in a professional, high reliability design.

B) TTL RS232 is a lot less expensive and easier than full signal conversion,
will PROBABLY work just fine, and may be justified for hobby or low cost,
high volume designs. But if you can spare a penny or two...
www.piclist.com/techref/io/serial/ttl-rs232.htm
Has a bunch of nice little tricks for converting ttl to and from rs232
without the expensive MAX232 chips, et all...

---
James Newton, Admin #3 RemoveMEjamesnewtonKILLspamspampiclist.com
1-619-652-0593 VM 1-208-279-8767 FAX
PIC/PICList FAQ: http://www.piclist.com or .org

{Original Message removed}

2001\09\10@135027 by mike

flavicon
face
There is no such thing as an official specification for a PC.

If you want to be really picky, the standard PC itself doesn't
correspond to the RS232 spec (or is it V24 - can't remember what bits
are specified where).  as the gender of the connector is wrong.
In practice, using 5V levels works, and I have enough units in the
field running on all shapes and sizes of PC to be confident that if
there are any odd PCs out there that don't work they are an
insignificant minority that I needn't worry about. Where there is the space and budget for transceivers, fine - use them
and sleep more soundly - I've designed them into several products,
where appropriate. However for applications which are very price
and/or space limited, fitting unnecessary components is wasteful.
There is another important aspect to this - for serial devices that
are RS232-powered (e.g. little custom interface devices which live in
a D9 connector shell), you need to get the power consumption as low as
possible to avoid teh risk of power dropout problems - using 5v levels
without a transceiver saves power. I am WAY more worried about
problems due to insufficient power availability (especially on laptops
etc.) than marginal signal levels.  This is why I always use a
micropower LDO instead of a 78L05 in production devices.

On Mon, 10 Sep 2001 07:35:16 -0400, you wrote:

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\09\11@063752 by Alan B. Pearce

face picon face
>If you want to be really picky, the standard PC itself doesn't
>correspond to the RS232 spec (or is it V24 - can't remember what bits
>are specified where).  as the gender of the connector is wrong.

Not sure how you came to these conclusions.

A standard PC with a DB25 connector is most certainly the correct gender
connector for a DTE which is what the PC would be. I would agree that using
a DB9 is an incorrect connector, but it is still the same gender.

Most PC's (as distinct from laptop's) in the past have used 1488/1489 series
chips or functionally equivalent derivatives to the RS232/TTL level
conversion. These certainly correspond to the RS232 spec.

I would agree that a PC may not include all of the secondary channel pin
functionality that is available on a 25 pin connector, but have never come
across any equipment that could use it anyway.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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