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

Response time efficiency with digital output for large number of channels


  • Please log in to reply
1 reply to this topic

#1 orestes05

orestes05
  • Members
  • 6 posts

Posted 22 August 2014 - 12:55 PM

Hi,

 

I'm using multiple U3-LVs to control a large number of NPN transistors (40 or more 2N4400's).

 

I want to turn these NPNs on/off using the digital output on all available channels.  The switching for the NPNs is somewhat random and depends on feedback from another system.

 

I want to make sure my programming is as efficient as possible.  Here is a code snippet I am using in MATLAB:

 

For i = 1:N_channels

 

    .

    .

    ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.PUT_DIGITAL_BIT, 5, 1, 0, 0);

    ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.PUT_DIGITAL_BIT, 8, 0, 0, 0);

    ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.PUT_DIGITAL_BIT, 12, 1, 0, 0);

    .

    .

    .

    ljudObj.GoOne(ljhandle);

end

 

%....next step after feedback from a separate system:

 

For i = 1:N_channels

 

    ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.PUT_DIGITAL_BIT, 4, 1, 0, 0);

    ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.PUT_DIGITAL_BIT, 8, 0, 0, 0);

    ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.PUT_DIGITAL_BIT, 11, 0, 0, 0);

 

    ljudObj.GoOne(ljhandle);

end

 

 

I read that PORT can be faster, but I don't know if this applies if the channels and logical states vary each step.

 

 

Thanks,

Jeremy

 

 



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 22 August 2014 - 02:09 PM

The driver uses the low-level Feedback function to send your commands to the U3.  With your code above you get a bunch of BitStateWrite frames:

 

http://labjack.com/s...s-guide/5.2.5.6

 

If you used the port write instead, you would just have 1 port write frame:

 

http://labjack.com/s...-guide/5.2.5.10

 

If all the bit writes fit in one Feedback packet, they will be almost as fast as the 1 port write because the execution time is dominated by USB overhead.  If all the bit writes do not fit, however, you will get multiple Feedback packets which will be substantially slower.  You should be able to fit 28 bit writes in a single Feedback packet.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users