Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

usb6259--c function calls--synchronized digital output generates errors, behaves strangely

i have a matlab m file which generates a digital output pulse when it receives a ttl input trigger. 

i output 2 separate samples, one high and one low, with the output clocked by the analog

input sample clock.which i set up as a dummy clock.  the analog input is triggered by

a digital edge start trigger.  if i run my set of instructions once, it runs without error but

generates no pulse.  if i put it in a 2 element loop, it runs twice and generates no errors but only one

pulse.  if i run it n times, it generates n-1 pulses and if n is greater than 2 it gives repeated

-200288 (samples will never be generated) errors.  i've attached my m file and hope someone

can explain to me the error of my ways.  thanks in advance--sid

0 Kudos
Message 1 of 5
(3,257 Views)

Hello Slgulick,

 

Have you taken a look at this KnowledgeBase article:  Why Am I Getting Error -200288?  It looks like it describes a relevant cause of this error--you need to make sure you stop the task before restarting it to trigger again.

 

I hope this helps, and if this issue persists please post back so we can look for other solutions.

 

Cheers,

Brooks
0 Kudos
Message 2 of 5
(3,239 Views)

thanks for your reply.  i think if you look at my code you will see that i both start and stop both

tasks each time the loop executes.  there must be a clue in the following facts but i don't see it:

when i run the code in the loop once, i get no errors but neither do i get a double transition of

the data out pin.  if i run the code with the loop index equal to 2, i get one pulse (double transition)

and no errors.  if i run the code 3 or more times, the loop executes n times, i get n-1 pulses,

and n-2 -200088 errors.  perhaps the order in which i start or stop the tasks matters but i did

try the code with the digital out start and stop both inside and outside the loop.  i also tried using

continuous rather than finite samples but i got a different error then...

0 Kudos
Message 3 of 5
(3,230 Views)

Hello Slgulick,

 

Can you please confirm what error you are receiving?  In your first post you said error -200288 and in the second post -200088.  These are both valid error codes for DAQmx and the reason you're receiving either is not clear from your code.

 

As a guess, I would try calling a DAQmx write for the DO lines before you start it the first time.  That way your digital out task has samples in the buffer before the first time you start the task--this could also explain why it takes one iteration to start outputting pulses.

 

I hope this helps, and have a great night.

 

Cheers,

Brooks
0 Kudos
Message 4 of 5
(3,214 Views)

hello brooks_c, thanks for your reply.  in fact

including a digital out write before i started anything

makes my code run properly now.  i get as many digital

output toggles as loops and no -200288 errors so i'm

well pleased.  from some of the matlab or

national literature i got the impression that

doing a write automatically started the task

and that it was important to start the digital

before the analog task in order that the clocking

would be synchronous.  perhaps the idea

that writing to the digital channel automatically

starts the task comes from the matlab

acquisition toolkit instead of the nidaqmx

documentation and might refer to the simplified

interface contained in the toolkit.

as far as the confusion regarding the

200088 vs 200288 errors, i've gotten 'em

all at one time or another but it was the

'samples will never be generated' error

that i was getting before i put the extra digital

write into my code.  i also got 292, 303,278,

452, 1062 and many other errors by moving

starts and stops, trying continuous rather

than finite sampling, taking the digital

start and stop out of the loop, using ';' instead

of '%' for comments, simple typos--it's amazing

how many ways there are to do something

wrong when one puts one's mind to it... 

thanks again for your help.  i've attached my

code with comments and function return outputs

enabled for anyone who might be interested. 

the purpose of the function is to generate a

digital output pulse referenced to a digital

trigger.  i generate a dummy analog read

with a sample clock and external trigger.

the length of the digital pulse is controlled

by the sample clock frequency.  the digital

output occurs about 100 ns after the

rising edge of the analog input trigger.

there's something like 50ns jitter on the

delay between trigger and output.  i hope

this might prove useful to someone else.

sid

0 Kudos
Message 5 of 5
(3,204 Views)