LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I write a serial text string (ASCII) to a Zebra printer on COM1 without a 'GetCommError' being generated by WIN20000?

The text string is a combination of Text and i32 data. I also add commands for the Zebra printer (Industrial Barcode Label Printer) in ZPL language. These commands are used to create the format, text filed and font of the label.
0 Kudos
Message 1 of 15
(9,175 Views)
It's Windows that's generating the error and not LabVIEW? Is there another system resource trying to use the printer like a Windows printer driver? Are you using VISA or the old LabVIEW serial driver? A little more information and even attaching the VI would help.
0 Kudos
Message 2 of 15
(9,175 Views)
Dennis, I deleted the printer from the Windows Printers and no error messages are displayed. As you can see in the Acquire & Print vi I have attached I am using some string controls as data inputs to test the printer interface. The 'Serial Number' is an alpha-numeric (BEGF12345), the 'Operator' and the 'Flow Rate' are text. The 'Printer Start Control String' and the 'Printer End Control String' controls are used to add the ZPL (see below) commands to the text string. I started with only frame one of the sequence, but added frame 0 to verify the text being sent. I added frame two to see why the printer was not responding because frame 1 does not generate an error. The GetCommError was from frame 2.
The printer did respond to a printer test from W
indows (Win 2000) within the printers properties.
A brief course on ZPL:

^XA indicates start of label format
^LH sets label home position dots right and dots down from top edge of label
^FO sets the field origin dots right and dots down from top edge of label
^AD selects font 'D' (preset font in firmware)
^FD start of field data
^FS end of field data
^XZ indicates end of label
0 Kudos
Message 3 of 15
(9,175 Views)
Are you sure about the printer control codes and the "^" character? And is it literaly supposed to be this and not some special character? I would try using hyperterminal first for debugging all of the commands.
0 Kudos
Message 4 of 15
(9,175 Views)
You have some mistakes in your code.

1) There is no guarantee that the serial port will be initialized before your data is sent out. You must put this part of code in Sequence 0.

2) You are reading Spreadsheet string in Sequence 1 but its value is written only later (after all sequences).

The VI may function correctly if you run it twice with the same parameters (it will always send the previous value of Spreadsheet string).

3) There is no delay between Write to serial port and Read from serial port. The printer will not have enough time to send an answer. You must add a loop with a timeout.

Another point to check :
The Array to Spreadsheet string function adds Tabs (\t)and an End of line to your string (\r\n). Are these characte
rs supported by the printer ?


See modified code.

HTH
0 Kudos
Message 5 of 15
(9,175 Views)
I cannot look into your program (i have only LV6i), but if it is OK you should try to switch off buffering in Windows 2k and install Generic Text / Only printer on COM1.
If you could send me this program in 6i version, i'll try it with my Zebra printer.
Romek.
0 Kudos
Message 6 of 15
(9,175 Views)
This is surprising because I saved the VI with the convert to 6.0 option ! What is the error message ?
0 Kudos
Message 7 of 15
(9,175 Views)
Dennis, The commands are correct. I have used hyperterminal and the printer responds from there or the 'Print Test Page' of the printers window.
0 Kudos
Message 8 of 15
(9,175 Views)
I've made small correction, and all works perfectly.
COM1 on PC have to be free of any other devices.
I've attached corrected your vi and my version with barcode printing.
Romek
Download All
0 Kudos
Message 9 of 15
(9,175 Views)
I work with ZEBRA 90XiII printer.
There may be differences if you use other ZEBRA printer.
Romek
0 Kudos
Message 10 of 15
(9,175 Views)