HSEROUT/HSERIN with RS422/485 Driver


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2007
    Posts
    53

    Default HSEROUT/HSERIN with RS422/485 Driver

    Hello,

    I am trying to work out how to use HSEROUT/HSERIN on 16F88 combined with a 75176 diff. bus tcvr chip. I want to create bi-directional, half duplex communication over a single pair.

    I am stuck on how to drive the 75176 RE/DE pins to enable transmit and receive. I can join the RE and DE pins together and then connect them to an available I/O pin. Sending this pin high will put the 75176 into TX and sending it low for RX. Is there a flag I can poll to set/clear this pin based on the status of HSEROUT (i.e. high only while it is actually transmitting data). I have tried setting the pin before the HSEROUT statement and clearing it after but this doesn't work. Obviously the hardware serial is doing it's thing in the background whilst the next commands are being processed.

    At this point I have confused myself and need to ask for assistance!

    Regards,

    Andy

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


    Did you find this post helpful? Yes | No

    Default Re: HSEROUT/HSERIN with RS422/485 Driver

    The TRMT bit (TXSTA.1) reads 0 (TSR full) while the USART is still shifting out data.
    Wait for it to go to 1 (TSR empty) before switching back to receive mode.
    Code:
    TRMT   VAR TXSTA.1
    
    HIGH RE_DE
    HSEROUT ["Hello World!"]
    WHILE NOT TRMT : WEND
    LOW RE_DE
    Be sure to have "Fail-Safe" resistors that bias the network to "True Idle" levels.
    DT

  3. #3
    Join Date
    Apr 2007
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: HSEROUT/HSERIN with RS422/485 Driver

    Hi Darrel,

    Yet again another simple solution to a problem I have spent way too long on......... Thank you.

    I do have the bias resistors on the bus. I read one of your previous posts containing a link to a (Maxim?) datasheet, showing how schottky diodes can be used - very interesting. Now that I have a solution to my initial problem I will work on reducing the current consumption to an acceptable level.

    Regards,

    Andy

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


    Did you find this post helpful? Yes | No

    Default

    Right, I love that diode arrangement.

    It reduces the current dramatically since you don't need that 100Ω resistor.
    The "Fail-Safe resistors can be much higher values too, I used 2K on mine.

    And it allows a "Star" network where you can connect devices anywhere on the buss, instead of a long multi-drop network with a terminating resistor at the end.
    And the more devices you connect, the better the signal gets.

    Can't imagine why anyone would terminate RS485 any other way.
    DT

  5. #5
    Join Date
    Apr 2007
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: HSEROUT/HSERIN with RS422/485 Driver

    Hi Darrel,

    I must admit I have only quickly glanced over the article. One thing that puzzles me a bit is how the diode arrangement actually works to dampen the reflections on the buss.

    I have a bit of a background in RF and I always assumed the terminating resistor was selected to be approx the same impedance as the line. This is transmission line theory and, in this instance, the termination resistance equals the characteristic impedance of the transmission line, and therefore the line operates with low reflections or SWR (Standing Wave Ratio). I would like to understand more on how the diodes produce the same effect without the terminating resistor. However it works it sure seems to be better arrangement.

    Andy

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


    Did you find this post helpful? Yes | No

    Default Re: HSEROUT/HSERIN with RS422/485 Driver

    Well, here's a quote from the previously mentioned appnote... http://www.maxim-ic.com/appnotes.cfm/an_pk/1090

    Schottky-Diode Termination
    Schottky diodes offer an alternative termination when power dissipation is a concern. Unlike other
    termination types, Schottky diodes do not attempt to match the line impedance. Instead, they simply
    clamp the over- and undershoots caused by reflections
    .
    This image is an example of unclamped overshoots ...
    Ignore the yellow line.
    DT

  7. #7
    Join Date
    Apr 2007
    Posts
    53


    Did you find this post helpful? Yes | No

    Default Re: HSEROUT/HSERIN with RS422/485 Driver

    Ok - got it now. Just a different method of achieving a similar result.

    One has to wonder then why the terminating resistor is by far more popular? The diode arrangement seems more versatile and consumes less current......

    Andy

Similar Threads

  1. need help hserin/hserout cmucam4
    By siyete in forum Serial
    Replies: 3
    Last Post: - 17th December 2012, 22:49
  2. Rs485 Using Hserin/hserout
    By koossa in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 31st January 2008, 09:42
  3. Hserin/Hserout question
    By Philley in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th May 2007, 13:17
  4. HSERIN and HSEROUT commands
    By ryan in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 6th January 2007, 22:11
  5. Hserin/hserout ?
    By Scott in forum General
    Replies: 6
    Last Post: - 27th April 2005, 23:46

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