11-18-2009 04:30 AM
I'm currently generating a signal with the NI 4461 card enclosed in a PXI chassis. I would like to modify dynamically some characteristics such as frequency, amplitude and so on, without stopping my task. By doing so with an event structure, an error (referred as -50103) occurs.
Thanks for your answers.
11-18-2009 07:57 AM
11-18-2009 08:36 AM
Thank you for your answer,
please find the attached file containing a modified version of my VI. In order to keep my program from generating errors, I have added a "Stop task" VI. But of course this is not the normal behaviour I would like to implement as you have understood from my preceding message. I hope you will find more insights concerning the problem I'm confronted to.
11-18-2009 08:49 AM
Sorry, but there are several issues with your VI.
First and imho most important point is:
Do not mix event based programming with "classic" state machines in the way you did. This will lead to code which is difficult to maintain.
Second point:
Why do you split the creation of the task (which contains timing) and setting of trigger and additional timing info? This makes no sense.
Third point:(This is propably the most important for you)
You have to know that there are properties which can be changed while the task is running, but most are not. So you have to define:
- What properties are needed in order to change the output to the desired new setting?
- Which of those properties are changable during runtime?
Please note that i don't see any parameters you want to change.....so please let us know.
Norbert
11-18-2009 08:50 AM - edited 11-18-2009 08:51 AM
I don't speak French, so I don't understand the label and enum strings in your code, but I've taken a quick look at your vi.
The Timeout case of your event structure has a Default on the state machine terminal. This perhaps means that 100ms after your task starts, you change to the Paramétrage de la waveform state, which means the DAQmx Clear Task subvi does not ever get called.
11-18-2009 10:12 AM
11-18-2009 10:20 AM
The parameters I would like to change dynamically are frequency, amplitude of the waveform and the number of samples (named "nb éch." on the front panel) from which the VI calculates the sampling rate.
Concerning the points you pointed out, do you think it may be useful to use a state machine with a queue for example?
11-23-2009 02:35 AM
I am wondering why you want to change the namber of samples per waveform during runtime. Why is that?
Changig the frequency is easy if you use an external clock. Simply increase the external clock to increase the signal's frequency. If the DAQ device you are using has an onboard counter available, you can use this as external clock source. You can change the frequency of counter outputtasks "on the fly" (during runtime).
If you want to change the amplitude or shape of the signal, this is a bit more tricky. This requires non-regenerating buffered output, examples for this are available. The catch is, that you have to make sure to "refill" the buffer right on time. If you mess that up, you will receive an error.
hope this helps,
Norbert