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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Since an 8-bii: output port can only display values between<br />

and 255, what happens when you try to output a value that is ()<br />

side of this range VVould you expect to see a "portion" of the val<br />

say the eight least-significant bits Try running the program Vi<br />

the value 256. What happens<br />

The Apple displays<br />

ILLEGAL QUANT ITY ERROR IN 20<br />

which indicates that the value was not within the proper range<br />

the function that was requested. The line number for the "err<br />

is provided in the error message. Negative numbers are also "caugh<br />

in this way.<br />

Step 6<br />

Restart the program and enter a value of 90. You should observe<br />

a display of 01011010 on the lamp monitors. Now try and enter a<br />

value of -24. When the error is detected, and the<br />

displayed, does the displayed value change<br />

No. Error conditions are detected prior to any attempted use of<br />

POKE function. How do you think the Apple will handle<br />

numbers Enter a decimal fraction, such as 6.01. What is<br />

The Apple will "strip off" the decimal portion of the number.<br />

may wish to experiment with some other numbers, too.<br />

£tep 7<br />

Can you write a short program that could be used to increment<br />

a value from 0 to 255, displaying each new value on the LEDs<br />

Write your program in the space below, and test it. What do you<br />

observe Can you make the program loop back on itself so that the<br />

incrementing counting is displayed again and again

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

Saved successfully!

Ooh no, something went wrong!