“脫機打印”的需求
“脫機打印”意思是打印機不與電腦進(jìn)行聯(lián)機,而獨自進(jìn)行打印!懊摍C打印”的場(chǎng)合通常有幾種:
1、打印現場(chǎng)無(wú)法安裝電腦。
2、
打印一些固定格式的標簽,需要快速進(jìn)行打印
3、現場(chǎng)補打合格的標簽
4、位置靈活的進(jìn)行標簽的打印
5、現場(chǎng)貼標現場(chǎng)打印
Intermec PM4i“脫機”打印的優(yōu)勢
傳統意義上的“脫機”打印,往往需要1臺條碼打印機+1個(gè)鍵盤(pán)的模式,鍵盤(pán)通過(guò)PS/2或者RS232C與條碼打印機連接,這種模式既增加了設備故障率,又增加了設備的使用成本。
Intermec PM4i“脫機”打印時(shí),可利用其面板的Keypad進(jìn)行變量數據的錄入,也可以連接USB條碼掃描器進(jìn)行變量數據的錄入。
Intermec PM4i自帶的Fingerprint語(yǔ)言,可實(shí)現非常豐富的功能,尤其提供的ERRHAND.PRG包含基本的錯誤處理套路和管理鍵盤(pán)、顯示和打印,可以合并到你自己的程序中。
ERRHAND.PRG的完整列表:
10 PROGNO$=“Ver. 1.21 2005-11-25”
15 NORDIS1$=“FP-APPLICATION” : NORDIS2$= “VERSION 1.21”
20 GOSUB 700000 : 'Initiate
100000 'Error routine
100010 EFLAG%=ERR
100050 'PRINT EFLAG%:'Activate for debug
100060 LASTERROR%=EFLAG%
100200 RESUME NEXT
160000 'PRINT “Last error = ”;LASTERROR%:'Activate for debug
160050 'IF LASTERROR%<>0 THEN PRINT “At line ”;ERL
160100 LASTERROR%=0
160200 RETURN
200000 'Error handling routine
200010 IF EFLAG%=1006 THEN GOTO 200040 : ' Formfeed instead of print
200020 LED 1 ON : LED 0 OFF : BUSY
200030 SOUND 400,10
200040 IF EFLAG%=1031 THEN GOSUB 300000
200050 IF EFLAG%=1005 THEN GOSUB 310000
200060 IF EFLAG%=1006 THEN GOSUB 320000
200070 IF EFLAG%=1022 THEN GOSUB 330000
200080 IF EFLAG%=1027 THEN GOSUB 340000
200090 DISP1$=NORDIS1$ : DISP2$=NORDIS2$
200100 GOSUB 600000
200110 LED 1 OFF : LED 0 ON : READY
200400 RETURN
300000 'Error 1031 Next label not found
300010 DISP1$=“LABEL NOT FOUND”
300020 DISP2$=“ERR NO. ”+STR$(ERR)
300030 GOSUB 600000
300040 EFLAG%=0
300050 FORMFEED
300060 IF EFLAG%=1031 THEN GOTO 300040
300200 RETURN
310000 'Error 1005 Out of paper
310010 DISP1$=“OUT OF PAPER”
310020 DISP2$=“ERR NO. ”+STR$(ERR)
310030 GOSUB 600000
310040 IF (PRSTAT AND 1)=0 THEN GOTO 310040 : ' Wait until head lifted
310050 EFLAG%=0
310060 IF (PRSTAT AND 1)=0 THEN FORMFEED ELSE GOTO
310060
310070 IF EFLAG%=1005 THEN GOTO 310040
310080 IF EFLAG%=1031 THEN GOSUB 300000
310200 RETURN
320000 'Error 1006 no field to print
320010 GOSUB 400000
320200 RETURN
330000 'Error 1022 Head lifted
330010 DISP1$=“HEAD LIFTED”
330020 DISP2$=“ERR NO. ”+STR$(ERR)
330030 GOSUB 600000
330040 IF PRSTAT AND 1 THEN GOTO 330040
330050 FORMFEED
330060 IF PCOMMAND% THEN GOSUB 500000
330200 RETURN
340000 'Error 1027 Out of transfer ribbon
340010 DISP1$=“OUT OF RIBBON”
340020 DISP2$=“ERR NO. ”+STR$(ERR)
340030 GOSUB 600000
340040 IF PRSTAT AND 8 THEN GOTO 340040
340050 'GOSUB 1500000
340051 GOSUB 1501000
340200 IF PCOMMAND% THEN GOSUB 500000
349000 RETURN
400000 'Feed routine
400010 EFLAG%=0
400020 FORMFEED
400200 IF EFLAG%<>0 THEN GOSUB 200000
400300 RETURN
500000 'Print routine
500010 EFLAG%=0
500020 PCOMMAND%=1
500030 PRINTFEED
500040 IF EFLAG%<>0 THEN GOSUB 200000
500100 PCOMMAND%=0
500300 RETURN
600000 'Display handler
600010 PRINT #10
600020 PRINT #10
600030 PRINT #10, DISP1$
600040 PRINT #10, DISP2$;
600200 RETURN
700000 'Init routine
700010 ON ERROR GOTO 100000
700020 OPEN “console:” FOR OUTPUT AS 10
700030 DISP1$=NORDIS1$ : DISP2$=NORDIS2$
700040 GOSUB 600000
700100 ON KEY 15 GOSUB 1500000 : 'PAUSE
700110 ON KEY 17 GOSUB 1700000 : 'PRINT
700120 ON KEY 18 GOSUB 1800000 : 'SETUP
700130 ON KEY 19 GOSUB 1900000 : 'FEED
700140 KEY 15 ON
700150 KEY 17 ON
700160 KEY 18 ON
700170 KEY 19 ON
700230 LED 0 ON
700240 LED 1 OFF
700300 PAUSE%=0
700500 RETURN
800000 'Turn all keys on
800010 FOR I% = 0 TO 21
800020 KEY (I%) ON
800030 NEXT I%
800040 RETURN
900000 'Turn all keys off
900010 FOR I% = 0 TO 21
900020 KEY (I%) OFF
900030 NEXT I%
900040 RETURN
1500000 'Pause function
1500010 KEY 15 ON
1500020 PAUSE%=PAUSE% XOR 1
1500030 BUSY : LED 0 OFF
1500040 DISP1$=“Press <PAUSE>” : DISP2$=“to continue”
1500050 GOSUB 600000
1500060 IF PAUSE%=0 THEN GOTO 1500100
1500070 SOUND 131,2
1500080 SOUND 30000,20
1500090 IF PAUSE% THEN GOTO 1500070
1500100 READY : LED 0 ON
1500110 DISP1$=NORDIS1$ : DISP2$=NORDIS2$
1500120 GOSUB 600000
1501000 'PD41 Pause function
1501005 ON KEY 17 GOSUB 1501000 : 'Temporarily hijack the PRINT key.
1501010 KEY 17 ON
1501020 PAUSE%=PAUSE% XOR 1
1501030 BUSY : LED 0 OFF
1501040 DISP1$=“Press <PRINT>” : DISP2$=“to continue”
1501050 GOSUB 600000
1501060 IF PAUSE%=0 THEN GOTO 1501100
1501070 SOUND 131,2
1501080 SOUND 30000,20
1501090 IF PAUSE% THEN GOTO 1501070
1501100 READY : LED 0 ON
1501110 DISP1$=NORDIS1$ : DISP2$=NORDIS2$
1501120 GOSUB 600000
1501130 ON KEY 17 GOSUB 1700000
1502000 RETURN
1503000 RETURN
1700000 'Printkey
1700010 KEY 17 OFF
1700020 GOSUB 500000
1700030 KEY 17 ON
1700200 RETURN
1800000 'Setup key
1800010 KEY 18 OFF
1800020 LED 0 OFF
1800030 BUSY
1800040 SETUP
1800050 READY
1800060 LED 0 ON
1800080 KEY 18 ON
1800090 DISP1$=NORDIS1$ : DISP2$=NORDIS2$
1800100 GOSUB 600000
Intermec PM4i“脫機”打印條形碼標簽的一個(gè)例子
1、編輯一個(gè)條形碼標簽
21 BARFONT ON
22 BARFONT “Swiss 721 BT”, 6
30 PRPOS 10,10
40 PRBOX 430,340,15
50 PRPOS 30,30
60 PRIMAGE “GLOBE.1”
70 PRPOS 75,270
80 BARTYPE “CODE39”
90 PRBAR “ABC”
100 PRPOS 75,220
110 FONT “Swiss 721 BT”, 6
120 PRTXT “My FIRST label”
130 PRPOS 120,100
140 ALIGN 7
150 A$=“ABC Company”
160 B$=“1000 FirstAve”
170 C$=“Azusa CA”
180 D$=“NEWLINE”
190 E$=A$+D$+B$+D$+C$
200 FONT “Swiss 721 BT”, 6
210 PRBOX 300,600,0,E$,0,1,D$
220 PRPOS 15,160
230 ALIGN 1
240 DIR 1
250 PRLINE 320,6
260 PRINTFEED
2、通過(guò)條碼掃描器錄入條形碼信息
通過(guò)PM4i打印機上的USB Host Interface與條碼掃描器進(jìn)行連接(HID bar code scanners)。USB Host的SETSTDIO值為9。
插入到上述代碼中如下代碼:
OPEN "usbhost:" FOR INPUT AS #1
INPUT#1,barcode$
CLOSE#1
其中, 90 PRBAR “ABC”更改為:
PRBAR barcode$
3、打印機屏幕上提示“Please scan the barcode:”
OPEN "console:" FOR OUTPUT AS 2
PRINT#2, “Please scan the barcode:”
CLOSE#2
4、加入循環(huán)體
28 BARFONT ON
29 BARFONT “Swiss 721 BT”, 6
30 PRPOS 10,10
40 PRBOX 430,340,15
50 PRPOS 30,30
60 PRIMAGE “GLOBE.1”
70 OPEN "console:" FOR OUTPUT AS 2
80 PRINT#2, “Please scan the barcode:”
90 OPEN "usbhost:" FOR INPUT AS #1
100 INPUT#1,barcode$
110 IF barcode$=CHR$(00) THEN GOTO 100 ELSE GOTO 130
120 ENDIF
130 CLOSE#1
140 CLOSE#2
150 PRPOS 75,270
160 BARTYPE “CODE39”
170 PRBAR barcode$
180 PRPOS 75,220
190 FONT “Swiss 721 BT”, 6
200 PRTXT “My FIRST label”
210 PRPOS 120,100
220 ALIGN 7
230 A$=“ABC Company”
240 B$=“1000 FirstAve”
250 C$=“Azusa CA”
260 D$=“NEWLINE”
270 E$=A$+D$+B$+D$+C$
280 FONT “Swiss 721 BT”, 6
290 PRBOX 300,600,0,E$,0,1,D$
300 PRPOS 15,160
310 ALIGN 1
320 DIR 1
330 PRLINE 320,6
340 OPEN "console:" FOR OUTPUT AS 3
350 PRINT#3, “Printing...”
360 PRINT#3, “Waiting...”
370 CLOSE#3
380 PRINTFEED
5、保存程序指令到打印機c盤(pán)下,文件名為SAMPLE.PRG
SAVE “SAMPLE.PRG”
6、創(chuàng )建sample.prg為啟動(dòng)程序
鍵入RUN "/rom/MKAUTO" ,然后按Enter
打印機返回:Startup file name:
鍵入剛保存的SAMPLE.PRG文件名,然后按Enter,打印機返回OK
這樣打印機啟動(dòng)時(shí),會(huì )自動(dòng)執行SAMPLE.PRG
7、在實(shí)際使用中需要在代碼中加入一定的中斷指令,可與ERRHAND.PRG合并使用。
數據采集器
標簽
條碼標簽
碳帶
閱讀本文的人還閱讀:
◆條碼打印機選型
◆上海條碼打印機-銷(xiāo)售與精品服務(wù)
◆條碼打印機原理是什么?解析條碼打印機工作原理
◆"打印速度"與"打印吞吐量"如何來(lái)提高?
|