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 holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.