Jump to content

macintosh flush serial buffer


Jeff Gee

Recommended Posts

I've just upgraded to LV8.2 (from 7.0) in the hopes that it might fix a serial port buffer problem. I have an instrument that is continously sending data (via a Keyspan USB to serial) and I want to read just the most recent data. The instrument sends 16 records (5 bytes each, no termination) each second. Ordinarily, to get the most recent data at the port I would either use VISA Flush Buffer to clear the read buffer or simply use Bytes at Port and then read all the old data. However, neither of these techniques works in this case.

VISA Flush Buffer causes all subsequent reads on the port to time out with zero bytes read. Getting the Bytes at Port also seems not to function correctly. For example, after initializing the port and waiting long enough for the default buffer size (4096) to fill up, Bytes at Port will return a maximum of 1020 bytes. After reading these bytes, the requested number of data bytes (125) is immediately available, ie within 2-3 msec. Clearly, at 16 samples (80 bytes) per second, these data are not new bytes coming from the instrument in these 2-3 msec and so must be coming from a buffer.

Anyone had any similar difficulties with buffers on the Mac? The Keyspan is a potential problem though I would note that a half dozen other serial instruments in the lab are all run with LV and Keyspans with no problems.

Thanks,

Jeff

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.