PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

6602

Hello, everyone:
 
I just started to learn to use PXI-6602. I would like to generate three pulses in three channels at the sametime. However I do not have the external trigger signal. How can I trigger them synchronously.
I have a output signal from comparison (LabVIEW software comparison). When the output of this comparison is "1", I should trigger the pulse generating counters in PXI-6602. How can I realize this function. Please give me some suggestions. Thank you very much!
 
Jingwei
18/09/2006
0 Kudos
Message 1 of 14
(5,454 Views)
Jingwei,

The key is to combine all three counter tasks into one.  When you create your DAQmx Task, you can place multiple counters in the same task and when you start the task all three counters will start at the same time.  So inside your while loop, place a DAQmx Start Task inside a case structure.  When your value hits "1" the LabVIEW comparator can set the case structure to "True" and start your DAQmx Task thus starting your three counters. 

A word of caution, you can only start your task once.  This means that once you start your task, you will need to think of a way to set your case structure to false and keep it false. If your while loop tries to execute the Start Task vi twice you will get an error.  Try it out and let me know if you run into any obstacles.

Best Regards,

Jeff Tipps
Applications Engineer
National Instruments
0 Kudos
Message 2 of 14
(5,445 Views)
Dear Mr Jeff Tipps:
Thanks for your answer.
Now I use 6602 to generate two channel controllable PWM signals. First I generate a 100Hz ramp signal with 0-2*pi amplitude. Then I compare this signal with a few of constants such as pi/6, 5*pi/6, 3*pi/2...If the ramp output value is greater than pi/6 and lower than 5*pi/6, the comparator output is true, otherwise its output is false. If it is true, the duty cycle of in channel0 PWM generator is 0.5. If it is false, the duty cycle is 0.001 (approximate 0). The channel0 PWM generator is working in continuous sampling. the frequency is fixed to 5KHz. I use PXI-4472 to acquire the PWM signals.
Because the frequency of the ramp signal is 100Hz and amplitude is from 0 to 2*pi. so the period of this signal is 10ms. The window of generating PWM signal shouls be 10/3 ms(about 3.33ms). I have check the output of comparator which have the same frequency and period with the ramp signal. However, The window period of PWM signal is longer than expected (more than 13ms). I can not solve this problem. Please give me some help. Thanks very much.
The labview program and waveforms are attached to this question.
 
Best regards1
Jingwei Zhu
26/09/2006
0 Kudos
Message 3 of 14
(5,429 Views)

Dear Sir:

The expected waveforms is attached to this reply.

Best regards!

Jingwei Zhu

26/09/2006

0 Kudos
Message 4 of 14
(5,427 Views)
Jingwei,

Your math looks good, the window should be about 3.33ms.  I have a theory as to why you are seeing a window that is longer than expected.  You are controlling the PWM with an analog input signal.  This input is a buffered acquisition.  Your rate is set to 80kHz and your number of samples is set to 1000.   You can calculate how long it would take to fill 1000 samples at 80kHz by dividing 1000 by 80k.  You will notice that it takes 12.5ms just to fill the buffer.  Then you have to pass the buffer to your code and process it to determine PWM, which could take a few ms more.  We can confirm this with a simple test.  If you decrease your number of samples in your analog input task, does the period of your comparitor window also decrease?  Furthermore you should be able to sample faster than 80k with the PXI-4472.  This should also decrease the window period that you are reporting.  Test it out and let me know the results, then we can try and find a solution.  We may need to try something like a single-point control loop approach but the DSA cards do not support that.  Do you have any other analog input hardware?

Best Regards,

Jeff Tipps
Applications Engineer
National Instruments
0 Kudos
Message 5 of 14
(5,408 Views)

Dear Mr. Jeff Tipps:

Thank you very much for your reply.

I have checked my LabVIEW program. The ramp signal does not come from the outside analog input. I generate it with labVIEW signal generator. The sampling frequency is 40KHz (when experiment I set it to 80KHz) and I only get one sample at each loop. I have checked the comparator output signal in waveform chart2. The period of this waveform is about 3.33ms.

After I change the number of samples in analog input task (4472) to 100, I measure the window time with PWM signals using Tetronix oscilloscope. The window time is about 300ms. It is longer than 3.3ms.

My hardware is PXI-8196RT with PXI-4472 and PXI-6602 cards and. The PXI-8196RT is connected with a host PC(PXI-8196 controller). I develop and run my program in the host PC. I donot have any other card.

I would like to use these hardware to control brushless permanent magnet AC motor. I measure the rotor position signal with encoder (like a ramp signal), then according to rotor position to generate six channel PWM signals. Are there any examples to realize this function with LabVIEW PXI card?

Thank you for your time!

Best regards!

Jingwei Zhu

 

 

0 Kudos
Message 6 of 14
(5,402 Views)
Jingwei,

Can you please resubmit your code?  The zip file that you first attached only had subvi's that setup the DAQmx channels.  When I opened the project, there were some vis listed there that were not included in your zip file.

Thanks,

Jeff Tipps
Applications Engineer
0 Kudos
Message 7 of 14
(5,393 Views)

Dear Jeff Tipps:

I am sorry I did not include total files. The files is attached to this reply. The main labVIEW file name is PWM_control_926.VI

Best regards!

Jingwei

0 Kudos
Message 8 of 14
(5,385 Views)
Jingwei,

I looked at your code and discovered why your are getting a window of 200ms.  Everything depends on the Fs setting of your ramp signal.  If you run it with Fs set to 40k, your graph says that the period is 10ms, but that is only a simulated signal.  Notice if you actually look at your meter while the program is running and count, the meter has a frequency of about 1 cycle per second.  If your ramp signal was actually going at 100Hz, then the needle on the meter should jump back and forth 100 times per second not just one time per second.  Now notice if you set Fs to 10k but keep your frequency constant, your ramp signal actually speeds up!  The top loop is generating simulated data while your AI loop is reading actual data.

Lets talk about what Fs is actually doing.  Your top loop generates one sample at a time at a rate of 1ms.  This means that no matter what you set Fs to, you are still generating one sample per loop iteration (which is 1ms).  So what is Fs actually changing? It is changing the number of points per cycle.  If you set a really high Fs, then each cycle will have more points than if Fs were lower.  The VI is simulating what a waveform would look like if you sampled a 100 Hz signal at a rate of 40kHz.  It is not designed to produce a real-time 100Hz signal.  So to make your window the correct time, you will need to adjust Fs.  I modified your project to display actual loop times.  Even though you set all the loops to 1ms, you will see that your operating system cannot process all four threads of your code that quickly.

So if you run my modified code you will notice that the encoder loop is actually running about once every 2ms.  Divide 40k Samples per second by 100 Cycles per second and you will get 400 Samples per Cycle.  400 Samples created at 2ms each equals 800ms per cycle.  This translates to an actual frequency of a little over 1 Hz.  I have to turn my Fs way down to approach anything close to 100Hz.  In fact with my Fs turned down to 400,  (4 Samples per cycle at 2ms per point is about 125Hz) my machine cannot work fast enough to keep an even window.  Look it over and let us know what you think.  It may be that a real time system is the only thing that will enable us to have control loops of the speed you desire.

Best Regards,

Jeff Tipps
Applications Engineer
Message 9 of 14
(5,371 Views)

Dear Mr. Jeff Tipps:

Thank you for your reply.

I have understood your explaination and the reason why my window time was too long. When I ran your modified VI in low Fs, the window was not in same width. 

In real time motor control, I would like to acquire encoder information by PXI-6602. Then by comparing the encoder information with constant such as pi/6, 5*pi/6, 3*pi/2....,I can generate control windows in which the PWM signals are produced. The frequency of encoder signal is about 100Hz. I am not sure if my hardware can fulfill my function. I wonder what is the maximum sampling rate of the encoder acquisition by 6602. My hardware includes PXI8196RT, PXI-6602 and PXI-4472.

If I use outside signal to trigger the PWM generator, I only can generate fixed number of pulse. I would like to know that can I trigger and stop pulse generator by outside signals. For example, the rising edge triggeres it and falling edge stops it. 

In your reply you said the real time system is the only way to meet my control loop rate. What does the real time system mean? Is it not my hardware mentioned above?

I am a new LabVIEW user. Please give me some suggestion for my control requirement.

Thank you very much!

Best regards1

Jingwei Zhu

0 Kudos
Message 10 of 14
(5,358 Views)