LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware Timing at varying frequencies

Hi,

 

What I'm trying to do:

I have a NI 9472 card and want to be able to have each pin generate a square wave. Id like to do this using hardware timing. I tried software timing but it is only accurate to around 20Hz before it starts getting bad. I'd like to have one slider per pin and be able to control the freq. of each pin individually. I can get this working for the whole port. In the 2x1 array of waveform data, I can control the entire port. 

 

For example, 3 (0b 0000 0011), lights up two of the lights or changeing the array value to a 15 (0b 0000 1111) would turn on 4 pins. 

 

Problem:

I cannot seem to control the frequency of each pin individually. As soon as I added the second loop (as shown in attached VI), only the first loop runs and only at the defaulted speed. I'm guessing this might be the wrong way of trying to do this, but please let me know how I could have each pin generate a sq. wave, each with a different freq. 

 

Also, I know I can increase the waveform data array to say 4x1. then have pin 1 be (on, on, off, off) and pin 2 (on, off, on, off) and manually hardcode frequecies in this way. But these frequencies are not dynamic enough. I'd really like to have a slider for each pin's freq. if that is possbile. 

 

Please let me know the best way to proceed, or just edit the attached VI and explain where I'm going wrong?

 

Thanks!

0 Kudos
Message 1 of 3
(2,290 Views)

Any clocked digital output lines (on what presumably is your 9188 based on your attached code) have to be in a single task (you should be getting a resource reserved error on one of the tasks) since the chassis only has one timing resource for clocked digital output.

 

The 9188 does have 4 counters that can be routed to the 9472 outputs.  You can configure a counter output task on each of them, and control frequency independently on each task.  However, this is only 4 lines, not 8.

 

If you need more than 4 channels, you'll have to do it with the digital outputs like you described (building the proper waveforms for your intended frequencies dynamically).  I wrote a simple example a long time ago that does this--I haven't looked at it in a while though so I'm sure there are some tweaks that can be made.

 

 

Best Regards,

John Passiak
Message 2 of 3
(2,270 Views)

Thanks! I'll look into this - I'm guessing this will solve my problem. If I have any questions I'll let you know. 

 

Thanks again!

0 Kudos
Message 3 of 3
(2,242 Views)