James Newton wrote: > Tjaart, thanks for the circuit, just to make sure I understand this, the DB9 > (J2) is connected to a peripheral NOT to a PC (because a PC would be driving > pin 3 and reading pin 2). On the incoming side, who cares about -12? No > problem. But on the TD pin, you are actually driving it between <+12 and > >ground not +12 and -12. Right? And this works? How long a cable have you > used? > > Comments and suggestions: > > Why use the incoming transistor? Is this only for the inversion? If the > signal is inverted in software would you just connect the pin through a > resistor past a zener to the PIC? > > Pin 2 on a peripheral connector (pin 3 on a host connector) will typically > rest at -12 as driven by the external device. My Fluke 77/AN reads about -10 > on pin 3 of the DB9 connected to my PC. Some people (Tom Engdahl > http://www.hut.fi/Misc/Electronics/circuits/rspower.html) have suggested > using this fact to derive -12 for TX power. This makes sense as we normally > are not RXing as we TX. How about adding a diode, resistor and big fat cap > to provide a more or less steady source of -12v to a third (PNP this time) > transistor which drives pin 3 below zero when the NPN is biased off. Engdahl > did something similar in a line buffer circuit > http://www.hut.fi/Misc/Electronics/circuits/rsbuffer.html but he was using > an external power source for extra juice. > > Steve Walz mailto:rstevew@armory.com of http://www.armory.com/~rstevew says > "Use a TTL HI output for the RS232 *GROUND*!! Then you get +/-5VDC levels to > fake out the RS232. When TTL-GND goes HI, then a TTL-XMT LO looks like -5VDC > and a "mark". Even sign problems go away in hardware! When TTL-GND goes LO, > and TTL-XMT goes HI, it looks like +5VDC and a "space"! You can derive the > two TTL signals from one off an inverter or inverter pair! Then magically, > you have direct TTL to RS232 conversion!!" Any comment on that one? > > Oh, by the way, I'm going to sue you for damage done to my eyes by that > purple on green color scheme on your piclist page . (Perfect example > of the type of thinking we live with here in the states where lawyers are > allowed to run free like India with the cows) Resuming all the things about RS232... long time ago in a long and distant galaxy, people used the RS232C physical layer specs that define the levels as "mark" and "space", this was very long time ago, when teletype machines use 75 and 134.5 bps... (read below about it). The teletypes needed to work with magnets to allow selection of =mark= (not the Willys ) or =space=, some machines just had a twin coil magnet with a resting central position. This is the main reason why they *NEEDED* a + and - polarity signals. The use of springs and other magic solutions could not return the magnet mechanical armature to its original position, so a reversed voltage should be necessary to speed up things. Those magnets were produced to work with 6Vdc, that was the average batteries voltage around at that time... remember the old cars with 6V batteries? 12 Volts is quite new, "DUhhhde"! Well, since IBM and others developed lots of new (at that time) machines, based on the same "fire of compatibility" (something that Bill Gates never heard about), RS232 did survived for long time following the same physical layer characteristics, and the old bible of the electronic gurus (written in fire over rocks) always ensured that it was for the eternity. So, by the same way people believe, fight and die for something they don't understand exactly what is it, RS232C still a dogma of needing >+4.5 and <-4.5 Volts as Space and Mark. But, since the "new age" of silicon electronics, I never found a RX RS232 chip that doesn't commute its TTL output from - to + when the RS232 input signal goes down from +4.5 to zero volts. In real, (I can be wrong as always, but..) the real necessity of -12V at the interface is merely a case of "following the rules", and not because the circuits *will not work*. I read somewhere that some RS<>TTL input chips requires a minimum voltage transition from +3 to -3 to commute its ttl output from - to +, but... which one is that? MC1488/9? Even those with silver top or military ones (golden metallic top) flips TTL nicely when RS flips from +4 to Ground. Professionally speaking, yes, use RS232 conversion circuits, Max232, "Min232", "Med232", "Large232" or any other you want, just "to still under the rules", but for tests, prototypes, home made devices, short connection ones, just stick to a pure and simple TTL inverter with a resistor, or couple of them, with or without the zener, it is up to you... any way it will work. Just for your information, I am driving the prototype of a CNC machine, with this fashion of circuit (the final PCB uses a MAX202), using a cable made of ... cheap 4 wires phone cord, the gray parallel one, using 20 ft of it, at 9600 bps, Ground - TX - Ground - RX, with echo check, never had a single wrong byte, in a heavy and noisy industrial environment... The cable just goes along with ... power cable, passes close to two stepper motors that generates lots of EMI... no problem at all, things of electronics. To clarify something: If you will use an UART, you need to invert the signal from RS232 to TTL, because in TTL up level (+) is from zero to -12V at the RS232, TTL down is from ± +3 to +12 at the RS232, nothing else. The UART expects the right levels as start, data and stop bits, but if you are emulating an UART in software, you can do whatever polarity you want. In some of my machines I include a secondary connector for communication, a mirror of the RS232, as pure TTL levels, it demonstrated to be very useful for some other applications. The RS485 is another different story, and it was done to avoid ground loops and to be immune to induced EMI. RS232 is somehow "shoe-laces", after velcro and polymer materials nobody likes to bend and tie shoe-laces anymore, mostly in sport shoes, right?, so why millions of dollars of sport shoes are produced with laces... (is this the correct name for it? laces?) :) Tell me about bowling shoes... [OT] Section === CURIOSITY ABOUT TELETYPES === (Not interested? just skip it.) My first printer tied to the Radio Shack color computer (16k memory) was a teletype running at the tremendous speed of 14cps if I remember well. That machine had much more electronic components (6 diodes, 10 resistors, 5 transistors) on its power supply than at the printing control circuit. It uses just ONE magnet to follows the incoming serial RS232 RX signal. The solenoid's job was to allows a sync running motor to transfer energy (or not) to a complex mechanics, that by its turn selects several bars and finally the X-Y position of a rectangular block of 4x8 characters... then a hammer just bump over the paper, ink tape, character... it was incredible how that thing could print at that speed, and it could work for 30 years without a single problem... fascinating engine from the human imagination. That machine interpreted differently Carriage Return (0Dh) and Line Feed (0Ah) characters, so I needed to dismount 80% of the machine and convert the Line Feed coded bar to understand the Carriage Return, because the Color Computer does not send Line Feeds at the end of the line when printing. I used that machine for almost 18 months, assembler software dumps, large printouts and so on, then purchased an Epson LX80. The old teletype (4x3x4ft, 60lbs) was gently donated (with tears and everything else) to a scrap metal junkyard company (the LX80 followed the same path one year later). Recently I found a LX80 in a surplus store for $3.00, I could identify its previous owner as to be a nice and emotive lady, because her lipstick "good-bye" kiss-mark was visible yet over the white dusty top cover. ==================================================