LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't communicate with printer VIA USB cable

Hi, all

 

I installed the VIA USB driver and can find the printer hardware, but I can read out the return value via NI MAX test panel, but write command is successful, please kindly refer attachment, it's also return error when i use the VISA VI read,can you help me ,thanks

0 Kudos
Message 1 of 18
(2,169 Views)

You are receiving the timeout error. Since you are trying to read 1024 bytes of data, the data is not received within that specific timeout. Either try to increase the timeout or set the bytes to read to appropriate byte size of data which the printer is sending.


CLD Using LabVIEW since 2013
0 Kudos
Message 2 of 18
(2,149 Views)

I tried the appropriate bytes data but still error , i used NI MAX test panel can't read out the data 

0 Kudos
Message 3 of 18
(2,136 Views)

you can refer the new test VI to read data

0 Kudos
Message 4 of 18
(2,135 Views)

share the serial communication command list pdf. Which command are you sending??


CLD Using LabVIEW since 2013
0 Kudos
Message 5 of 18
(2,132 Views)

Please refer my VI, command is hexadecimal,4D3C 2B1A 0F0C 0300 1301 00,this command sent using C# is OK, and return value as below:

 

 

D:\Lenovo_Image\TestPlan\Program\FCT\Alpha PRN\USBbackend.exe /f 00
Send to USB 11 bytes
0x4d 0x3c 0x2b 0x1a 0x0f 0x0c 0x03 0x00 0x13 0x01 0x00-----this is send command
Get from USB 12 bytes
0x4d 0x3c 0x2b 0x1a 0x0f 0x0c 0x04 0x00 0x13 0x02 0x00 0x02----read from printer

Lchjxlz_0-1636527622384.png

 

0 Kudos
Message 6 of 18
(2,117 Views)

So your response to receive is supposed to be 12 bytes but you try to read 15 bytes?

Where o where is there a difference?

 

Also if you insist on posting pictures of your code rather than the actual VI, please from now on make the string type glyph visible. The only way to guess that your string constant is actually in binary Hex format is from the formatting of the string, but it could just as well be a normal string formatted that way, which your printer would have no idea what to do with.

 

A more versatile routine to read the response would be however to first read 8 bytes of data, compare the first 4 bytes with the Magic ID to verify that you got a valid response, take the next 2 bytes in little endian as indication what command response it is for, then interpret the last two bytes as a little endian U16 that tells you how much more data to read. At least for the command and response you show this seems the format. 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 7 of 18
(2,110 Views)

can you help to send a versatile routine ? I'm sure it's send the hexadecimal string, thanks

0 Kudos
Message 8 of 18
(2,091 Views)

I tried lots of read bytes ,since the different command maybe feedback different bytes,thanks

0 Kudos
Message 9 of 18
(2,089 Views)

Read 8 bytes or 2 bytes ,the same error return (Hex 0xBFFF0015)..thanks

0 Kudos
Message 10 of 18
(2,086 Views)