I am working on a project using Visa serial communication. I have to read the scanner output and print information in the report. I have successfully read the barcode and also able to print it in the Excel sheet. But I am facing a problem of synchronization of data from the scanner and printing it to Excel sheet. sometimes I don't print data and sometimes two, three data in a single cell.
Please find the enclosed vi.
Looks like you are doing intermittent/sporadic ASCII communications. So....
1. Do not tell the VISA Read how many bytes to read with the Bytes At Port. Instead, read more bytes than you ever expect to get in a single line.
2. Your wait should be in the FALSE case of your structure. In other words, you only wait if there is no data to read.
Thanks for replying my message. I am using default settings.
Do you see any property that I can use to control the reading operation.
What value should I provide at byte count of Read vi. Data byte length is not fixed for reading barcodes. I also used 1000 byte counts that I read from NI forum. That didn't work properly.
I tend to use 100, since I very rarely see a message that is longer than that. In the case of your bar code scanner, you need to figure out if the scanner sends a Carriage Return and/or a Line Feed to state the end of the message or if it relies on the barcode to do that. Since we are stating it is ASCII data, we need something, typically a Termination Character, to tell us when the message is over.
I have carefully checked the manual. It describes that that Maximum no of bytes per packet are 257. Also scanner uses ACK/NAK handshaking for communication. The host serial response timeout is 2 sec.
Could you please let me know what changes I have to made in my code.
Forgot to mention that ACK/NAK handshaking is with SSI interface. NI Visa support SSI or RS232 ? I have no idea.
Could you point me to documentation on your scanner?