Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronizing two counters output with a USB-6212

OK.

Now I have a 200279 error on the task I called "LectureOut" (ai0). I'm afraid I don't really understand this. MAybe that's because I start the task after ctr1 ?

 

____________________
JB
0 Kudos
Message 21 of 26
(3,336 Views)

That error means that you are acquiring data faster than you are reading it.  While the acquisition is taking place, the board fills up a buffer on your computer.  When you call DAQmx Read, data is retrieved from this buffer.  If the buffer fills up faster than you can pull data from it, error 200279 will occur, informing you that data has been overwritten in the buffer.

 

The solution is probably going to be to read more data per loop iteration.  In the last iteration of your code, you were reading 133 samples per loop. With a sample rate of 64000, the loop would have to run at almost 500x per second in order to keep up with the data.  I usually set my samples to read to be about 1/10th of the sample rate in order to slow down the loop.

 

More information on error -200279 here.

 

 

 

Best Regards,

John Passiak
0 Kudos
Message 22 of 26
(3,323 Views)

 

OK, I understand.

 

I have a last question.

In the VI attached, I tried to clarify the diagram by using local variables. However, when I change a numerical value on the interface, it seems that the variable is not updated the first time I execute the VI: I need to stop it and to run it a second time in order to get the proper values. Do I have to use a sequence in order to get this working or is there another way ?

 

Thanks again !

____________________
JB
0 Kudos
Message 23 of 26
(3,309 Views)

Hi tycho75,

 

If you want to update values of indicators while the program is running, the easiest way is to put this portion of the code inside a loop.  You'll want to put a delay inside the loop so that it doesn't consume all of your CPU.

 


Best Regards,

John Passiak
0 Kudos
Message 24 of 26
(3,299 Views)

Hi John,

 

If I do this, the values of the indicators in the loop will be updated, but not the corresponding local variables which are outside the loop.

 

Cheers,

JB

____________________
JB
0 Kudos
Message 25 of 26
(3,266 Views)

Are you trying to update the counter rates on the fly?

 

You can do this, but maintaining synchronization on the 6212 isn't going to work if you're changing the frequency since updates are software-timed.  If only changing duty cycle, then the counters will still remain in synch but the exact timing of the updates might not correlate.

 

 

In any case, to update values while a VI is running you need to read from them inside your loop.  The local variables that are outside the loop will only be read once at the start of your program.

 

 

Best Regards,

John Passiak
0 Kudos
Message 26 of 26
(3,258 Views)