Showing results for 
Search instead for 
Did you mean: 

1D array to generate signal myDaq

I want to generate one cycle of a sine wave that has 100 data points. I have done that and graphed them. I now want to use those same data points and output them to AO0 to generate a signal. I then want to acquire that data back via AI0 and graph it. I'm only acquiring one data point with the code I got now, and my graph is blank. I want to use 1 sample on demand but doing trial and error when I do generate N samples a graph does appear. When I use the original data without indexing the array, I get the error the number of channels in data 100 and the number of channels in task 1. I know this is because the number of data points doesn't match. I know the solution is simple but I can't seem to grasp it right now.


mydaq 1.pngmydaq 2.png




0 Kudos
Message 1 of 5

Obviousoly, you should start with a few basic LabVIEW tutorials before involving external hardware.


Some quick comments:

  • Your loop has a fixed number of iterations, so it should be a FOR loop.
  • Of you would place the write and read function inside your FOR loop, you don't need any other loops.
  • Your AI input and AO output have no data dependency so both execute simultaneously or in arbitrary order (Sorry, I don't have and drivers installed, so I cannot look at your assistant configurations). You probably want them to occur in sequence, so use an error wire from AO to AI to force execution order.
  • If you get one AI point per iteration, you should autoindex at the right loop boundary to get all values.
  • Don't you want some timing?
  • Do you really think it is reasonable to repeat the inner FOR loop and generate the same data with every iteration of the outer loop?
  • Please don't maximize the front panel and diagram window to the screen!
  • etc.
0 Kudos
Message 2 of 5

See if this can give you some rough ideas ....




0 Kudos
Message 3 of 5

I tried putting it all in a for loops. I tried separate for loops. I'm getting data points now but they're in a 2D array and the graph still doesn't show. I tried separating the arrays to get a 1D array but that still didn't work for me.

mydaq 3.pngmydaq 4.png

0 Kudos
Message 4 of 5

Set the "from dynamic data" to output a scalar.

0 Kudos
Message 5 of 5