LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Audio In and PWM with myDAQ

Hi,

 

I'm trying to create a guitar tuner program that, using the myDAQ, can read in a signal from the Audio In jack and output a PWM signal from an Analog Out pin to control a servo motor. I have managed to get both of these functions working separately

 

However, when I try to run them at the same time, the motor runs for only a split second and I get an error message - Error -200290 - telling me that the program cannot write samples to the buffer fast enough.

 

The error message does give some examples of solutions, but none of them have worked for me. I'm not really sure if I'm implementing them right, or if I'm just barking up the wrong tree! If anyone could point me in the right direction (or to a tutorial) it would be much appreciated.

 

Thanks

0 Kudos
Message 1 of 8
(3,343 Views)

Hello jgair,

 

you do both in one loop AI and AO. The AI runs with 40 KHz and 100 KSamples this means the loop iteration time is 2,5 seconds ( samples/rate). The AO runs with 100 Khz and 10KSamples this means the loop run with 0,1 seconds. Both function for AI and AO are in the same loop but have different timing, also a calculation is done inside of the loop, which also need some time. The next is AI and AO are in row, this also makes problems.

 

Both functions should run with the same timing. The best is both functions run in a separate while loop and the data is transferred with queues between the two loops.

 

Try to set the Samples for AI to 4k, in the simulation with a USB 6210 work this.

best regards
Alexander
Message 2 of 8
(3,293 Views)

Hi Alexander,

 

Thanks for the help - that seems to have sorted out the problem!

 

Cheers

0 Kudos
Message 3 of 8
(3,278 Views)

Hi again,

 

unfortunately I've run into some more issues - the solution from before seems to work for a while when the program is started (much longer than it did in the first version that I posted on here), but then I get the same error (Error - 200290). Have I implemented the solution incorrectly, or is it something else this time?

0 Kudos
Message 4 of 8
(3,248 Views)

Hello jgair,

 

  • You are using notifier not queues.
  • Acqusition and generation are in the same loop.
  • Clean Up the Block Diagram
  • Make SubVI´s
best regards
Alexander
0 Kudos
Message 5 of 8
(3,241 Views)

Hello jgair,

 

attached a modified VI with a new architecture inside. I think the problem was the samples you are generation do not match the samples you are writing.

best regards
Alexander
0 Kudos
Message 6 of 8
(3,233 Views)

Hi,

 

Thanks for the help - in what way did the samples being generated not match the samples being written?

 

Cheers

0 Kudos
Message 7 of 8
(3,223 Views)

Hello jgair,

 

Generation is set to fs=1000 s#=1000 -> one second of data

Writing is set to rate=100000 samples=10000 means -> 100ms to write

best regards
Alexander
0 Kudos
Message 8 of 8
(3,219 Views)