Page 243 - Embedded Microprocessor Systems Real World Design
P. 243

Communication  Pf'otoCOl  Communication  between  processors can  be  imple-
                   mented with a proprietary mechanism such as those described earlier, or a stan-
                   dard protocol can be used. A typical example of a standard protocol is MODBUS.
                   MODBUS  is  a  hardware-independent  protocol  that  is  used  to  communicate
                   between a master CPU and numerous slaves. A MODBUS data package sent from
                   master  to  slave includes  the  slave address  (0 to  247),  a function  code, data  (if
                   needed), and a checksum. The slave responds with a similar data packet to acknowl-
                   edge the transmission. MODBUS data can be transmitted as binary data, in which
                   case each transmitted data byte takes one byte to send, or as ASCII data, in which
                   case each transmitted data byte is sent as two ASCII bytes.
                      Since MODBUS is interface independent, you can use it to communicate over
                   RS232 or RS485  serial links, opencollector interfaces, or parallel port interfaces.
                   Using a  standard  interface  protocol,  even  on a proprietary  hardware  interface,
                   provides some advantages. These include easier upgrades  in  the future and less
                   confusion during development of the software on the various processors.
                      For more complex systems, an Ethernet interface using TCP/IP  or UDP (User
                   Datagram Protocol) can be used. This obviously requires a considerable step up in
                   complexity of both the software and hardware, so it is not well suited to a system
                   that must communicate with small microcontrollers.

                   Selection Criteria

                   When selecting a communication bus and protocol for a multiprocessor system, the
                   following factors should be considered:

                     Speed. Will the bus be able to keep up with your data rate? Be sure to take into
                     account polling in a master/slave architecture (see below).
                     Reliability. Do you  need  two  redundant  buses for high-reliability applications?
                     What about error checking? Can you assume that all commands are received cor-
                     rectly, or do you need a checksum on each block of data to prevent problems?
                     Does the hardware need protection against the possibility that the field engineer
                     will plug the interface cable into the wrong connector?
                     Standard/Proprietary. A standard bus, such as Ethernet, lets you buy off-the-shelf
                     cabling and use off-the-shelf boards and software, but it may be overly complex
                     for a simple system. In some products, the ability to plug a standard device in is
                     an advantage. In others, you want to keep your proprietary system proprietary.
                     OS Support. If  you  are using  an  off-the-shelf operating  system, including an
                     RTOS,  does  it  support  the  communication  method  and  hardware  you  have
                     chosen? If not, you will have to write device drivers for it.
                     Bidirectional/Unidirectional. Sometimes a simple unidirectional  interface is all
                     you need. Will you have problems if  the requirements change or if system inte-
                     gration reveals the need for an interface in the opposite direction? You must be
                     sure no reverse path will be needed before choosing a unidirectional interface.


                   224                                             Embedded Microprocessor Systems
   238   239   240   241   242   243   244   245   246   247   248