CHAPTER 2 PCL - 88
See the following example for programming examples using gray scales.
Gray scale example
10 ESC$ = CHR$(27)
20 WIDTH "LPT1:", 255
30 REM --- DRAW A PATTERN USING 64 GRAY SCALES ---
40 X = 50: Y = 100: XL=50 :YL=200
50 FOR GRAY = 0 TO 100 STEP 2
60 GOSUB 220
70 X=GRAY*10+50 :XL=X-XL
80 GOSUB 260
90 XL=X
100 NEXT GRAY
110 REM --- DRAW A PATTERN USING 8 GRAY SCALES ---
120 Y=400
130 FOR GRAY = 0 TO 100 STEP 2
140 GOSUB 220
150 X=GRAY*10+50 :XL=X-XL
160 GOSUB 320
170 XL=X
180 NEXT GRAY
190 REM --- PAPER EJECT ---
200 LPRINT CHR$(12)
210 END
220 REM --- SET THE CURSOR POSITION ---
230 LPRINT ESC$; "*p"; X; "X";
240 LPRINT ESC$; "*p"; Y; "Y";
250 RETURN
260 REM --- PRINT 64-GRAY SCALE PATTERN ---
270 LPRINT ESC$; "*c"; XL; "A";
280 LPRINT ESC$; "*c"; YL; "B";
290 LPRINT ESC$; "*c"; GRAY; "G";
300 LPRINT ESC$; "*c130P";
310 RETURN
320 REM --- PRINT 8-GRAY SCALE PATTERN ---
330 LPRINT ESC$; "*c"; XL; "A";
340 LPRINT ESC$; "*c"; YL; "B";
350 LPRINT ESC$; "*c"; GRAY; "G";
360 LPRINT ESC$; "*c2P";
370 RETURN
<Sample file 7>