Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Frequency Control of NI-9476 on the cDAQ-9188

Solved!
Go to solution

I am using a cDAQ-9188 with a NI 9476 module, and I would like to control the frequency of the digital signals that the module is outputting. I have tried to use the Continuous Digital Pulse Train example with frequency control, but the 9476 cannot be selected since there is no internal counter, and when I change the task to "Digital Output," the frequency control disappears. Is there any way to use the chassis's internal counter to control the output frequency of the 9476? I need to output a range of 0 to 1 kHz.

 

The gist of my program would be to output a digital signal of a certain frequency every second in real time, from a given array. For example, if I have an array of [10, 20, 15, 100, ...], it would produce a high-low pattern of 10 cycles per second for a second, followed by 20 cycles (with a shorter period) for a second, then 15 cycles per second for a second, and 100 cycles per second for a second.

 

I tried to use software timing to do this, but it was very slow, with a delay of 63 ms between each cycle, when I had desired a 1 ms delay.

0 Kudos
Message 1 of 5
(6,923 Views)
Solution
Accepted by topic author ruthnan

The cDAQ-9188 has 4 counters built in, but you cannot access them using the NI-9476, but the NI-9401 module can access the built in counters.

 

The good news is that you can still generate your pulse train, using the counters, generating it on the PFI lines on the chassis itself, and not through your module.  If you need to generate more than one pulse train, or to utilize all four of the counters, you will need the NI-9401/9402 module.

 

In order to get the speed you will need to use the hardware timing capabilities of the counters.

 

Hope this helps!

 

For further reference:

https://decibel.ni.com/content/docs/DOC-12161

http://www.ni.com/white-paper/9384/en



Systems Engineer
SISU
Message 2 of 5
(6,890 Views)

Hi Nathan,

 

Thank you for your reply. I have two follow-up questions.

 

1) Does that mean if I use another module that is software-timed, but I used the DAQ Assistant to generate the signals in a loop, I will get an error saying that the property is unavailable? The exact error says, "Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property." The sub-vi works by itself, but when I put it into the larger vi (EventRecorder_Speed), the program fails.

 

2) I tried to combine a digital pulse train example where I could continually update the frequency and a correlated digital write with counter example where I could output a signal whose frequency is determined at the beginning. The desired vi (Combine_dig pulse train_correlated dig write) is one that uses an internal counter, where I can control the frequency of the digital signal while the vi is running. When I run this vi, it just puts out a signal for a second and then goes low for the rest of the time even though the vi is still running.

 

Does anyone have any idea on the best way to do the latter? In case you want to run the first vi, I have attached the csv file that you need to have as your input file.

 

Sincerely,

 

Ruth Nan

0 Kudos
Message 3 of 5
(6,883 Views)

(Note, I am a different Nathan from Nathan-P 🙂 )

 

Hi Ruth,

 

I noticed your post and thought I'd take a look at your code. Why don't you try putting a DAQmx Stop Task after the DAQmx Is Task Done and also put a DAQmx Start Task after the DAQmx Channel Property Node? You might also want to put the frequency control inside the while loop instead of using a local variable. You can just use a constant for the frequency input of the DAQmx Create Channel. My thinking behind this is that you can't change the frequency while the task is running, so if you stop it, change the frequency, and then restart it again, maybe that will work. 

 

Just a thought!

 

Regards,

Nathan S.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(6,852 Views)

For anyone who wants the solution, I simply had it on finite number of samples, when I should have set the mode to "continuous samples." Also, I controlled the property node through an array by using the loop index to get the element at a certain index of the array inside the loop.

 

test3.vi - control using an array, outputs a signal of a given frequency in the array for a second then gets the next value and repeats

test.vi - real-time control using the frequency property on the front panel

0 Kudos
Message 5 of 5
(6,812 Views)