Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 12


stop transmitting, and try again after a delay. This protocol is useful when any
node needs to be able to transmit whenever it wants and when the overall net-
work traffic is light enough that delays due to collisions are infrequent. Ethernet
and I^2 C use collision-detecting protocols.
To use the protocol, the nodes must be capable of detecting collisions, and the
drivers must be able to survive multiple drivers enabled at the same time, if only
briefly.
One way to detect a collision is for each transmitting node to attempt to read
back what it sends. If the data read matches the data written, the node assumes
there was no collision and the transmission succeeded. If the data read doesn’t
match the data written, the node assumes that another node is trying to trans-
mit and tries again later. Different nodes should use different delay times, either
by assigning each a different, fixed delay or by using random values. Otherwise,
the nodes will all retry at the same time and no one will ever get through. The
receiving nodes must also recognize and ignore failed attempts at transmitting.
Collision-detecting protocols typically aren’t practical for RS-485 networks.
With the UARTs used for most RS-485 interfaces, the nodes aren’t able to
examine each bit as it arrives, so bit-by-bit collision detecting isn’t possible.
If two or more drivers are enabled, RS-485 chips have protection circuits that
limit the current and eventually disable the outputs, but the currents can be as
high as 250 mA before the output is disabled. These safety features are useful
for protecting the circuits during occasional malfunctions, but a protocol that
routinely causes these high currents wastes power and can stress the circuits.
In contrast, open-collector and open-drain logic used in I^2 C synchronous com-
munications can have multiple drivers enabled without drawing large currents,
and the software is often capable of bit-by-bit monitoring.

. 
0  
  


One way to get network programming up and running is to use an existing pro-
tocol. Various organizations and companies have developed protocols used in
serial communications.
A fieldbus is a digital communications link developed for monitoring and con-
trol systems. These are some examples of standard fieldbuses used in RS-485
networks:


  • BACnet (Building Automation Control network). For building automation
    and other monitoring and control applications. From the American Society

Free download pdf