RS232 to RS485


Closed Thread
Results 1 to 23 of 23

Thread: RS232 to RS485

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Hi, Ive been testing this RS485 stuff out tonite. I had bypassed it before to get everything else working. Now ive tried to get the RS485 bit working and ive found a little problem. The first 1 or 2 bytes seem to get missing from the data. I think its because the 555 doesnt react quick enough to the data. Im using 115200 baud. Is there anything i can do about this problem?

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Attached Images Attached Images  

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    So what your saying is scrap the 555 idea and go back to using RTS. I guess that is an option. Ill have to look into how that will affect the software. I know i can easily control RTS in VB using the comm control but i do like to use API for speed. Ive not had the need to use handshaking before so i should probs read up on that.

    Thanx for the suggestion and the diagram. Now i see the point in the MAX232 having 2 ins and outs

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    Why not sending some control characters then wait for the start character, dump it and get the next.

    Like this:

    Send "#######$data"

    on PIC side:

    Hserin [wait("$"),str mydata\data_bytes]

    Ioannis

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I suppose thats a possibility. Im using the hardware UART so its a little harder but still possible.

    Is there anything faster than a 555? What about bypassing it? I noticed the output from the MAX232 chip seems to be inverted but if i could invert it again and connect it and the 555 through resistors to the MAX485 then it should be a lot faster because it doesnt rely on the 555 to turn it on, the 555 will simply keep it turned on for a short while after the data stops.

    I guess the only problem now is that the MAX485 chip might be too slow to react too

  6. #6
    Join Date
    Aug 2005
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    I have used the 485SD9TB converter from BB Electronics with no problems.It does exactly what you are trying to do.Its not cheap,but you can check out the schematic and maybe reproduce the circuit.
    Attached Images Attached Images

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ive tried the RTS method. It takes quite a while to turn on using software. Im only talking a few ms but its still enough to cause problems.

    I think a circuit based on that scematic would be best. I dont have any logic gates that i can make a NOT gate out of so i cant test it yet.

    I will have a go at the control characters method. That one seems like it should definately work aslong as i can program it properly. At the moment it relies on counting the bytes that arrive. With the control characters 1 or more will be missing.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    The first 1 or 2 bytes seem to get missing from the data. I think its because the 555 doesnt react quick enough to the data. Im using 115200 baud. Is there anything i can do about this problem?
    I doubt very much whether it's the 555. That method is widely and successfully used for automatic control of line direction. The fact that subsequent bytes are OK would also seem to indicate it's not the 555. Are you using termination resistors? They are absolutely necessary at 115200.

  9. #9
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I am using a termination resistor at the end with the 555 aswell as 2 biasing resistors exactly as shown in the diagram in your first post. I have the RS232 to RS485 converter plus 2 lights on breadboards at the moment. The MAX485 chips are less than 5cm apart but i can add another terminating resistor at the end just to be sure.

    Ive been thinking about this one and i think i got it the wrong way round. The thing that got me thinking is that the offset is constant even if i stop sending data then start again. You would expect it to keep shifting one or 2 bytes further out everytime the 555 gets chance to turn back off. I looked at how the circuits reacted to the data and it seems they are actually getting an extra byte or 2. I think that may be to do with the way ive programmed it but now im looking in the right place i have a better chance of solving the problem.

    I do like the idea of using a 555 because it allows me to have a status light that doesnt flash too quick to see and doesnt need any other components

  10. #10
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    It turns out it was a programming problem. As the chips start up the first one sends out a byte to tell the others how many chanels it has then goes into receive mode. The second one then does the same thing but the byte it sends out gets counted as data by the first light. Im really not sure why it was sometimes 2 extra bytes but ive reprogrammed it and it seems to be working perfect now. Sorry for wasting your time

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


    Did you find this post helpful? Yes | No

    Default

    You're now an expert who can help the next RS485 noob.

  12. #12
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Haha, I wouldnt say 'expert'. Remember im the one who just got it wrong. I havnt tested with long wires yet so no doubt ill have more problems

  13. #13
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Haha, I wouldnt say 'expert'. Remember im the one who just got it wrong. I havnt tested with long wires yet so no doubt ill have more problems
    If you're using drivers designed for '485 and you design the circuit within the '485 specs, why would you have problems with long wires? Shouldn't... Could happen...but shouldn't...

Similar Threads

  1. UART vs software RS232
    By Michael in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 5th September 2008, 19:27
  2. RS232 into 2 PC ports
    By manxman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th August 2008, 14:33
  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, 21:39
  4. Using 16f676 with comms
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th October 2005, 21:01
  5. rs485 to rs232 smart switch
    By RSSHARPE in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th June 2004, 09:44

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