Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating an analogue output from a digital input using NI9426 & NI9264

I am looking to develop a setup in Labview where I can view a digital pulse input from a speed sensor, display this value and then output a scaled analogue voltage corresponding to that speed. For example 0rpm would be 0V and 1000 rpm would be 5V. I am using a NI9426 as a digital input module and a NI9264 as the analogue output module.

 

Any advice would be greatly received, I am pretty new to this NI game!

 

Thanks,

 

Richard

0 Kudos
Message 1 of 6
(5,789 Views)

9426 is not applicable in scan mode in this case, since scan mode maximum sampling rate is just 1k, and 9426 doesn't support frequency measurement in scan mode. You should start with LabVIEW FPGA. A lot of example is available in Help>>Find Examples>>Hardware Input and Output>>CompactRIO. Study FPGA examples in FPGA Fundamentals folder, and study examples in Module specific folder as well.

Message 2 of 6
(5,780 Views)

Hi r.youden,

 

I wrote a commented piece of code (DI to AO zip file) that I think performs what you want to do. I simulated your cRIO FPGA target and C-Series modules in my project. If you don't know how to do this, have a look here http://digital.ni.com/public.nsf/allkb/F466AD83D24F041D8625714900709583 .

 

As KateB mentioned, I too encourage you to have a look through the LabVIEW examples found at Help > Find Examples (If you run LV 2012 or earlier you'll be able to see many more examples than in LV 2013. In 2013 all the old examples that didn't adhere to a certain standard have been removed). For your application, I think that the following examples would be useful: 1. Hardware Input and Output > CompactRIO > Module Specific IO > Digital Input > NI9375 Digital Line Input and Output and 2. Hardware Input and Output > CompactRIO > Module Specific IO > Analog Output > NI9265 Getting Started.

 

If you are interested in learning more about LabVIEW and programming FPGA with LabVIEW you can contact your local NI branch and ask for the respective training courses.

Message 3 of 6
(5,766 Views)

Petru & Kate,

 

Many thanks for your suggestions. I am limited with the hardware I am using, I have the NI9264 module in a USB cDAQ which I believe does not have any built in counters, making frequency caputre more diificult / impossible. Would that function be easier if I purchased an NI9401 which has 4 built in counters?

 

Many thanks for your help.

 

Richard

0 Kudos
Message 4 of 6
(5,759 Views)

Hi Richard,

 

No matter what type of cDAQ you have (1, 4 or 8 slot), it should have 4 general purporse 32 bit counters. The counters are on the cDAQ chassis not on the C-Series modules. Hope this helps.

 

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

Hi Richard,

 

Sorry for my previous post. I realised that not all C-Series modules can access the counter source and gate lines on the cDAQ chassis. You are right, the 9264 cannot access the counters, and a more suitable choice would be the 9401. You can see which modules can access the counters here http://digital.ni.com/public.nsf/allkb/3114EE73A39F1300862578BE0059A895 , perhaps a module other than the 9401 is more suitable for your application.

 

I wrote a piece of code (cDAQ - Frequency measurement and AO zip file) that I hope will measure frequency accurately as long as your pulse train rate is less than 1 MHz (I actually just slightly modified an example code in the NI Data Acquisition course).

 

The code works like this: LabVIEW automatically attributes an internal clock (80 MHz, 20 MHz or 100 kHz - depending on the rate of your pulse train) to the Source input of the counter you are going to use (let's say ctr0). Then, what you have to do is wire your pulse train to the same counter's Gate input. The counter increments every clock cycle but only when the gate is high, and by doing so the code gets the your input's pulse width. From then on, LabVIEW automatically gets the period as well, and converts it to frequency. By looking here - http://zone.ni.com/reference/en-XX/help/370466V-01/device_pinouts/9401cdaqpinout/ - you can see that in a 9401 ctr0 gate is pin 16, so you will need to wire your digital input to that pin. 

 

However, perhaps a module other than the 9401 is more suitable for your application, have a look through the list in the link.  

 

PS. What cDAQ chassis are you using? If you are using the 9172 be aware that the counters can only be accessed by modules in slots 5 or 6. Otherwise, all slots should provide access to counter lines. 

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