RS232 comm


Closed Thread
Results 1 to 10 of 10

Thread: RS232 comm

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    At 48Mhz ... You have to use the 16-bit baud rate generator to get 2400 baud. It's too slow for the normal BRG.

    Try it like this

    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 225 ' 2400 Baud @ 48MHz, 0.0%
    SPBRGH = 4
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator

    Or for other baud rates, use mister-e's calculator (EUSART calc)...

    PicMultiCalc V_1.3.1
    http://www.picbasic.co.uk/forum/atta...achmentid=2957

    DT

  2. #2
    Join Date
    Sep 2009
    Location
    Columbus, Ohio
    Posts
    6

    Default

    I tried mister e (handy tool).

    I now send a "D" and receive a 0.

    Tried pumping it up to 9600 baud and many other things but it is always a 0 or doesn't work at all.

    If I go back and try serialcom.exe from PC to try & get something to work right, would I use a straight cable instead of a null modem cable ?

    Thanks Darrel

  3. #3
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333

    Default

    RS232 has two equipment types Data Terminal Equipment (DTE) and Data Connect Equipment (DCE). Your computer is a DTE and has a male connector as all DTE equipment has, that is if the RS232 standard has been followed. All equipment intended to connect to a computer RS232 port is DCE and has a female connector. In the early days null modems were intended to be used to connect two computers and therefore a null modem cable was female to female. This was before networks were invented. The problem now is that we have DCE to DCE equipment which requires a male to male connector, which are hard to find and easy to make. So if the two pieces of equipment have the same gender a null modem is required, RX and TX are crossed. If one is male and the other female then a straight serial cable is needed.

    Unless of course you have a piece of equipment that has not followed the RS232 convention and there are some trust me.

    Clear as mud?

    Steve

  4. #4
    Join Date
    Dec 2005
    Posts
    1,073

    Default

    It's not clear to me what you have at each end of the RS232 link. Are you trying to communicate from a PIC to a PC or to another embedded device?

    The hardware UART output is non-inverted while a PC expects it inverted and most embedded devices expect it non-inverted.

  5. #5
    Join Date
    Sep 2009
    Location
    Columbus, Ohio
    Posts
    6

    Default

    Problem solved.
    Went back to serialcom.exe and got PC talking to Labxusb and then to labx1 after making suggested chgs.

    Now labxusb and labx1 are talking fine.

    Thanks all!!!!!

    Darrel Now that that's working hopefully OSU will not get blown out by USC !!

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Great!
    Glad you got it working.

    I'm originally from Columbus, and now live in California.
    So I'm quite sure ... and my bet would be for ... Not OSU.

    DT

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Quote Originally Posted by Darrel Taylor
    So I'm quite sure ... and my bet would be for ... Not OSU.
    OUCH!
    And I gave up 10 points.

    USC-18    OSU-15

    %$#@!& College Football
    Definitely not a Blow Out.
    DT

Similar Threads

  1. Universal remote and Rs232
    By Michael in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th February 2010, 17:55
  2. UART vs software RS232
    By Michael in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 5th September 2008, 18:27
  3. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  4. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  5. Comm example: Pic to Pic
    By Chadhammer in forum Code Examples
    Replies: 4
    Last Post: - 14th November 2006, 23:26

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