+ Reply to Thread
Page 1 of 2
1 2 Last
Results 1 to 15 of 18

Thread: RS232 master/slave unit

  1. #1
    Top Cap Newbie
    Join Date
    Nov 2006
    Location
    Watford, England
    Posts
    39

    RS232 master/slave unit

    Hi Folks, with reference to the attached, I have to make a unit that can allow 6 master units to control 6 slave units via one RS232 link. Only simple on/off commands are required so that if the Master is turned on then its corresponding slave is switched on. If the Master is turned off then so is its slave. Master turned on is signified by a low voltage supply fed to an opto isolator. The slave is controlled by a simple relay contact, open = Off.
    I have to design something to fill the Green boxes, the Red box is the gear I have to interface to and is a 6 way RS232 multiplexer talking to a de-multiplexer some distance away via fibre optic cables.
    I only have one of these multiplexed channels to use, the others are used for data linking.
    I have ruled out PICs as I have no programmer and willing to craft the Green box electronics with off the shelf chips. Something tells me there may be an easier way without UARTS. One of the headaches is making sure that the right Master talks to its own slave and no other, also the status of the Masters must be accurately mirrored at all times by the Slaves. Anybody have any ideas? Perhaps someone on the Forum has had a similar problem to solve?
    Best Regards
    Les
    Attached Images


  2. #2
    BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent
    Join Date
    Jun 2009
    Location
    Huntsville, Alabama USA
    Posts
    1,942

    So basically, you want to re-create the 6 channel multiplex/demultiplxer in the green box???
    Lions and tigers and bears, OH MY!

  3. #3
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,399
    Blog Entries
    11

    Why not use RS485.
    Please post questions to the forums. PM's are for personal communication.

    BCHS/3v0's Tutorials
    Junebug USB PIC programmer kit., USB Bit Whacker,
    The 15 Minute Printed Circuit Board! (+drill time)

  4. #4
    Top Cap Newbie
    Join Date
    Nov 2006
    Location
    Watford, England
    Posts
    39

    Yep, take eight on/off feeds, convert the parallel data to a serial stream by way of a UART and send out as RS232 to allow interfacing with the proprietary RS232 optic equipment shown within the Red box. Then do the reverse to allow each of the eight fore mentioned inputs to control their respective Slave units.
    The fibre optic link boxes are RS232 input/output and already in use so I have to use the same standard.
    Serial Comms is not really my subject, I assume it is OK to have the UART continually sending so that any real time changes are picked up.

  5. #5
    BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent
    Join Date
    Jun 2009
    Location
    Huntsville, Alabama USA
    Posts
    1,942

    Do you intend to create your own switching protocal? If so, what is it?
    Lions and tigers and bears, OH MY!

  6. #6
    Top Cap Newbie
    Join Date
    Nov 2006
    Location
    Watford, England
    Posts
    39

    I was hoping that it would be possible to use one bit per Master control, producing a Mark or Space as necessary and for this to be reproduced at the receiving UART, all done asynchronously without handshake.
    If this is a mad idea and cannot possibly work then I shall have to think of another method. Hence the post, I suppose I am looking for some kind of assurance in case I go down the wrong path.
    Regards
    Les

  7. #7
    BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent
    Join Date
    Jun 2009
    Location
    Huntsville, Alabama USA
    Posts
    1,942

    I'm sorry if I'm not getting it. To switch 6 circuits, you'll need 3 bits minimum. The protocal can be something like this:

    Slave 1 - 000
    Slave 2 - 001
    Slave 3 - 010
    etc.

    Just switching to each slave using the first 3 bits of a packet would be pretty simple. You simple need to capture the first 3 bits of each packet and feed them into a de-multiplexer. The next bit can be the control bit, and then the receive can just ignor the rest. It can be done with simple digital chips, you just have to work out the logic.
    Lions and tigers and bears, OH MY!

  8. #8
    Top Cap Newbie
    Join Date
    Nov 2006
    Location
    Watford, England
    Posts
    39

    Hi BrownOut, does the attached drawing help?
    It would make decoding at the other end very easy

    Oh! Most Important, data comms is only one way i.e. Master to Slave.
    No reply path is required.
    Attached Images
    Last edited by Top Cap; 22nd June 2009 at 08:55 PM.

  9. #9
    BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent
    Join Date
    Jun 2009
    Location
    Huntsville, Alabama USA
    Posts
    1,942

    Then I think you just need a register to hold each of the slave bits, and connect slave to it's respective register. If you use a UART, just connect each slave to one of the 8 data i/o's. If your using something else, just do a serial to parallel conversion, and connect the slaves.
    Lions and tigers and bears, OH MY!

  10. #10
    Top Cap Newbie
    Join Date
    Nov 2006
    Location
    Watford, England
    Posts
    39

    Many thanks for your help and encouragement, I just have to sort out the nasty bits like ensuring the Slaves are all turned Off if data comm's is lost etc.
    It must be child's play to do all this but at 62, it is strange territory for me, I stopped with the Z80
    All the best
    Les

  11. #11
    BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent
    Join Date
    Jun 2009
    Location
    Huntsville, Alabama USA
    Posts
    1,942

    Don't feel bad. I've spent most of the last 20 years writing HDL code. I've forgotten most of what I used to know about real electronics
    Lions and tigers and bears, OH MY!

  12. #12
    BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent
    Join Date
    Jun 2009
    Location
    Huntsville, Alabama USA
    Posts
    1,942

    I was thinking about your project last night. I'm interested that you want to try to make something yourself instead of using a URAT. I've thought about that too, because I think you learn more by doing it yourself. Conceptually, it's a simple problem, you only need to sense the start pulse and then use a linear shift register to capture the serial data and do the serial to parallel conversion. The only trick seems to be to get the clock correct for capturing and shifting the data. But I think I have a solution.

    The idea is to start the clock when a start pulse is received, but the transition sould occure in the middle of each bit period. That allows the maximum tolerance for drift. In the attached diagram, two one-shots are connected back-to-back for clock generation. The first is triggered by the start pulse, and produces 1/2 the data period before firing the second one. 52uS was chosen for 1/2 the period for 9600BPS. The clock continues to be generated for the duration of the transaction. You'll have to somehow keep track of the bits received so you can disable the clock at the completion of the transaction. That should not be hard to do. Then, all you need is a shift register, and you're done!

    The connection to the first one-shot should be a pulse that is properly oriented to 'fire' it. If you're careful how you connect it, you could theoritically resychronize the clock at every data transmission, although you shouldn't need to.

    Good luck!
    Attached Images
    Lions and tigers and bears, OH MY!

  13. #13
    SPDCHK Good SPDCHK Good
    Join Date
    May 2006
    Location
    South Africa
    Posts
    293

    Top Cat,

    Do I understand your circuit correctly? You have a master transmitter that encodes 8 signals into a byte to be transmitted via a network to a (one) slave unit that will decode this byte into the respective 8 signals, each driving a load?

    It’s not a RS485 network scenario where you have one network master commanding 8 individual nodes scattered over the network?

    I’ve just completed the latter system. I wrote my own protocol to talk to max 8 (eight) slave nodes. The master in turns commands a node and waits for the feedback from that node, before commencing to the next node, always repeating for all 8 nodes.
    Don’t argue with idiots.......they will drag you down to their level and then beat you with experience!

  14. #14
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,372

    Sorry, but buy a programmer and use PIC's, it will be a LOT simpler, a LOT cheaper, and a LOT more functional - it's almost 2010, why use 1970's technology?.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  15. #15
    BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent BrownOut Excellent
    Join Date
    Jun 2009
    Location
    Huntsville, Alabama USA
    Posts
    1,942

    How can it be alot cheaper? 4000 series logic goes for about a dime a throw
    How can it be simpier? It's already about as simple as it can get.
    Lions and tigers and bears, OH MY!

+ Reply to Thread
Page 1 of 2
1 2 Last

Similar Threads

  1. Master and Slave LCD sim?
    By RobertS in forum Micro Controllers
    Replies: 5
    Latest: 6th January 2008, 03:09 AM
  2. UC3526 Master/Slave Mode
    By alisarhangpour in forum General Electronics Chat
    Replies: 0
    Latest: 16th July 2007, 02:23 PM
  3. I2C mssp help with master to slave comm
    By PicChristmas in forum Micro Controllers
    Replies: 1
    Latest: 16th July 2005, 06:32 AM
  4. Master and Slave
    By umer007 in forum Electronic Projects Design/Ideas/Reviews
    Replies: 1
    Latest: 30th March 2004, 03:39 AM
  5. DS1820 slave, 16F877 master, picbasic pro, any info?
    By jessey in forum Micro Controllers
    Replies: 5
    Latest: 25th September 2003, 08:21 AM

Tags for this Thread