89
About bar code element type
Any bar code type can be expressed in bar codes by varying bar elements; narrow bar, wide
bar, narrow space, wide space, and intercharacter gap. However, HRI, check digit, and
start/end code have to be added manually. If a specific type of bar code other than
specified earlier does not satisfy your needs, create your own program to translate data to a
specific bar code.
Sample program: Print "CODE39" in code 39 format using bar code element print.
Output:
100 OPEN "LPT1:" AS#1: WIDTH #1,255
110 DC4$=CHR$(&H14):ESC$=CHR$(&H1B)
120 SI$=CHR$(&HF):SO$=CHR$(&HE):ICG=4
130 '
140 PRINT #1,DC4$;DC4$;"@"; 'Initialize
150 PRINT #1,DC4$;DC4$;"T";CHR$(255); 'Barcode Type:Element Print
160 PRINT #1,DC4$;DC4$;"E";CHR$(0);CHR$(2); 'Narrow Bar: 2/120"
170 PRINT #1,DC4$;DC4$;"E";CHR$(1);CHR$(6); 'WIDE Bar: 6/120"
180 PRINT #1,DC4$;DC4$;"E";CHR$(2);CHR$(2); 'Narrow Space: 2/120"
190 PRINT #1,DC4$;DC4$;"E";CHR$(3);CHR$(6); 'Wide Space: 6/120"
200 PRINT #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 '
230 PRINT #1,DC4$;DC4$;"B";CHR$(9*8+7); 'Barcode Data Spequence Start
240 RESTORE 440
250 FOR I=1 TO 9:READ A:PRINT CHR$(A);:NEXT I
260 PRINT #1, CHR$(ICG);
270 FOR J=1 TO 6
280 IF J=1 THEN RESTORE 450
290 IF J=2 THEN RESTORE 460
300 IF J=3 THEN RESTORE 470
310 IF J=4 THEN RESTORE 480
320 IF J=5 THEN RESTORE 490
330 IF J=6 THEN RESTORE 500
340 FOR I=1 TO 9:READ A:PRINT CHR$(A);:NEXT I
350 PRINT #1, CHR$(ICG);
360 NEXT J
370 RESTORE 440
380 FOR I=1 TO 9:READ A:PRINT 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
B. Control code summary (bar code)