Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

U6 stream mode and digital output parallel


  • Please log in to reply
3 replies to this topic

#1 Axel

Axel
  • Members
  • 1 posts

Posted 20 September 2012 - 01:15 AM

Hello, we want to use the U6 in stream mode reading analog inputs and in parallel setting a digital output. While Testing with LabVIEW we noticed a delay that varies between 15 an 1000ms setting the digital output with stream mode running. Setting digital output without stream mode active takes max. 2ms. Is it possible to have a faster digital output while stream modes is active or would it be more clever to use e.g. two U12? Thanks in advance!

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 20 September 2012 - 09:56 AM

What sort of data flow do you have for your stream reads and digital output? Check out the example "U3 Stream With DO.vi". You can see that it puts an Add/Go/Get in series with the stream read eGet in the read loop, so you get one command/response operation per iteration of the stream read loop. You can then make adjustments to how often stream reads happen, and know exactly how many command/response updates you are getting. For example, using the SLEEP wait mode, if you scan at 100 scans/second, and read 50 scans/read, then the stream read loop will iterate 2 times per second.

Make sure you read Section 4.3.7 of the U6 User's Guide to get an understanding of how stream data is moved from the device to your application:

http://labjack.com/s...ers-guide/4.3.7

In the "U3 Stream With DO.vi" example, there is a constant on the wiring diagram called "Iterations per second". It is set to 2, so you will get a stream read and DO update every 500ms. You can increase that to do more stream reads per second, and thus more DO updates, at the expense of reducing max stream rates.

If you really want lots of DO updates, there are some advanced techniques you should use to do many small reads rather than few large reads. See "U6 Low Latency Stream.vi". I just ran this with ScanRate=100, ScansToReadPerIteration=1, and Delay=4ms, and did not see any backlog. That means the stream loop is iterating 100 times per second with a 4ms dummy delay that
could be your DO write.

#3 Susi

Susi
  • Members
  • 31 posts

Posted 13 October 2012 - 07:48 AM

What sort of data flow do you have for your stream reads and digital output? Check out the example "U3 Stream With DO.vi". You can see that it puts an Add/Go/Get in series with the stream read eGet in the read loop, so you get one command/response operation per iteration of the stream read loop. You can then make adjustments to how often stream reads happen, and know exactly how many command/response updates you are getting. For example, using the SLEEP wait mode, if you scan at 100 scans/second, and read 50 scans/read, then the stream read loop will iterate 2 times per second.

Make sure you read Section 4.3.7 of the U6 User's Guide to get an understanding of how stream data is moved from the device to your application:

http://labjack.com/s...ers-guide/4.3.7

In the "U3 Stream With DO.vi" example, there is a constant on the wiring diagram called "Iterations per second". It is set to 2, so you will get a stream read and DO update every 500ms. You can increase that to do more stream reads per second, and thus more DO updates, at the expense of reducing max stream rates.

If you really want lots of DO updates, there are some advanced techniques you should use to do many small reads rather than few large reads. See "U6 Low Latency Stream.vi". I just ran this with ScanRate=100, ScansToReadPerIteration=1, and Delay=4ms, and did not see any backlog. That means the stream loop is iterating 100 times per second with a 4ms dummy delay that
could be your DO write.


Hello I'm having a similar problem but I'm working whit matlab, I need to read from analog input and at the same time send an PWM signal, so I'll change the PWM signal every 0.5 seg, but I need to read every 0.001 seg (1ms) but I'm havign a problem whit the stream mode I'm getting all the data from 0.5 seg at the end of the simulation, so can I use the same techniques whit matlab?? and how can I do it??

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 15 October 2012 - 07:01 AM

So you want to update the duty-cycle of a PWM output every 500ms while streaming at 1 kscans/second. Post #2 above is good info for you. Since you want your read loop to iterate at 2 Hz, you do not need to use any special low-latency techniques. Just use normal stream code. You can either use SLEEP wait mode and read 500 scans per iteration, or use NONE wait mode with some sort of matlab 500ms interval timer.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users