LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i begin programming LabWindows/CVI to use a TEC SA4 printer

I am having problems communicating with a TEC SA4 printer via LabWindows/CVI, I cannot send the correct strings to set up the printer. i.e. the manual for the printer states that [ESC]C[LF][NUL] should clear the buffer, but I just cannot figure out how to send a string to the printer to initiate this command.
0 Kudos
Message 1 of 5
(3,359 Views)

You could use PrintTextBuffer after setting up a "generic /text only" printer as the default printer in the system.

Try these instructions in the Interactive execution window:

#include <userint.h>
static int _tmp1;
static char msg[16];

msg[0] = 0x1B; // Esc
msg[1] = 0x43; // 'C'
msg[2] = 0x0A; // LF
msg[3] = 0x0;
_tmp1 = PrintTextBuffer (msg, "c:\\temp\\print.txt");



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(3,338 Views)

Unfortunately the NUL marks the end of the msg buffer and thus would not get sent to the printer. I assume from the original problem that the printer needs to receive this last 00 character to complete its control code sequence.

JR

0 Kudos
Message 3 of 5
(3,334 Views)

Does the printer have the serial option fitted? If so you could write data to it directly via the CVI RS232 libraries; two of the functions useful here are ComWrt() and ComWrtByte() - these should be capable of including the NUL in the string of bytes to be written to the serial port.

JR

0 Kudos
Message 4 of 5
(3,327 Views)

I am noticing now that my code does not send text to the printer: it creates a file on disk instead. To print to an actual printer configured as the default printer you must pass an empty string as the second parameter to PrintTextBuffer.

JR solution for a serial printer is surely the best you can find. If your printer is connected to LPT1 instead, and you do need to send NUL characters to it you could try using outp function to write directly to the hardware port of the parallel output (see in hardware manager to detect the correct port number).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(3,311 Views)