Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
CHAPTER 4<br />
Flags and Decisions<br />
n almost all of the previous examples, we have assumed that there<br />
•ttle synchronization required between the computer and the exnal<br />
1/0 devices. Thus, output ports have been assumed to always<br />
ready for more data to be transferred to them. In the case of input<br />
ts, we have assumed that the data values are present and ready<br />
transfer to the computer, when the computer reaches a PEEK<br />
mand in a program. This may not always be the case. We must<br />
en deal with 1/0 devices that are slower than the computer.<br />
1/0 DEVICE SYNCHRONIZATION<br />
Since not all I/ 0 devices may be ready for the computer at all<br />
es, a means of synchronizing the computer and the 1/0 devices<br />
equired. The synchronization generally involves the use of signals<br />
t are called -flags. These signals are used to indicate that various<br />
·ces are busy or not busy, ready or not ready, converting or not<br />
verting, and so on. Thus, "flags" indicate the status of devices, and<br />
are often called status fiags.<br />
or illustrative purposes, we will assume that we are required to<br />
rface a device to an Apple computer. The device will provide<br />
it data values to the computer on an irregular basis. In most cases,<br />
h devices also generate a flag signal that indicates that the device<br />
ready to transfer its information to the computer. Such a device is<br />
wn' in Fig. 4-1. Note that a standard three-state input port has<br />
n used to transfer the information to the computer. The READY<br />
presents an interesting problem. How is the computer going to<br />
nitor or check the condition of the READY flag, so that it can<br />
termine when a new data value is ready<br />
57