27.01.2015 Views

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

titus-larsen-titus-1981-apple-interfacing

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

49318<br />

WR<br />

TO SN7474 PIN 1<br />

Fig. 6-22. Simple flag-clearing circuit schematic.<br />

flop, be sure that you remove the wire that was used to connect·+<br />

volts to pin 1 on the SN7474 HiJ flop.<br />

The circuit shown in Fig. 6-22 will allow you to clear the flip-Ho<br />

with a POKE 49318 command.<br />

Modify your program so that line 65 is added:<br />

65 POKE 49318,0<br />

When this command is executed, the flag will be cleared. Since yo .<br />

may not know the state of the flag when you start the program, you<br />

might want to add a flag-clearing command at the start of the program,<br />

too. Now run the program. When the flag is detected, the Ha<br />

is immediately cleared. Then th count is incremented and dis<br />

played. .<br />

One of the benefits of using this type of flag, and using the assem<br />

bly-language subroutine to check the flag, is that you do not "staff<br />

the computer waiting for a flag, unless you want to. Thus, you ca<br />

write a program to check for a flag. If the flag is not present, th<br />

computer goes about some other task. If the flag is set, the device<br />

associated with it is serviced, and the computer then goes on.<br />

The BASIC interpreter in the Apple has a flag-checking command<br />

called WAIT. This command may be used to test for a flag, but if<br />

the flag is not found, the program continues to wai t for it, and it<br />

cannot do anything else. If a program "hangs up" waiting for a flag<br />

that never occurs, you must press the RESET key to re-establish<br />

control of the Apple. We refer you to Basic Programming Reference<br />

Manual for the Apple for more information about the WAIT com"<br />

mand. This command does not incorporate any flag-clearing commands.<br />

Purpose<br />

EXPERIMENT NO. 16<br />

A SIMPLE ANALOG-TO-DIGITAL CONVERTER<br />

In this experiment, you will interface an 8-bit analog-to-digital<br />

converter to the computer. Several different types of measurements<br />

will be made.<br />

Discussion<br />

There are many applications for analog-to-digital converters, or<br />

AID converters in computer systems. The A/D converters allow the<br />

154

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!