non-inverting 2400 baud


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    May 2005
    Location
    Minnesota
    Posts
    31

    Default non-inverting 2400 baud

    I have a PIC to PC and PC to PIC circuit operating just fine. However, when the circuit is moved to different PC's, I have noticed the data coming from the PC is not always detected by the PIC. It appears the voltage level from the IO port on the PC is lower. I have placed a MAX3180 on the receiving side of the PIC to boost the voltage. And it does. The MAX3180 inverts the data. I have been using N2400 and 16780 as buad rate perimeters on both sides of the PIC, Xmit and receive, and things had been running quite well. I changed the receiving side of the PIC to 396 but haven't had any luck making the connection. Is there another value or trick to this? This is the first time I have had to use a line driver with a PIC.
    The basic PIC data circuit is layed out like the manual suggests, nothing else.
    Thanks in advance.

    Brad

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Try the same with DEBUG or HSEROUT instead of SEROUT/SEROUT2 and see how better/worst it is.

    Side note, RS-232 @2400 baud already gave me few weirdies on some PCs. Problem disappear for me by using an higher baudrate.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    May 2005
    Location
    Minnesota
    Posts
    31

    Default missing important information

    Sorry about that. I left out some important information. I am using a 16F628A, it does not have a USART so I am unable to use HSER function. Thanks for the suggestion though. I am also using the WAIT parameter. I am expecting to see a hex value between 31 and 39 but I am receiving fe. Not sure what fe is, but it is consistant.
    Again, thanks for any suggestions.

    b

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

    Default

    Quote Originally Posted by cooksydesign View Post
    Sorry about that. I left out some important information. I am using a 16F628A, it does not have a USART so I am unable to use HSER function.
    Don't know where you got those, BUT the 16F628A chips I use has USART pin7 RX, pin 8 TX.
    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.

  5. #5
    Join Date
    May 2005
    Location
    Minnesota
    Posts
    31

    Default wrong datasheet

    You are correct, I clicked on the wrong link when I was looking at dataseets yesterday. As I mentioned earlier, the circuit was working for quite awhile so I made a few boards. Now I see there are some problems with a few other PC's. Back to my original question, if 16780 works for 2400 baud in a SER2 command, what is the True seeting? I tried 396, then I get something other than what I expect. Looks like a baud rate setting. I can remove the MAX8130 and the circuit works fine, when the SER2 commands are returned to the proper settings. Thanks for pointing out the USART pins. Unfortunately, I have made boards and those pins are used.

    b

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

    Default Das Book

    Quote Originally Posted by cooksydesign View Post
    You are correct, I clicked on the wrong link when I was looking at dataseets yesterday. As I mentioned earlier, the circuit was working for quite awhile so I made a few boards. Now I see there are some problems with a few other PC's. Back to my original question, if 16780 works for 2400 baud in a SER2 command, what is the True seeting? I tried 396, then I get something other than what I expect. Looks like a baud rate setting. I can remove the MAX8130 and the circuit works fine, when the SER2 commands are returned to the proper settings. Thanks for pointing out the USART pins. Unfortunately, I have made boards and those pins are used.

    b
    In the back of the Book, Appendix A
    Code:
    B/R    OUTPUT  CONVERSION  PARITY      MODE 
    2400   DRIVEN  TRUE           NONE      396
    2400   DRIVEN  TRUE           EVEN     8588
    2400   DRIVEN  INVERTED       NONE    16780
    2400   DRIVEN  INVERTED       EVEN    24972
    2400   OPEN    TRUE           NONE    33164
    2400   OPEN    TRUE           EVEN    41356
    2400   OPEN    INVERTED       NONE    49548
    2400   OPEN    INVERTED       EVEN    57740
    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.

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    What I suggest is to set the TX pin to the normal idle State at the top of your program and add a pause of few mSec. True mode idle high, while inverted idle low.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    May 2005
    Location
    Minnesota
    Posts
    31

    Default Progress

    I changed the baud rate setting from 396 to T2400 and the correct data was sent out. What's the difference between 396 and T2400? I don't know. Something similar to this happened before and I ended up using N2400 when a line driver is not used. I didn't see a reference to T2400 in the book.

    Is there a way to clear the output buffer in the PIC 16F628a? The PIC sends a D0 first time, every time. Nowhere in the program do I load a D0. When I send the proper data twice, the receiving program discards the D0 and recognizes the correct data and accepts that. Strange.

    Thanks for all suggestions earlier.

    B

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    You need to set the idle level first at the top of your program, then send your data.

    For true mode, your serial output must be set high, for inverted, it's low.

    T2400, N2400 are for SEROUT, all other numbers 396,16780 are for SEROUT2
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    Join Date
    May 2005
    Location
    Minnesota
    Posts
    31

    Smile That did the trick

    Well, between the T2400, SerOut vs SerOut2, setting the line high for true data, the problem has been resolved. Before each transmission I put the data line in a high state. Works fine. Thanks again to all for answering.

    B

  11. #11
    Join Date
    Jul 2003
    Posts
    2,358

    Default

    Winding back to the start of this thread, if your INPUT voltage is too low for a PIC, and it has Comparators, configure it as an Amplifier... you can receive Serial at 9600 Baud at MILIVOLT levels and the Comparator will happilly reconstruct 0-5v (and Invert it or not at your choice) which can then be read by SERIN, DEBUGIN or by a USART. Who needs a MAX232 anyway. A Comparator will do it all for you.

  12. #12
    Join Date
    May 2005
    Location
    Minnesota
    Posts
    31

    Default Good to know

    Hey Mel,

    Thanks for the additional information. I think it's too late for this project though. I have already spun the boards. My in/outs are on B.4 and B.5 of the 16F628a.

    B

  13. #13
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323

    Default

    Quote Originally Posted by Melanie View Post
    Winding back to the start of this thread, if your INPUT voltage is too low for a PIC, and it has Comparators, configure it as an Amplifier... you can receive Serial at 9600 Baud at MILIVOLT levels and the Comparator will happilly reconstruct 0-5v (and Invert it or not at your choice) which can then be read by SERIN, DEBUGIN or by a USART. Who needs a MAX232 anyway. A Comparator will do it all for you.
    Heh. Now THAT's one of those things I'm gonna try and remember, because SOME day it's bound to come in handy for me!

    What a great idea!




    steve

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC 18f1220 EUSART Baud Rate Cache Problem
    By wklose99 in forum Off Topic
    Replies: 3
    Last Post: - 15th April 2008, 00:39
  3. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 02:17
  4. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41
  5. Baud Rate and Timing Calculator
    By picnaut in forum General
    Replies: 3
    Last Post: - 23rd January 2004, 16:48

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