08-19-2019 01:18 PM
All,
I am writing code to read angular position from encoders. Unfortunately, I don't have the encoders available yet, so I cannot hook them up. Given the lack of hardware, should I expect to get Error -200284 telling me that "Some or all of the samples requested have not been acquired?" If so, is there a way I can set up my system so I can test my code before I get ahold of the encoders? I tried to set up a pulse output channel and wire it to the counter input, but I got the same error.
I am attaching images of the NI MAX set up pages for the counter channel. Unfortunately, I cannot post my code.
Thanks in advance for your help.
Solved! Go to Solution.
08-19-2019 03:58 PM
Given the config you show, you're counting on the presence of an actively running AI task, from which you are "borrowing" the ConvertClock signal. I'm guessing that you're testing the encoder task code at a time that there is no active AI task to get that signal from. Thus, the encoder task doesn't buffer up any samples and you get that particular error.
Note: while the ConvertClock *might* be a reasonable choice for you app, it's probably more likely that you'd want the AI task's SampleClock signal. The ConvertClock rate will vary with the # of channels in the task, while the SampleClock won't.
Meanwhile, before running your encoder test code, open and run one of the shipping examples for continuous AI. I'd recommend setting up only 1 channel in the task (because this way the ConvertClock rate will match the SampleClock rate).
-Kevin P
08-19-2019 06:03 PM - edited 08-19-2019 06:04 PM
Thanks (again) for your help, Kevin.
I ran into resource conflicts with the AI SampleClock, but I set up a DI task appropriately, with the same sample rate as my counter task, and used the DI SampleClock as my external clock when I set up the counter task in NI MAX. My VI starts the counter task first, then the DI task. Now, everything seems to work fine.