RS485 half Duplex Communication

D

Thread Starter

Dhillon

<p>Hi Everybody,

<p>I am writing a Modbus Client program using TCL/TK 8.4 I am having problems configuring the ports for half duplex communications.

<p>I open the (half duplex) port as
set comHandler [open //./COM$port r+]
and use filevent for reading the port whenever it becomes readable.<br>
fileevent $comHandler [list read $comHandler]

<p>I use vwait to enter eventloop processing
<pre>
while {1} {
vwait seqNumber
if {$seqNumber>$serialTest::FRAME_COUNT} {
break
}
}
</pre>
<p>But when I run my script I get error Error reading %comHandler Could anybody suggest how can I control my RS485 half Duplex communication Is there any need to look for Handshaking signals.

<p>Thank you very much in advance!!

<p>Dhillon
 
RS-485 does not support handshaking and you don't need it anyhow. Full/Half duplex has nothing to do with handshaking unless you are in a multi-drop (usually modem) environment.

The only thing necessary for half-duplex operation is well-behaved software. This is easy with modbus since it is a polling protocol, and by definition is half-duplex.

Just open your comm port for read/write at the correct bit rate, parity, char length etc.

send your poll,
wait for the response
send another poll
wait for another response
...

close the port when you're done.
 
R

Russell Bull

The main issue with RS485 is how to 'turn around' the interface from send to receive and vice versa.

Some RS485 interfaces use the RTS signal but the timing is critical and normally this is not too succesful.

Advantech have some modules that take care of this in the hardware, all your code has to do is send data and the hardware sends, when finished it reverts to receive. The ADAM4520 (I think!!) converts from RS232 to 485/422, the ADAM4561 goes from USB to 485/422.
 
can u help me how to develop a communication between modbus device and pc (RS-485 Communication) using MSComm? I need to communicate a Honeywell PID Controller. It is very helpful to me if u can give me a sample program so that I can try with my controller.

kindly do the need for me.
thank u
 
Top