TTL to RS232 Signal Conversion

Methods:

  • Use a TTL HI output for the RS232 GND: Steve Walz of armory.com 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!!

TTL to RS232 Signal Conversion

M. Adam Davis points out that we should ā€œJust *make sure* the power supply of the pic and/or the power supply of the other rs-232 device are not grounded. ie, my bench power supply has +5v and ground, but the ground is grounded to the house ground, SO is the computerā€™s rs-232 port. I canā€™t use this trick without isolation. This also means that any interaction with other external devices requires some thoughtful planning.ā€ [Ed: this is only true if the devices confuse signal ground and chassis ground. Remember that ground is at DB25 pin 7, and not pin 1 Pin 1 is chassis ground, not signal ground.]

Bob Ammerman [RAMMERMAN at PRODIGY.NET] of RAm Systems says:

Here is a neat trick to get a ā€˜push-pullā€™ output from two PORT A pins:1: define them as analog (ADCON1)
2: TRIS them as outputs.

Now, when you BSF either of them the other will automatically be cleared.

Andrew Warren says:

Of course, if you canā€™t configure the pins as analog inputs (because, for instance, the PIC youā€™re using doesnā€™t HAVE an A/D converter), you can do this:

        MOVLW   00000001B       ;RA0 = 1, RA1 = 0.
        MOVWF   PORTA           ;

        MOVLW   00000011B
        XORWF   PORTA           ;Toggle RA0 and RA1.
        XORWF   PORTA           ;Toggle the two pins again.
        XORWF   PORTA           ;And again...

Or, if those two pins are the only ones defined as outputs on that port:

        MOVLW   00000001B       ;RA0 = 1, RA1 = 0.
        MOVWF   PORTA           ;

        COMF    PORTA           ;Toggle RA0 and RA1.
        COMF    PORTA           ;Again.
        COMF    PORTA           ;And again...

 

TTL to RS232 Signal Conversion Schemetic

 

For more detail:Ā TTL to RS232 Signal Conversion

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter