Shop OBEX P1 Docs P2 Docs Learn Events
Successful RS422 between Stamps — Parallax Forums

Successful RS422 between Stamps

RichardFRichardF Posts: 168
edited 2008-04-26 18:12 in General Discussion
Thanks to all the help from this forum, I have successfully established reliable serial coms between two BS2's over a distance of 100 feet using 6 conductor, non-twisted pair, non-shielded wire (least bulk and drag for my submersible ROV project with the master on the boat and the slave submerged).

Here is the skeleton code:
MASTER BS2:
DO
· get needed stuff to send to slave
· HIGH TX······················ 'tell slave ready to send
· DO: LOOP UNTIL RX = 1· 'slave is ready to receive
· PAUSE 10
· SEROUT TX, 84, [noparse]/noparse][i]stuff byte variables[/i
· SERIN RX,84, [noparse]/noparse][i]data from slave[/i
· LOW TX······················· 'all done
· go do things with data from slave
· LOOP

SLAVE BS2:
get data to send to master
DO
· IF RX = 1 THEN·············· 'master wants to talk
··· HIGH TX······················'tell master eady to talk
··· SERIN RX,84, [noparse]/noparse][i]get stuff byte variables[/i
··· SEROUT TX,84, [noparse]/noparse][i]data for master[/i
··· LOW TX······················ 'done sending data
··· ENDIF
· do things with stuff from master
· get more data for master
· LOOP

The two BS2's are connected with a LTC490 differential driver and receiver pair configured as a RS422 transceiver. The only glitch in this sytstem is that the LTC490's output a HIGH when sitting idle, so the slave BS2 has to be started up first or else the master has to be reset after both are powered up. Not a problem just an inconvenience (I am sure theres is a workaround for this).

Thanks again for all the help,
Richard

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-04-26 18:12
    Yes, 100 feet at reasonable baud rates is not much of a challenge for RS422 drivers.

    I had a 100foot coil of 4 wire telephone extension wire [noparse][[/noparse]not twisted pair, not shielded] connected to two BasicStamps that were exchanging data via CANbus. This went on for months without a glitch. The CANbus actually counts the number of errors and requests a retransmit. So that is how I knew. the counters stayed at zero.

    In sum, there is really no reason to bother with twisted pair until you have a real problem due to the combination of distances and transmission speed. And if you do need twisted pairs with shielding, it is likely to be cheaper to buy internet cable with 4 twisted pairs than to buy less pairs. Everyone carries it so the prices are more competative.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PLEASE CONSIDER the following:

    Do you want a quickly operational black box solution or the knowledge included therein?······
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
Sign In or Register to comment.