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

readSizeMultiplier in u6Stream.c


  • Please log in to reply
3 replies to this topic

#1 Tangle

Tangle
  • Members
  • 2 posts

Posted 05 January 2015 - 09:07 PM

Hello,

 

I just want to clarify if my understanding of this variable is correct.  Behaviour is not quite what I expect when I change things.  This is taken from the u6Stream.c (attached)Attached File  u6Stream.c   16.48KB   298 downloads file:

 

 /* For USB StreamData, use Endpoint 3 for reads.  You can read the multiple
             * StreamData responses of 64 bytes only if SamplesPerPacket is 25 to help
             * improve streaming performance.  In this example this multiple is adjusted
             * by the readSizeMultiplier variable.
             */
            
            //Reading stream response from U6
            recChars = LJUSB_Stream(handle, recBuff, responseSize*readSizeMultiplier);

 

I think this means that if (and only if) I configure samplesPerPacket to be 25 I can read multiple packets with one call of LJUSB_Stream().  In this example readSizeMultipler controls how many packets I can read in one call of LJUSB_Stream().  So does this mean that LJUSB_Stream() will read as many packets as is specified by the expected bytes argument?  For example if I simply set the number of expected bytes to 3*responseSize, will LJUSB_Stream read 3 packets at once?

 

Thanks for you help.



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 06 January 2015 - 01:01 PM

Yes, when SamplesPerPacket is 25 you can read multiple StreamData responses in one USB read (LJUSB_Stream). In the stream example, readSizeMultiplier controls how many StreamData responses are in a USB read. So if SamplesPerPacket is 25, reading 3*responseSize bytes will be 3 StreamData responses. 



#3 Tangle

Tangle
  • Members
  • 2 posts

Posted 07 January 2015 - 09:15 PM

Thanks for the response.

 

Just to make it absolutely clear, in this case the expected number of bytes provided to LJUSB_Stream() completely controls how many packets are read.  Nothing else needs to be set or sent to the LJ?



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 08 January 2015 - 01:01 PM

The expected number of bytes you pass to LJUSB_Stream's third parameter controls the number of StreamData responses/packets to be read. If stream mode's SamplesPerPacket is configured for 25, you can read multiple StreamData responses per LJUSB_Stream call. If SamplesPerPacket < 25, you can only read one StreamData response per StreamData call.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users