09-22-2011 07:27 AM
I'm not sure whether this is a hardware or a software issue.
I'm trying to communicate with a Stanford Reserach Systems computer interface module, SR245. I use the "serial write" command in labview to query the value of one of the channels on the SR245. I then read the port using the standard "serial read" command. If I put this into a loop to read the channel multiple times, each iteration takes ~300 ms, which is prohibitively long. I have no idea why it's going so slowly; according to what I can gather from the manual for the SR245, the A/D rate should be in the vicinity of 1 kHz and the box takes 500 us to complete an average function like the one I am requesting.
09-22-2011 07:42 AM
Can you post your code?
09-22-2011 12:46 PM
Ok, here it is. This VI takes about N/3 seconds to complete, for N reads. In the second frame I read a fixed number of bytes from the serial port (20).
The way I was previously doing this was to use the "bytes at port" command to tell the VI to read everything at the port (which ended up being 6 bytes). In this case, the wait time in frame 1 had to be about 300 ms (consistent with the length of time to complete N reads in the attached VI). If it were 200 or shorter, "bytes at port" would return fewer than 6 bytes; the read would be incomplete.
Thanks for looking.
09-22-2011 01:08 PM
Are you opening and closing the VISA session in another vi? Where are you setting the baud rate etc?
09-22-2011 01:15 PM
Sorry, yes, the session is initialized in another VI with the "configure serial port" function. The baud rate is 19200. Once I initialize the port, I never close it.
09-22-2011 01:18 PM
What is the timeout set to?
09-22-2011 01:41 PM
All inputs other than baud rate and termination character were left at their default values, so 10 seconds for the timeout (No flow control, no parity, 1 stop bit, 8 data bits.). I just tried changing it, and found that the read operation will not complete if the timeout is shorter than 300 ms.
09-22-2011 01:51 PM
Manual says that SR245 can operate in either sync or async mode. Async will return value right away and sync will wait for some sort of ext trigger. Which mode are you running in?
09-22-2011 01:57 PM
Asynchronous.
09-22-2011 03:47 PM
I don't see anything in your code that would cause this. Page 47 of manual has a section titled 'Wait Command' that might be related to what you are seeing.