rs485 to rs232 smart switch


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Location
    plano, texas usa
    Posts
    8

    Default rs485 to rs232 smart switch

    I have an application were I need addressable switch to power on a rs232 device and switch on communications to this device. Ther will be 16 devices on this network. My concern is after PIC determines its addressed (valid command on) I need to make communications transparent through PIC ie bi directional from one
    comm port to the other. I am concerned with loosing data and timing etc. I could buffer input / output data but data strings are not more than 256 or so at a time. Any thoghts or comments would be appreciated.

    Thanks in advance

    Scott

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


    Did you find this post helpful? Yes | No

    Default

    If you don't want to lose data then here's the options...

    1. Have a handshake protocol, (either embedded in software such as XON/XOFF) or in Hardware (such as RTS/CTS) etc. They were invented so that your tetraplegic Cray Supercomputer would not lose data being sent to it from your Golfball teletypewriter. Most folks don't bother with these any more (or have forgotten what they were invented for)... and then when they lose data or discover it's corrupt they cry into their coffee posting messages that it's all diluted and undrinkable.

    2. Ensure the data being received is at a SLOWER speed than the data being transmitted. This has a neat side-effect of saving on having to buffer in the middle.

    3. Ensure that the speed of your PIC is adequate to handle the dataprocessing involved. This usually means you can't run your PIC on a 32kHz watch crystal.

    4. Ensure you have a sufficient data buffer in the middle to handle unexpected situations. Some folks have tried to do this with a 12C509 and wonder why they can't define a 512Mb RAM buffer (probably because they're using an old version of PBP).

    You may need to implement some, any or all of the above.

    Melanie

  3. #3
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    2. Ensure the data being received is at a SLOWER speed than the data being transmitted. This has a neat side-effect of saving on having to buffer in the middle.

    Hi Mel,

    This sounds confusing, are you referring to a slower baud rate for the receiver?

    Squib.

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


    Did you find this post helpful? Yes | No

    Default

    Exactly. If the receive data is slower than the transmit data, the net result is you're disposing of your data faster than you're receiving it. It also means you have a little processing breather in the middle before the next byte is incomming. If it was the other way around, you start having to buffer your data because it is accumulating faster than it can be disposed of. You are then limited to your buffer size. Now there's nothing wrong with this as long as you know your limitations... if on the other hand your PIC is receiving a 700Mb episode of Enterprise at 600kb and spitting it out at 56kb to a PC, you just might have a teeny buffering problem in the middle...

Similar Threads

  1. RS232 to RS485
    By The Master in forum Off Topic
    Replies: 22
    Last Post: - 16th October 2008, 15:37
  2. UART vs software RS232
    By Michael in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 5th September 2008, 18:27
  3. Replies: 14
    Last Post: - 26th September 2007, 05:41
  4. Newbie - 16F628A and switch latching
    By malc-c in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 19th May 2006, 02:35
  5. RS232 switch, and thank you Mister E
    By Demon in forum Off Topic
    Replies: 2
    Last Post: - 3rd March 2005, 01:06

Members who have read this thread : 1

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