Pages: [1]   Go Down
Author Topic: How to change rs-232 port mode to half-duplex?  (Read 673 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi folks,

I use Arduino Mega and RS-232 shield for communicate to another RS-232 device.
Also I use SoftwareSerial library.
Another device use RS-232 port this half-duplex port mode.
Question in subj: How to change port mode to half-duplex at Arduino using SoftwareSerial library or another path?

Thanks
Regards
Taras
« Last Edit: September 03, 2014, 06:46:42 am by tlstadnik » Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 130
Posts: 8623
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are really RS-232 half duplex is not really an option as that implies that you can tri-state the drivers and very few RS-232 chips can do that.

So the first question is, are you really using RS-232 or just serial?

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, Rob

I use this shield http://www.seeedstudio.com/depot/RS232-Shield-p-1910.html
and SoftwareSerial library as

#include <SoftwareSerial.h>

SoftwareSerial srtSerial(2, 3); // RX, TX

byte dispenceCard[] = {0x02, 0x46, 0x43, 0x30, 0x03};

and finally srtSerial.write(dispenceCard,sizeof(dispenceCard));

srtSerial write HEX sequence in port but device not recognize command.

I skip other code to simplify

I think problem is setting RS-232 port and want change port setting at Arduino to half-duplex mode

Thanks
Regards
Taras
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6806
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is no way to "set up" the Arduino serial port as half duplex.  You'd have to implement half-duplex manually, using additional signals to indicate which direction was transmitting (or permitted to transmit.)   I think the softwareserial implementation is inherently limited to WORKING in half duplex (I don't think it can transmit and receive at the same time), but there would be a lot of work to do to get it to be "formal" about such an arrangement in the way that old-style half duplex devices actually implemented.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 130
Posts: 8623
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That shield uses a MAX232 transceiver, that chip is not able to disable the transmitter so no it is not possible to do half-duplex with that shield.

If you find an RS232 transceiver that can tri-state the driver (I can't think of one off hand, maybe the LTC2870/LTC2871) then as Westfw says you can implement half duplex yourself.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6806
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think you need to define exactly what you mean by "half duplex."  Graynomad and I are interpretting the phrase quite differently.  (He's assuming transmit and receive on the same pin/wire.  I'm assuming a device (like a modem) that needs additional signaling on MORE wires...)
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 130
Posts: 8623
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Good point.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Tasmania - Australia
Offline Offline
Sr. Member
****
Karma: 16
Posts: 322
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I interpret half duplex as communications in one direction only at any point in time, whether this is done on separate Tx and Rx wires or on the same wire pair.

As westfw pointed out, to have half duplex on a two wire system such as RS-232 you need to use some form of signalling to determine the direction of data. This can be done as part of a software protocol or by using additional signalling wires which are part of the RS-232 specification.

I think there are a few of use who remember years of old where we used half duplex radio modems, maybe even some of you remember using X25 on TNC's as part of our packet radio systems, all half duplex with and with a RS-232 connector on the modem to our old computers.
____
Paul
« Last Edit: September 06, 2014, 08:58:31 pm by rockwallaby » Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi folks,
I not resolved my problem now but problem not in duplex setting.
May be problem is parity setting or other setting on port.
I will try and will posting about results

Thanks all
Taras
Logged

Tasmania - Australia
Offline Offline
Sr. Member
****
Karma: 16
Posts: 322
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

tlstadnik wrote
Quote
Another device use RS-232 port this half-duplex port mode
Have you thought that all you should need do is code up your comms routine so that you don't send anything until you get a finished response back for the device.

Doing this will give you half duplex.
Remember you have control when you send data out the serial port.

I am assuming the device you are communicating to can only do half duplex, is this correct?
Also, I am assuming the device you are communicating with will only respond on Arduino commands and not at any random time, is this correct?

You need to be very clear and specific with your descriptions on how your equipment works and how you wish it to work, or everyone makes lots of assumptions.
____
Paul
Logged


Pages: [1]   Go Up
Jump to: