UART vs software RS232


Closed Thread
Results 1 to 28 of 28

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Normnet View Post
    QUOTE

    SEROUT PORTB.7,<font color=red>1</font color>,["START",13] '1200 true
    SEROUT PORTB.7,<font color=red>5</font color>,["START",13] '1200 inverted

    Norm
    RTFM applies here, in the serout and serout2 sections, you will discover " MODE ", now when using <font color=red>SEROUT</font color>, if you <font color=blue>INCLUDE "modedefs.bas"</font color>, you can specify the mode as in below:
    Code:
    SEROUT PORTB.7,<font color=red>T1200</font color>,["START",13]  '1200 true
    SEROUT PORTB.7,<font color=red>N1200</font color>,["START",13]  '1200 inverted
    Last edited by Archangel; - 1st September 2008 at 22:22.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2


    Did you find this post helpful? Yes | No

    Default Back to the specification of RS-232

    RS-232 defines the idle condition as steady MARK. This is -3 to -15 volts AT THE CONNECTOR. Likewise SPACE is a positive voltage of +3 to +15 AT THE CONNECTOR. In contrast, PIC 'idle' is almost always assumed to be 0 volts.

    These high(ish) interface voltages are well beyond TTL levels and so an Interface Converter or Line Driver is frequently required such as the older 1488 and 1489 or the newer MAX-232 family. Line Driver chips also serve for electrical protection of the PIC from outside interference and are usualy socketed on the circuit baord for easy replacement as they get zapped fairly often.

    Line drivers/interface converters are all INVERTERS. So this means the levels at the PIC are now the opposite of what you mention in your first post. MARK, which was a negative voltage at the connector becomes +5 volts at the PIC. SPACE becomes 0 volts at the PIC.

    SERIN allows selection of 'true' and 'inverted'. You use 'true' when you use a line driver or max-232, otherwise use the 'inverted' setting when you have no interface chip in line. HSERIN and SERIN2 expect you to use an inverting interface chip IF you are going to the outside world via an RS-232 connector.

    For short distance or internal PIC to PIC comms you can dispense with the line drivers but you will probably get errors in the first character when sending between PICs at TTL levels.

    To eliminate these errors all you have to do is condition the interface to 'mark' with a positive voltage long enough for a character time. You only need do this at the start of each message or you can ignore this issue and simply add a few throwaway characters at the start of every message. I find it better to add the HIGH xxx : PAUSE n and get every character every time.

    Try using
    HIGH TxDpin
    PAUSE 1
    and then output your message such as..
    SEROUT/HSEROUT/SEROUT2 TxDpin, message

    HTH
    BrianT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I know all about the history of those higher voltages but now in the 0 - 5 volt world....does it really just come down to this?....

    HSEROUT and HSERIN needs an inverted input where SEROUT and SERIN can operate either true or inverted? (as long as both ends are the same?)

    My device is set to true, 1200 baud, 8N1....having problems with wireless but fine with wired...whether a straight short RS232 or I also have an RS485 connection that can run for a mile. Works like a champ.

    I'm going to look closer at it today -- never had much luck with wireless.....(yet).

    Fact is though, using serout and serin, phase isn't an issue, as long as both ends are the same, right? Both T or Both N.

    Correct?

  4. #4
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    What is the RS232 spec on the device to which you are interfacing?

    Norm

  5. #5


    Did you find this post helpful? Yes | No

    Default

    I'm not having any luck -- works great wired though.

    As mentioned before, I'm using the PIC (16c65b) SEROUT and SERIN.

    The wireless device is a maxstream Xstream X24009 oem module.

    The interface listed in the data sheet says CMOS UART (as I mentioned before).

    I've tried everything.

    Inverting one side, both sides, putting the signals through a 4011 inverter....the scope shows
    data on the rcvr and xmtr but I don't have a dual trace so it's really hard to see how the streams are matching up.

    Oh well -- I went through this before, I may just give up and move on.

    I wish I would have used the PIC's hardware UART in the first place....too late now.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    I have a pair of XStream units I've been using for a few years that work great. Just use
    true mode and connect PIC I/O-pins directly to them.

    It may be that you have them configured for another data-rate or something, but I would
    check with Digi or Maxstream to be sure they're working if having problems with them.

    Mine worked perfectly right out of the box.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    For what its worth, I use LINX RXM/TXM-XXX-LR serial modules with inverted 9600 8N1 with no problems at all. I use serin/serout2 commands and just played with my timing to be able to update both my reciever boards with string data. The serial modules work GREAT up to 3000' away and can go up to 10k baud. I would give them a shot if you are frustrated with the other modules you are using. The price for the pair ~ 25.00 so not too bad. You can also purchase the development board.

    Here is one line of code using 8N1 9600 inverted

    Code:
    SERIN2 PORTB.0,16468,[WAIT("TENSION"),DEC4 TN]'TEST 3
    good luck!
    Attached Images Attached Images   
    Padawan-78

Similar Threads

  1. PIC uart basics
    By Michael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th September 2008, 20:11
  2. Software RS232 and wireless modules
    By Michael in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th August 2008, 06:27
  3. Software Stack
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th December 2007, 11:04
  4. Replies: 3
    Last Post: - 26th November 2006, 22:47
  5. Infrared Communications over RS232 UART or with B0 interupt
    By modifyit in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th December 2005, 20:17

Members who have read this thread : 0

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

Posting Permissions

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