You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
tion. Write a program that will perform the conversion to volta<br />
You may add the steps to the program already in use.<br />
We used the following steps which simply perform a mathemat·<br />
conversion of the decimal value 0 to 255 to a corresponding volt<br />
0 to +5 volts.<br />
10 POKE 49319,0<br />
20 FOR T = 0 TO 100: NEXT T<br />
30 PRINT (PEEK(49319)*5/255)<br />
40 GOTO 10<br />
Try our program, or your own. Does it work<br />
It should. You will see that the computer prints many decimal digi<br />
probably too many, since the converter is only accurate to a ma<br />
mum of one part in 256, or about 0.25%. Unfortunately, roundi<br />
is not a trivial task in the Apple. You can perform either a math<br />
matical rounding, or you can use a string operation to print only<br />
selected number of digits after the decimal point. You can use t<br />
following if you wish:<br />
30 A$ = STR$(PEEK(49319)*5/255)<br />
40 PRINT LEFT$ (A$,4)<br />
50 GOTO 10<br />
Remember that this routine simply limits the displayed value to fou<br />
decimal digits. It does not perform any rounding.<br />
Step 7<br />
Try to write a routine that will use the high-resolution graphic<br />
capability of the Apple computer, so that the program will plot th<br />
voltage values with respect to time. The measurements should b<br />
taken at a regular time (time-delay program) , and a continuou<br />
line-plot should be drawn. If you are not familiar with the high<br />
resolution graphics formats and commands, use the program provided<br />
below:<br />
100 HRG: HCOLOR = 3: Yl = O<br />
110 FOR X = 0 TO 249<br />
120 POKE 49319,0<br />
158