ProSoft Technology MVI69-ADM User Manual

Page 57

Advertising
background image

MVI-ADM ♦ 'C' Programmable

Understanding the MVI-ADM API

'C' Programmable Application Development Module

Developer's Guide

ProSoft Technology, Inc.

Page 57 of 342

February 20, 2013

State 2000 contains a sub-state machine for handling the sending of the
response. State 2000:2 sets RTS on. The state now changes to 2000:3. The
driver now waits for the RTS timeout period to expire. When it does, it checks for
CTS to be asserted. If CTS detection is disabled or CTS is detected, RTS is set
to off (CTS enabled only) and the state advances to 2000:4. Otherwise it is an
error and RTS is set to off and returns to state -1. The response is now placed in
the transmit buffer. The state is advanced to 2000:5 where it waits for the
response to be sent. If the response times out, RTS is set to off and the state
returns to -1. If the response is sent before timeout, the state changes to 2000:6
where it waits for the RTS timer to expire. When the timer expires, RTS is set to
off and the state returns to -1 where it is ready for the next packet.

RS-485 Programming Note

Hardware
The serial port has two driver chips, one for RS-232 and one for RS-422/485.
The Request To Send (RTS) line is used for hardware handshaking in RS-232
and to control the transmitter in RS-422/485.

In RS-485, only one node can transmit at a time. All nodes should default to
listening (RTS off) unless transmitting. If a node has its RTS line asserted, then
all other communication is blocked. An analogy for this is a 2-way radio system
where only one person can speak at a time. If someone holds the talk button,
then they cannot hear others transmitting.

In order to have orderly communication, a node must make sure no other nodes
are transmitting before beginning a transmission. The node needing to transmit
will assert the RTS line then transmit the message. The RTS line must be de-
asserted as soon as the last character is transmitted. Turning RTS on late or off
early will cause the beginning or end of the message to be clipped resulting in a
communication error. In some applications it may be necessary to delay between
RTS transitions and the message. In this case RTS would be asserted, wait for
delay time, transmit message, wait for delay time, and de-assert RTS.

Advertising