Printing label from usb barcode scanner with ZBI

B Bence Zakany 2 years 10 months ago
358 2 0

Dear  All!

I have an issue with my zebra printer and usb scanner. I am new in zbi world and everything is new for me.I would like to use both of them in my project. I have zebra zt410rfid printer and a LS1203 barcode scanner that is connected via usb to the printer. The project is, scan a barcode and print on the label. So i tried to write zbi code to test my hardware and i got stuck. First of all I would like to use this code for scan a barcode whitch is include "123" and after that print a datamatrix code with the scanned data.  The printer is zbi compatible with activated license. Maybe my code is wrong, but when i copy the zbi program as ".bas" to the printer and i try to run it and nothing happens. No scanning and no printing. When i  use "USB" port and i want to run my program on the printer, the file name is disappear the file name on the screen, when i want it to run. But if i use in my code serial port, its run and appear the file name on the screen.

I would like to ask some  help to in .Thank you.

The code:
10 CLOSE ALL
20 OPEN #1: NAME "USB"
30 OPEN #2: NAME "ZPL"

40 INPUT #1: A$
50 if A$ = "123" then
60 PRINT #2: "^XA^FS^FO250,200^BXR,20,200^FD" &A$& "^FS^XZ"
70 end if

80 INPUT #1: A$
90 if A$ = "456" then
100 PRINT #2: "^XA^FS^FO250,600^BXR,20,200^FD" &A$& "^FS^XZ"
110 end if

120 INPUT #1: A$
130 if A$ = "789" then
140 PRINT #2: "^XA^FS^FO250,1000^BXR,20,200^FD" &A$& "^FS^XZ"
150 end if

160 goto 40

Please register or login to post a reply

2 Replies

D Dmitry Prokhorov

Hello Bence,

I unsure you can use USB Host port in ZBI to communicate with a scanner. However here is a section in your printer manual on how to do that using ZPL language:

KEYBOARDINPUT.ZPL
https://www.zebra.com/content/dam/zebra/manuals/printers/industrial/zt4…

Exercise 4: Enter Data for a Stored File with a USB Keyboard and Print a Label
https://www.zebra.com/content/dam/zebra/manuals/printers/industrial/zt4…

Dmitry Prokhorov
Software Engineer, Kutir Mobility
Posted on behalf of Zebra Technologies

F FirstName LastName

Hello,
I'm developing a ZBI program to send data from zebra printer (TCPCLIENT) to TCPSERVER. I can create a connection and I can send data from TCPSERVER to TCPCLIENT into Zebra Printer. But I'm not able to send data from TCPCLIENT into Zebra Printer to TCPSERVER. The TCPSERVER never receive data.
Sample:
AUTONUM 1,1
CLOSE ALL
LET TCPClient = CLIENTSOCKET("TCP","192.168.1.47", 2424);
IF (TCPClient > 0) THEN
OPEN #1: NAME "ZPL";
LET MSG$ = "Hello ";
PRINT #TCPClient: MSG$ & "0" & chr$(13) & chr$(10);
INPUT #TCPClient : MENSAJE$;
DO WHILE MENSAJE$ <> "EXIT"
PRINT #TCPClient: MSG$ & "1" & chr$(13) & chr$(10);
PRINT # 1 : "~SD25^XA^FS";
PRINT # 1 : "^LH0,0^FS";
PRINT # 1 : "^FO56,150^A0N,69,58^FDMensaje recibido: " & MENSAJE$ & "^FS";
PRINT # 1 : "^PQ1,0,0,N";
PRINT # 1 : "^XZ"
SLEEP 1
PRINT #TCPClient: MSG$ & "2" & chr$(13) & chr$(10);
INPUT #TCPClient : MENSAJE$;
LOOP
PRINT # 1 : "~SD25^XA^FS";
PRINT # 1 : "^LH0,0^FS";
PRINT # 1 : "^FO56,150^A0N,69,58^FDFIN PROGRAMA^FS";
PRINT # 1 : "^PQ1,0,0,N";
PRINT # 1 : "^XZ"
END IF
CLOSE ALL
END

Thank you in advanced

CONTACT
Can’t find what you’re looking for?