03-06-2017 01:15 PM
Hi,
I am using a Particle measuring system instrument Lasair III 110 laser particle counter in my testing.
The communication of this instrument is Serial Rs 232.
I made a simple LabVIEW to control it for sampling and to collect the testing data and I have attached my code here.
The serial command for starting sampling is "SS" and the serial command for transmitting the last data sample (i.e. latest time). is "TL". Data is sent in standard CSV (comma separated value). The sampling time is 1 min.
However, I cannot get any testing results from the "TL" command. It only gave me "SS" in the indicator of read buffer.
When I used "YAT" for the command "SS" and "TL", I am able to get the latest data sample.
Really need help to figure out how to get the latest testing results and extract the useful test results to do some calculation by using "LabVIEW".
Thank you very much.
Solved! Go to Solution.
03-06-2017 01:30 PM
The byte count you want to read is the same as the data you have written.
Is that correct?
Is the data almost immediate available or do you get a timeout error.
Default the timeout is 10 seconds.
Is that enough?
I suggest to control the number of characters to read by a control on the frontpanel.
Or use an endcharacter in your case probably LF or CR.
03-06-2017 04:12 PM
Hi, Albert
Thank you very much for your quick reply.
I don't think the byte count I want to read is the same as the data I have written.
What I have written is the command "SS" and the command "TL".
I don't think the data is immediate available. Because the "SS" command means "start sampling" and the sampling period is 1 minutes. The data is supposed to be available after 1 mins.
I did not get any timeout error or any error.
Please see the attachment for the results I got from "YAT".
I believe there is some "time" issue and endcharacter issue as well.
Thank you very much for your help.
Bingji
03-06-2017 05:05 PM
The problem with the first VI you posted is that your VISA Read is only giving you 3 characters since that is what you told it to do. From the the screen capture, it is evident that the instrument ends its messages with a Carriage Return and a Line Feed. So you want to leave the defaults for the termination character. Now tell the VISA Read to read more bytes than you expect in a message (I bounce between 50 and 100 depending on my mood and/or the device). What this will do is allow the VISA Read to stop when it encounters the termination character. This ensures you get your full message.
03-06-2017 06:09 PM
Hi, Crossrulz
Thank you very much for your help.
I modified the code and please see the attachment.
When I put 50 in the "byte control", the "read buffer" indicator gave me like "TL".
When I put 100 in the control, the indicator gave me like "°TL".
They are still not the results I want to get which are the fourth line in the screen capture I posted.
Please help with the issue.
Thanks a lot.
Bingji
03-06-2017 06:37 PM
I am not sure if the buffer size is not big enough.
Therefore, I added the buffer size change VI before the Visa Read. Please see the attached code.
However, it still did not give me the results I wanted.
Thanks,
Bingji
03-06-2017 07:02 PM - edited 03-06-2017 07:03 PM
Bingji wrote:I modified the code and please see the attachment.
When I put 50 in the "byte control", the "read buffer" indicator gave me like "TL".
This sounds like the instrument has an echo its protocol. Try performing an extra read.
03-06-2017 07:18 PM
Yes.
It is said "All characters are echoed" in the instrument manual.
I will try it and thank you very much for your help.
Bingji
03-06-2017 07:29 PM
Hi,
I have tried to add another Visa read and the code you suggested.
This time, the response has "OK".
I think it is the second line of the screen capture.
I want the forth line in the screen capture as the result.
Please help.
Thanks,
Bingji
03-06-2017 08:22 PM
Bingji wrote:
I want the forth line in the screen capture as the result.
From what I can tell from that screen capture, it looks like you have to send another TL and then the results will come (after the echo).