serin/hserin fail when i break the standard...


Results 1 to 18 of 18

Threaded View

  1. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You can connect a PIC directly to RS232 (usually though a Resistor). The problem is YES it is inverted. For all intents and purposes a HIGH (say +12v) is ZERO, and a low (-12v) is a ONE. You can extend this by simply saying, that if it isn't a HIGH, then it's got to be a LOW. So again, if the signal is above 5v (ie it has swung to +12) the PIC will tollerate that (our Resistor helps) and Register a PIC LOGIC 1 (RS232=Zero), and if the swing goes to -12v, again our PIC doesn't care once it falls below 0v, because it registers a Logic 0 (RS232=1). So here +12/-12v is fine, just a Resistor and you're good to go.

    If you use SOFTWARE ASYNC like SERIN, you do it simply by specifying that it is inverted and SERIN does the rest.

    But if you use the HARDWARE USART, and HSERIN, there is no automatic way of inverting, so you need something like a MAX232 (or transistor or whatever) to HARDWARE INVERT the signal before you feed it into the PICs USART.

    In this thread a 0v to +3v swing doesn't do it for the PIC running at 5v. 3v may or may not be sufficient to score a Logic 1 in the PIC. It's unreliable, and it looks like f-lez has a problem. But here is where the Comparator scores on TWO COUNTS. (1) it can RESTORE your 0-5v signal (from an input as little as only a few millivolts), and (2) it has the ability to INVERT the output for you (real convenient when you need to INVERT a signal for the USART).

    The COMPARATOR won't give you +12/-12v for OUTPUT purposes, but it will take whatever cr*p you want to throw at it and give you clean Data with a nice solid 0-Vdd swing for the PIC to logically process thereafter. So treat the COMPARATOR as a LOGIC LEVEL SHIFTER, a DATA RESTORER, an INVERTOR, an AMPLIFYER, a NOISE FILTER... what more could you ask for? And you got it FREE all BUILT-IN to your PIC!
    Last edited by Melanie; - 25th March 2010 at 13:52.

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts