Hserin/Hserout 2 Devices

sodeaf

Senior Member
Hey guys,

Working on a project using a 28x2. I need to communicate with two different devices using Hserin/Hserout. I am polling one machine receiving a response, then polling another device and receiving response. Is there a chip available that will allow you to switch between 2 RS232 devices? I am currently using max 232 drivers to communicate. I only need to talk to one at a time, I have spare outputs. I tried to google different topics without success.

Thanks

Steve
 

hippy

Ex-Staff (retired)
You can use logic gates, multiplexors and two-way switches to do it but you can direct output using just two resistors ...

Code:
.-----.        ___            .----.
|  TX |---.---|___|---.------>| |> |---> RS232 #1
|     |   |           |       `----'
|     |   |    ___    |       .----.
|     |   `---|___|---|---.-->| |> |---> RS223 #2
|     |               |   |   `----'
|  E1 |<>-------------'   |
|  E2 |<>-----------------'
`-----'
When E1 is set as an INPUT the TX output will go to RS232 #1, when set HIGH the TX output won't be passed on.

Similar for E2.

Input, if only one sends at a time, can be achieved by diode mixing the two inputs ...

Code:
          -.-
          .|.
          |_|
.-----.    |             .----.
|  RX |<---^---.---|>|---| <| |<--- RS232 #1
|     |        |         `----'
|     |        |         .----.
|     |        `---|>|---| <| |<--- RS223 #2
`-----'                  `----'
 

sodeaf

Senior Member
Very interesting, never thought of doing it that way. Was looking into see if I could just use a couple "OR" gates, hence you mentioned logic gates. Will dig into this a little more. Thanks for your input.. A good start..

Steve
 

inglewoodpete

Senior Member
On the transmit side, you could use hSerOut to one device and SerOut to the other. This would negate the need for the switching control. SerOut, of course, is bit-banged so will hold up the PICAXE's execution while the data is being transmitted. This method will work for you provided you do not need the PICAXE to carry on processing while the data is transmitted SerOut command.
 

sodeaf

Senior Member
Untitled1.jpg

I currently am using a 74HC125 to isolate the transmission signals to and from the printer already. There was 2 empty channels in which I can run the LCD module through. When the control input on the 74HC is High the outputs are 'Open" so essentially turned off and not putting a load on the serial line. By using one output from 28x2 I can control which device I need to talk to. Leave in Low state and I can communicate just with the printer, when I want to upload the LCD I can go High output on the control which will turn off the printer control and turn on the LCD through the transistor. Which I have an extra channel on the ULN2003 I am currently using on board. Other then a couple resistors I wont need and more parts.

This is in theory, I assume it will work fine, just looking for some of your opinions, and if you see any issues this may cause that I am not catching. I do appreciate it. Thanks again.. Steve
 
Top