LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is the generated wave frenquency diffrerent from the set frequency in the program?

Solved!
Go to solution

Hi Bob,

 

Please see the belowing figrue

Capture12.PNG

 

Thanks,

Mei

 

0 Kudos
Message 31 of 38
(1,615 Views)

M.Mei, can you post yours? The error that you're getting could not happen with your previous code. 

 

You're not trying to run your code with the run continuously button, are you?

 

 

0 Kudos
Message 32 of 38
(1,605 Views)

Hi johntrich,

 

No, I did not run the code continuously. I only change the sample mode and auto start mode.

 

Thanks,

Mei

0 Kudos
Message 33 of 38
(1,596 Views)
Solution
Accepted by M.Mei

Hi M.Mei,

 

I apologize for the delayed response. I had missed your response. You do also need to connect the # of samples to the DAQmx Timing. This should fix the error.

0 Kudos
Message 34 of 38
(1,570 Views)

Hi johntrich,

 

Thanks. Yes, it works! But can you please explain a little bit the reason? I searched this error in the forum, and tried to solve it by myself according to other posts, but failed. So, I hope to understand it rather than only solve it. Thanks.

 

Thanks,

Mei

0 Kudos
Message 35 of 38
(1,559 Views)

Hi M.Mei,

 

There were two basic changes to be made. First you had the acquisition set to run continuously but were only reading once. If you want to continuously acquire then the read needs to be in a loop, and the number of samples to be read would be chosen there. Your program would reach the wait until done and would never be done. Since there was no timeout it would get stuck there. However, it never got there because of the other error. On the DAQmx Write you had selected auto-start as TRUE. This starts the task. In the next box you add a start for the task on the first call. Since the task is already started an error is thrown. The choices were either to get rid of the TRUE or to get rid of the explicit start. In this case either one would work. I tend to like to use explicit starts.

0 Kudos
Message 36 of 38
(1,554 Views)

Hi johntrich,

 

Sorry for the late reply and thanks for your explaination. I can understand the second problem, and for the fisrt one, I got puzzled. Also, I tried to make this program can run continously, so I used two ways: one is pressing the 'run continously' button- working well; the other is putting this program into a while loop- got some problems, 1. the time count does not work;2. x signal missing in the sencond loop. Error-200288 occurs when debugging, but no error comes out when running the code. I wonder  are these problems related with the first problem before which I cannot understand?  

second.PNG

 

Thanks,

Mei

0 Kudos
Message 37 of 38
(1,519 Views)

Try setting your Sample Clock timing to Continuous Samples rather than Finite Samples.

You're setting the clock up to only output "Number of Samples" samples, and then each loop iteration you write that many. So on the second loop, you're writing past the expected number.


GCentral
0 Kudos
Message 38 of 38
(1,511 Views)