10-15-2008 01:38 AM
Dear all,
I am using a USB interface to acquire data throug LabVIEW.
The interface has 2 buttons in it. One for sending the waveform data(992 bytes) and another using DSR request for sending the value of Current(62 bytes).
I want to detect between the waveform data and the DSR request. If the waveform data is recieced, it should be plotted on the Graph and if the DSR request is recieved, the value of the current should be updated.
The method which i think is suitable to achieve the goal is to get the size of the buffer before calling the VISA Read function and depending upon that do an appropriate operation.
I wrote a VI to perform the same but could not get it working. Pls have a look at it also, let me know how to tackle this problem.
Thanks,
Ritesh
10-15-2008 02:20 AM
10-15-2008 02:24 AM
The serial VISA connection has a property for that:
http://zone.ni.com/reference/en-XX/help/371361D-01/lvinstio/visa_bytes_at_serial_port/
Daniel
10-15-2008 02:37 AM
10-15-2008 05:46 AM
Dear All,
Thanks for your replies.
"Bytes at Port" was the fnction i was lookin for.
But, now the scenerio of problem has changed.
How to set multiple event detect in VISA functions ?
Like the waveform data comes as 1054 bytes. But the other switch when pressed, sends 62 bytes with DSR event.
I want to differentiate between the waveform data and theDSR event.
In Visual basic, there is an event handling like OnCommevent and various status can be read like : Comevrecieve or ComevDSR.
How can we detect recieve threshold event similar to Comevrecieve ?
Thanks,
Ritesh
10-15-2008 08:37 AM
10-16-2008 01:39 AM
Hi Dennis,
I implemented a VI with a case structure checking the number of bytes at the port.
Just have a look at it and let me know if this was thing you asked to do.
Thanks,
Ritesh
10-16-2008 07:00 AM
Hi Dennis,
I just figured out that the case structre with "bytes at the port" function wont solve my problem.
Thing is my H/W is sending me chunks of 62 bytes. If Button 1 is pressed, it will only send the waveform data, i.e it will only send the chunks of 62 bytes. But, if Button 2 is pressed, it will send 62 bytes with DSR request.
and the waveform data will only be read when the Buffer size = 1054.
So, i need to differentiate between the DSR request and the waveform data(without any request).
I have created a VI with a logic to chk for request or not. but, still its not giving out the perfect result. it does recognizes the request, but isn't able to detect the data.
Just have a look at the VI to understand better of what i want to convey.
N let me know if there's any wayout to perform it.
Thanks,
Ritesh
10-16-2008 08:54 AM
Sort of. What wasn't clear from your first post was whether the instrument only sent data as a response to a write. This last example implies that the instrument is always sending data on it's own. Your simple case statement will probably not work. Say, for example, the instrument is sending waveform data. Your VI reads the number of bytes before the instrument is finished sending. The number of bytes available will not match what you expect for a waveform.
Without seeing the documentation for the instrument, it's hard to say what needs to be done to make your program more robust. You never really answered my question about the serial DSR line. If it's true that the DSR line is only asserted for one type of data, then you might be better off using that. For example, you could check if number of bytes is greater than 0 and DSR asserted. Or them together to determine the type of read.
10-16-2008 09:00 AM