Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
Tools
Old 22nd June 2009, 05:49 PM   #1
Default 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 Thumbnails
RS232 master/slave unit-rs232-coupler.jpg  
Top Cap is offline  
Old 22nd June 2009, 07:27 PM   #2
Default

So basically, you want to re-create the 6 channel multiplex/demultiplxer in the green box???
__________________
You don't need a quadraphonic Blaupunkt -- you need a curve
ball.
BrownOut is offline  
Old 22nd June 2009, 07:29 PM   #3
Default

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)
3v0 is offline  
Old 22nd June 2009, 08:13 PM   #4
Default

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.
Top Cap is offline  
Old 22nd June 2009, 08:16 PM   #5
Default

Do you intend to create your own switching protocal? If so, what is it?
__________________
You don't need a quadraphonic Blaupunkt -- you need a curve
ball.
BrownOut is offline  
Old 22nd June 2009, 08:29 PM   #6
Default

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
Top Cap is offline  
Old 22nd June 2009, 08:35 PM   #7
Default

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.
__________________
You don't need a quadraphonic Blaupunkt -- you need a curve
ball.
BrownOut is offline  
Old 22nd June 2009, 08:52 PM   #8
Default

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 Thumbnails
RS232 master/slave unit-data-output.jpg  

Last edited by Top Cap; 22nd June 2009 at 08:55 PM.
Top Cap is offline  
Old 22nd June 2009, 09:07 PM   #9
Default

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.
__________________
You don't need a quadraphonic Blaupunkt -- you need a curve
ball.
BrownOut is offline  
Old 22nd June 2009, 09:42 PM   #10
Default

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
Top Cap is offline  
Old 22nd June 2009, 09:48 PM   #11
Default

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
__________________
You don't need a quadraphonic Blaupunkt -- you need a curve
ball.
BrownOut is offline  
Old 23rd June 2009, 04:03 PM   #12
Default

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 Thumbnails
RS232 master/slave unit-rs232clock.jpg  
__________________
You don't need a quadraphonic Blaupunkt -- you need a curve
ball.
BrownOut is offline  
Old 23rd June 2009, 04:14 PM   #13
Default

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!
SPDCHK is offline  
Old 4th July 2009, 10:56 AM   #14
Default

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
Nigel Goodwin is offline  
Old 4th July 2009, 04:31 PM   #15
Default

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.
__________________
You don't need a quadraphonic Blaupunkt -- you need a curve
ball.
BrownOut is offline  
Reply

Tags
master or slave, rs232, unit

Thread Tools
Display Modes


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



All times are GMT. The time now is 10:07 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker