LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-6221 pwm on separate 24 channel outputs

We have a PCI-6221 board and want to produce 24 separate 100 hz pwm signals. All 24 signal will be at the same frequency but they will all have different duty cycles. What is the best way to develop these separate 24 pwm signals?
0 Kudos
Message 1 of 10
(4,493 Views)
hei,
 
i am not familiar with the word "pwm". explain.
 
i guess you want to use the DIO signals, at 100Hz? this card has about 1MHz frequency. therefore depending on the accuracy of your waveforms, you can go to lower time base.
Once this is set, you can use DAQmx for addressing either all channels together, or one at a time. i would opt for the "1-channels n-samples", where your 1 channel is actually the whole combination of the 24 ports out.
 
in order to do that you will have to compute in advance (or at same time as you output to buffer), the whole 24bits for each cycle. that is one reason you might want to lower your timebase - lots of computation.
all you have to do now, is create a subvi wich will create 24 rows lists of values. the list will be following your timebase, say 1MHz.
then, assemble all columns into 3 words (3*8bytes), or one 32bit long. that will depend how you enter the data to DAQmx.
at the end you expect to have a single 1D array with all info for all 24 channels at a specific time. you enter that into buffer and start task.
 
for futur implementations, say if you want to do that for 100s of seconds, you will have to regenerate those function while it is running. we will get there as you finish the first step.
 
Is it helpfull?
Gabriel
 
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 2 of 10
(4,490 Views)
The 6221 has only 8 timed digital outputs!
You'll need a 6224 for this!

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 10
(4,483 Views)
Hei Toni
 
this is from NI site:
it definitely has 24 DIO
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 4 of 10
(4,482 Views)
Yes I know (have them here),

but only port 0 (8 lines) is able to be clocked (or correlated). A function you def. need if you want to do a PWM function.
The other lines can only be software timed.

Ton

Message Edited by TonP on 05-01-2007 11:28 AM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 10
(4,482 Views)
Hi Everyone,

It sounds like we have an answer here already, but I thought I would elaborate a little. 

The application requirement for timing accuracy will determine whether correlated digital I/O is required or if software timing will be sufficient.  To achieve accurate and reliable timing, correlated digital I/O or counters are a requirement.  You will need additional or alternative hardware as suggested.

If timing is not critical software timing may be an option. I will outline the theoretical performance and a possible method in case this is an option.  Software timing is the fancy name for outputting a single voltage update to your channel(s).  The smallest delay you can specify in LabVIEW (to control the timing) is 1ms.  For a frequency of 100Hz this means roughly 10 updates per period, and therefore a resolution of 10 percent (i.e. 0, 10, 20, 30... percent duty cycle settings).

Keep in mind that this is all software timed and therefore slight variables such as other programs running in the background, user interaction with the mouse or keyboard and different computer speeds can affect the timing of the signal which actually appears at the output.

In case you want to test software timing, the easiest way I see to program this is to loop 10 voltage updates with a delay of 1ms.  Each channel would have a ten sample array which would determine the duty cycle.  For example, 2 high values followed by 8 low values would give you an approximate duty cycle of 20 percent.  I say approximate because you may find it varies in both the frequency and duty cycle due to the nature of software timing.

Regards,

Jennifer O.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 10
(4,458 Views)

Jennifer,

       Software timed should be fine. Do you have an example for the PCI-6221 with LabView 7?

 

 

0 Kudos
Message 7 of 10
(4,455 Views)

You can find an example which was created by one of my colleagues for a single channel in the discussion forum post Generating a PWM using USB 6008

This example was originally created in a current version of LabVIEW, however a LabVIEW 7.0 copy has been posted later in the discussion.  This will give you the basic concept.  You will need to modify to expand the channel count and change the number of samples to get the appropriate frequency (right now there are 100 samples at 1ms which will give a 10Hz pulse).

I recommend reading through the above post as there is a good discussion on the limitations of the software timing methodology.

I hope this helps,

Jennifer O.

 
0 Kudos
Message 8 of 10
(4,443 Views)

just a tought...tell me if it make sense:

since there is a NI card with a clock of 1MHz, one should be able to use it as the time source in a timed loop. from there to actually make output pattern at a rate faster than a 1ms should not be too difficult.

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 9 of 10
(4,426 Views)
I think that the timed loop approach will fail (has to be tested though, nice thought).

I believe this will take longer than 1 ms.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 10 of 10
(4,422 Views)