I'm reading AIN0-3 with USB based streaming (i.e. Labview's eStreamStart). At the same time, I'm using lua scripting to control a waveform with mbwrite to the DAC. I tried creating a failsafe (e.g. turn off the waveform if we have no communication to the Labview application) by regularly updating a register using labview, then when lua detects that no update has taken place, the waveform gets turned off. However the regular read/write operation of this method seems to interupts the waveform and/or eStream to a degree that doesn't work for me. How else can I detect with lua that I've lost communication with the labview application? Is there a way to read LJME_LJM_BUFFER_FULL using lua (e.g. the streaming buffer will fill if labview applicaiton is not reading)? Or maybe peek at the eStream data to look for a 9999 error value?
Thanks for any help!
I have been unable to find a way to monitor the stream buffer status from Lua.
How fast are you streaming (channels per scan and scans per second)?
Have you seen the watchdog feature? https://labjack.com/support/datasheets/t-series/watchdog
I've been scanning 4 channels with 15000 scans per second. I've been trying to maximize that rate for improved signal averaging. Perhaps if there is a way to calcualte the maximum rate you can clue me in- I've been using trial and error.
Using the example you linked to, watchdog seems to work just fine, though I don't understand why. The data stream seems to reset the watchdog as I am not updating any registers (I don't think I am anyways). There is a note saying a normal spontaneous data stream should not reset the watchdog. I'm not sure what spontaneous means.
Happy to leave it alone though - if it works, it works. Thanks!
" calcualte the maximum rate ..."
This can be difficult. Even more so because the T7 will reduce resolution as stream speed increases. Because of that, increasing rate will result in individual samples being lower quality. To get the best data will require a lot of trial and error. Generally, I would expect higher a higher resolution setting to be better than oversampling, unless you are trying to filter out signal noise.
You are right that the normal data stream should not clear the watchdog. There must be some additional packets being sent. I think the driver will occasionally read some status registers, that might be what is clearing the watchdog.