09-06-2008 08:23 AM
09-08-2008 05:09 PM
Hi trushs,
Thanks for sharing your application in the forums. You are right in that if you want to reduce the time between iterations of the loop, it is better to create the channel and set the timing parameters outside of the loop. I see in the screenshot, that you have a Clear Task vi inside of the loop, did you have this vi when you had the Create Channel and Timing vi outside? I’m asking because this might be part of the reason why the output is flickering. If not, please give us more information on what you mean by flickering. At this point, I recommend having a look at some of the shipping examples to start your program from it. The examples can be found in LabVIEW, going to Help > Find Examples. The Cont Gen Voltage Wfm-Int Clk-Non Regeneration VI is a good VI to start from. In this example, you can delete the desired waveform generation and replace it with your waveform. You will notice that in this vi, the channel is created and the timing parameters are defined outside of the loop, also the Regeneration Mode property is set to Do Not Allow Regeneration. So in this case you will need to continuously provide the new data that you want to generate in the output.
trushs, in the picture of your application, I’m not sure what the subvis do, I see that you generate a number that is at the same time your Amplitude and Offset. Since you mentioned that you are sending a sine wave that changes frequency, if that is the goal of your application you might want to look at the Cont Gen Voltage Wfm-Int Clk-Variable Rate VI. In this case the changes to the frequency of the output signal are done by changing the update rate of the Analog Output task. That might be another way to accomplish your application. I hope this is helpful, please let us know if you have more questions related to this issue. Have a nice day,
09-08-2008 08:29 PM
Hi,
Thank you for replying. I had already gone through the examples and finally I have rebuilt my vi. My timing of the loops are also perfect. But now I am trying to synchronise the two loops.
I have kept the analog output and analog input separate, used the example of 'do not allow regeneration'. When the two loops are separate I have used a trigger to make the loops start at the same time. I tried using timed loops for managing my multi rate loops but although the vi runs I get no output. I used single steppping to check what could be the possible error. It seems the vi does not enter the timed loop at all. For the timed loop I have used the timing sourse of analog input and then I am dividing it for analog output. So, I have still not come with any solution for timed loop.
Another thing I tried for synchronisation was use the AI-AO example from the help section. However, I get an error saying Error 200279, which in a way makes sense because my reading is much faster. But then the example is meant for synchronising between AO-AI with different rates. So, why doesn't it work in my case?
One more problem I am facing is that when I use the vi on my pc it works fine, but when I use it on the laptop with the NIDAQ 6036E, its not able to write so fast and tells me to reduce the sampling rate of writing, which is well within the limits of the card.I need a sine wave from 1-10 Hz. So, if you could suggest me some solution.
PS: My sub-vi basically does some mathematical calculations and returns the amplitude.
I am attaching the vi where I have kept both analog read and write in the same loop.
09-10-2008 10:43 AM
Hi trush,
I’m glad to hear that you were able to rebuild your vis and get the timing correct. First, let’s work on the problem where you get no Analog Output. I’m confused on what you mean when you mentioned that the vi does not enter the timed loop at all. I tried running your code at my end, and the vi executes and enters the while loop. After some time running I get error -200279 occurred at DAQmx Read, as the reason of the error explains we are trying to read samples that are no longer available. I noticed that you have defined the number of samples per channel equal 10, so we are not reading the samples in the buffer fast enough and they are being overwritten before we read them. There are several solutions for this case, as pointed in the error box, we can increase the buffer size, increase the frequency at which we read the data or we can increase the number of samples read every instance. I assume that you want to keep the current frequency of reading so the most convenient solution would be to increase the “number of samples per channel” in the DAQmx Read vi. Is there a specific reason why you need to retrieve 10 samples every instance? You might try retrieving more samples, maybe 100, every instance and the buffer will be read faster.
Now, related to your second question about running the vi in a laptop. Are you trying to run this same vi that has the AI and AO tasks synchronized? If so, you might want to try the changes suggested before and try to run it again. If you are trying to accomplish a simple Analog Output with another vi or one of the examples, what rate do you have the sample clock configured to? Please give us more information on the specific error where it asks you to reduce the sampling rate. If it is within the limits of the card, you should have no problems creating an analog output with the DAQCard. Finally, the frequency of the output signal depends mainly on three factors: the update rate, the number of points in the buffer and the number of cycles in the buffer. So changing these parameters you can change the frequency of your output signal. Have a look at this Knowledge Base article that clearly explains this concept. Have a nice day,
09-10-2008 11:57 AM
Sorry about the timed looped thing.....I got everything working now. My timed loops are working, there is proper synchronisation. However, I am curious to know one thing.....why does'nt the example on AI-AO synchronisation work on labview 7.1. Its meant to snchronise between two channels operating at different frequencies so why doesn't it work? I tried using it on my friends pc where he is using labview 8.1 and it works fine. So it would be great if I could synchronise using only one loop instead of 2 timed loops.
09-11-2008 03:12 PM
Thanks for letting us know that everything is working. The synchronization example should work on LabVIEW 7.1 as well. Are you trying to use the LabVIEW 7.1 shipping examples? Or are you trying to run the vi you tried in LabVIEW 8.1 to work in LabVIEW 7.1? A vi built in a higher version won't run in an older version of LabVIEW. So you will have to run a vi developed in LabVIEW 7.1. If this is what you are doing already, can you share more details on how it doesn’t work? Is there a specific error showing up, or the vi runs but you see no output? Also, do you have the same hardware in both computers that you have tested the vi? If no, what hardware are you using in each case?
09-14-2008 08:53 PM
Hi,
I have a small doubt. I amusing timed loops for my synchronisation of analog write and read. For analog write the Update rate is 400Hz. For analog read the sampling frequency is 2Khz and I am reading 10 samples at a time, thus it becomes 200Hz. I am using the timing sourse of analog read for my timed loop. I wanted to know what period should I set for both of the timed loops?
09-17-2008 04:40 PM
Hi trush,
I’m confused about your question on what period to use for both timed loops. When I look at your previous code (sync.vi), I just see one While Loop structure. Are you referring to the same application or is this a new application you are working on? Is there a specific reason why you need to set the two tasks in separate loops? What exactly do you want to accomplish by defining the period of the loops? I’m asking this because you don’t necessarily need to define the time between iterations of the loop. You can simply have both loops with the DAQmx read and DAQmx write function inside, respectively. If you want to synchronize the acquisition and generation you can continue working on the previous example. Configure the Analog Input, Configure the Analog Output, configure a master-slave architecture where you make sure the slave task is armed before starting the master and share the same trigger to start both tasks. trush, I hope this is helpful, let us know if this is not the case. Have a nice day.