Như có thể thấy trong hình 12-7, đặt hình ảnh ở giữa của bảng tính có thể chứng minh khó chịu trongTôi quyết định rằng thủ tục này chỉ được chạy từ một nút lệnh cụ thể người sử dụng như là phát hiện của một sự thay đổi do người sử dụng có thể khá phức tạp. | Example 15 Vernier Caliper Interface After that lengthy prelude we are ready to begin. The data from the caliper will be read on bit 4 of the Status register and the clock will be on bit 5. Power to the pull up resistors of the interface will be derived from bit 0 of the data register. The Request signal is derived from bit 1 of the data register inverted by a transistor see Figure 15-3 . The Data pushbutton signal is read in the status register bit 7. The principle of operation is as follows 1. Wait for Data pushbutton to go active. 2. Activate Request signal. 3. In groups of 4 bits wait for the clock bit to go active read in bit and wait for clock to go inactive combining the 4 bits to generate a digit. 4. Repeat for the remaining twelve digits. 5. Deactivate Request. 6. Create number from the readings and place in worksheet. 7. Wait for the Data pushbutton to go inactive. Acquiring Data It seems to me that a natural mode of operation in measuring a series of readings for statistical analysis would consist of starting the sequence with a Start button on the Excel interface acquiring caliper data every time the Data button is pressed and clicking on a Stop button on the Excel interface to terminate the acquisition and allow data analysis. 287 Excel by Example Let s deal with the Stop function first. We will use a single global variable that is set when the stop button is clicked and cleared when acquisition starts. The procedure that will be called when the Stop button is clicked is Sub StopRequest bStopRequest True End Sub and this will be placed in Module1 which should still be active from the earler execution time tests. When the workbook is first opened we would like the pull-up resistors in the interface powered and the Request line to the caliper disabled so in the Worksheet Activate event we call a call to the procedure SetupPort which is also in module 1. Sub SetupPort Call PortOut 888 1 ensure power is applied to pull up resistors and the request line is