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

These  protocols  can  be  combined.  For  instance, every  command  might  be
                   acknowledged when received, but an execution acknowledge is sent only if there
                   is an error.
                      Any scheme that does not force the higher-level controller to wait for acknowl-
                   edge of  execution before sending additional commands must have a mechanism
                   to handle errors. If  an execution error occurs in command A, but commands B
                   and C have already been  sent, how does the higher-level controller know which
                   command did not execute? What if command C depends on command A execut-
                   ing correctly? For example, our robotic arm might be told to move to a certain
                   position (command A), insert a tool in a slot (command B), and turn it (command
                   C). If  the first command did not execute, then  the last one is pointless and may
                   even cause damage. So the protocol needs to speciQ what happens in case of an
                   error. If commands can be “pipelined” (a new command sent before the old one
                   is executed), you need to stipulate how many commands can be allowed to stack
                   up so that the buffers do not overflow.

                   Design Piifalls

                   Multiple Measurements  Be careful of having two processors measure one thing.
                   Because the  “thing,” whatever it is, will  be measured with a digital system, there
                   always is the possibility that the two processors will get different results. If they are
                   measuring time, there will be at least one clock ambiguity in the measurement. If
                   they are measuring a voltage, there always will be an ambiguity  of at least one count
                   in the two ADC output results. This can be a problem if there are fixed thresholds.
                   For example, if you are moving wooden blocks down a conveyer system and one
                   processor  determines  that  the  length  of  a block  is just  barely too long, be  sure
                   another  processor will  not  declare  it  to  be  OK  The  first processer  might  skip
                   sending the block to a planing process, while the second one proceeds with some
                   other  process  that  depends on a smooth surface. If  there  are  fixed  thresholds
                   for what you measure (too short, too long, too heavy, voltage too high, and so on)
                   be sure that the first processor that detects an error overrides the measurements
                   of  all  subsequent  processors.  Or  else  be  sure  that  a  conflict  does  not  cause
                   problems later.


                    Synchronization  Say you have a process controlled by multiple processors, like
                   the wooden block example just mentioned. One processor cuts the blocks to size,
                   the next one planes them smooth, the third one stamps a logo on the blocks, and
                   so on. Say that everything in the system is synchronized to a clock that occurs once
                   each time the conveyer system moves 0.1 inch. If data are passed between proces-
                   sors as each block moves between the regions controlled by each processor, there
                   is a risk of  a one-clock ambiguity in the timing. Be  sure these cannot add up as
                   the  blocks move  along.  Either  keep  the  time  increment small enough  that  the


                   226                                              Embedded Macroprocessor Systems
   240   241   242   243   244   245   246   247   248   249   250