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.

entered and run, It first asks you for the period of each LED, in<br />

onds, and then runs the program.<br />

A = PEEK(49319)<br />

INPUT "RED LED PERIOD ";Q<br />

INPUT " GREEN LED PERIOD "; R<br />

PRINT "TOTAL CYCLE PERIOD<br />

POKE 49318,0<br />

FORS = l TO Q<br />

FOR T = 0 TO 780: NEXT T<br />

NEXT S<br />

A = PEEK(49319)<br />

FOR S = l TO R<br />

FOR T = 0 TO 780: NEXT T<br />

NEXT S<br />

GOTO 50<br />

"; Q+R; " SECONDS"<br />

hen the program is run, the time delays may be somewhat lengthed.<br />

Why<br />

e additional software steps (FOR S = 1 TO Q, FOR S = 1 TO R<br />

d NEXT S ) , add time to the overall execution time of the proam,<br />

although you will not see appreciable lengthening of the proam.<br />

What does this program show you<br />

illustrates many principles; the use of simple programs and simple<br />

cuits to control external devices. It also illustrates the power of<br />

SIC to control external devices through relatively simple software<br />

ps. Remember, though, that BASIC is relatively slow.<br />

ven though PEEK and POKE commands were used, the success<br />

the Hip-flop interface did not depend on the actual transfer of any<br />

or information. The flip-Hop was controlled, or switched,<br />

ugh the use of device select pulses, alone. This principle is often<br />

d when a control signal or control pulse is required, but no data<br />

transferred.<br />

lease remember that when a POKE command is used in the<br />

SIC interpreter in the APPLE computer, a read and a write operaare<br />

performed. Thus, if you choose to use a POKE command to<br />

erate a device select pulse for control purposes, you must rememr<br />

that the APPLE will a"lso perform a read from the same address.<br />

99

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

Saved successfully!

Ooh no, something went wrong!