LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

200279 With AI, DI and DO Lesson

Hello!

 

I really don't code a lot, and when I do, I usually haven't touched LabVIEW in 6 months to a year. I'm trying to build a repository of lessons for my future self and I hit a roadblock on some analog input, digital input and output stuff. I am using a 9174 with a 9239 AI, 9482 relay out and a 9421 DI. I put the code together and ran it, and started kicking the error. I've spent some time searching and tried some things, but no luck. I know there is no error handling, that's next on the list.

 

The attached VI doesn't really do anything specific, just a demo on how I should be setting up the hardware and timing etc. The code runs for about 10 seconds and kicks the 200279. What should I have done different? Fire suit on!

 

Thanks!

0 Kudos
Message 1 of 2
(147 Views)

Error -200279: Unable to Keep Up With Acquisition in NI-DAQmx

Your sampling rate is 100Hz but you are using DAQmx Read with single sample at 50ms wait time, which is effectively just 20Hz. You should read multiple samples for each DAQmx Read call, at least 20 samples if you want to run the loop at 50ms.

 

Other comments:

  1. You can use cDAQ6Mod3/ai1:2 instead of using multiple Create DAQmx Channel VI. See NI-DAQmx Syntax for Specifying Physical Channel Strings
  2. The DAQmx Configure Output Buffer VI for digital tasks is useless because you are not using sample clock timing.
  3. Please share your code in an earlier version (File >> Save as Previous Version) in the future, as most community users don't have access to the latest version of LabVIEW.
-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 2
(118 Views)