9. Bar code and enlarged character
❏Element printing
[Example]
The following shows a BASIC program for printing Code 39 bar codes using the element printing function. This example shows how to print “CODE39”. (Replace NB, WB, NS and WS in the data statements in the following example with 0, 1, 2 and 3, respectively.)
100 OPEN "LPT1:" AS #1: WIDTH #1,255
110DC4$=CHR$ (&H14): ESC$=CHR$(&H1B)
120SI$=CHR$(&HF):SO$=CHR$(&HE): ICG=4
130'
140 PRINT #1, DC4$;DC4$;"@"; | ' Initialize |
150PRINT #1, DC4$;DC4$;"T";CHR$(255); ' Barcode Type: Element Print
160PRINT #1, DC4$;DC4$;"E";CHR$(0);CHR$(2); ' Narrow Bar: 2/120"
170PRINT #1, DC4$;DC4$;"E";CHR$(1);CHR$(6); ' Wide Bar: 6/120"
180PRINT #1, DC4$;DC4$;"E";CHR$(2);CHR$(2); ' Narrow Space: 2/120"
190PRINT #1, DC4$;DC4$;"E";CHR$(3);CHR$(6); ' Wide Space: 6/120"
200PRINT #1, DC4$;DC4$;"E";CHR$(4);CHR$(2); ' Inter Char Gap: 2/120"
210 | PRINT #1, DC4$;DC4$;"H";CHR$(6); | ' Barcode Height: 6/12" |
220 | ' |
|
230PRINT #1, DC4$;DC4$;"B";CHR$(9*8+7); ' Barcode Data Sequence Start
240RESTORE 440
250FOR I=1 TO 9:READ A:PRINT CHR$(A);:NEXT I
260PRINT #1, CHR$(ICG);
270FOR J=1 TO 6
280IF J=1 THEN RESTORE 450
290IF J=2 THEN RESTORE 460
300IF J=3 THEN RESTORE 470
310IF J=4 THEN RESTORE 480
320IF J=5 THEN RESTORE 490
330IF J=6 THEN RESTORE 500
340FOR I=1 TO 9:READ A: PRINT #1, CHR$(A);:NEXT I
350PRINT #1, CHR$(ICG);
360NEXT J
370RESTORE 440
380FOR I=1 TO 9:READ A: PRINT #1, CHR$(A);:NEXT I
400 PRINT #1,CHR$(13);CHR$(10); | ' CR+LF | ||
410 CLOSE #1 |
| ||
420 END |
|
| |
430 | ' |
|
|
440 | DATA | 0, 3, 0, 2, 1, 2, 1, 2, 0 |
|
450 | DATA | 1, 2, 1, 2, 0, 3, 0, 2, 0 |
|
460 | DATA | 1, 2, 0, 2, 1, 2, 0, 3, 0 |
|
470 | DATA | 0, 2, 0, 2, 1, 3, 0, 2, 1 |
|
480 | DATA | 1, 2, 0, 2, 1, 3, 0, 2, 0 |
|
490 | DATA | 1, 2, 1, 3, 0, 2, 0, 2, 0 |
|
500 | DATA | 0, 2, 1, 3, 0, 2, 1 ,2, 0 |
|
81