LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Encoder in labview

Hi,

I have NI-9215 and NI-9263 cards with out counter and I want to use this card to read Encoder (Maxon5540) pulses(2000/revolution) in Labview and I have an other sensor whose output is 7 Volt or 5 Volts and I want to read Pulses When sensor's output is 7 Volt this card has 4 analog input channels (No digital channel). Some body please tell me how can I read Encoder Pulses in labview.

 

Best Regrds,

Talib Hussain.

0 Kudos
Message 1 of 9
(6,928 Views)

Hey Talib Hussain,

 

Here is a link which I think will be useful for you:

 

https://forums.ni.com/t5/Example-Code/Measure-Linear-Two-Pulse-Encoder-in-LabVIEW/ta-p/3526161

 

it's a basic example of using DAQ to measure a two pulse encoder position.

Sam S
Applications Engineer
National Instruments
0 Kudos
Message 2 of 9
(6,911 Views)

 

Dear Mr Hussain,

Thank you so much for your post on our web forum. The modules you mention have a few options;
- you have them in a single sleeve (one module in a carrier like the USB 9163 carrier)
- or you have them in a chassis like the USB 9172, 9174 or 9178; https://www.ni.com/en-us/shop/model/cdaq-9178.html
Those chassis have multiple counters onboard, when you add a hardware timed (!) digital IO module you are able to connect to these counters
- or these modules are inside a compact RIO (real time and FPGA) embedded system
The last option doesn't have a counter, but you can implement the counter it self on the FPGA, and there is an example from this. You are able to use the example on windows as well; what you want is to have a software counter. The following needs to be added; you need to convert your analog signal to pulses; please use continuous sampling and based on the sample rate you can decide your time line, for example 1000 samples per second, if you reed per 100 samples you have a time line of 100 ms.
With the counts you need to decide your position; those two things needs to be added, the attached VI represents the counter of the DAQ card. It will not be easy to implement, but it is possible. I hope if you chose this direction (but please be aware of the disadvantages of software latencies) this will give you a jump start.

Best regards,

 

Martijn S
Applications Engineer
NI Netherlands
0 Kudos
Message 3 of 9
(6,884 Views)

Dear Sir

           I have NI-cDAQ-9172.

Regards

Talib Hussain

0 Kudos
Message 4 of 9
(6,882 Views)

Dear Mr Hussain,

 

then adding a hardware timed dio module (like the NI 9401 ) to your system (slot 5 / 6) and connecting to this module will save you a lot of time; again in software isn't impossible but your system needs to keep up with your measurements and doing the calculations.

 

Best regards, 

Martijn S
Applications Engineer
NI Netherlands
0 Kudos
Message 5 of 9
(6,877 Views)

Dear Mr Martijn,

                        I have another problem DAQ with 9251(NI c Daq 9172) I use simple application in labview like use a some DC voltage and try to read in Labview but when I run It gives me message not an NI devive some thing wrong with channel definig.Plz help me

Best Regards

TAlib Hussain

0 Kudos
Message 6 of 9
(6,841 Views)

Dear Mr. Hussain,

 

The sub VI's you are using in this main VI aren't available for me, please add them to the post (or the complete llb); with the project explorer you are able to create a zip file (under the build specification); this will include all VI's which are not available in a standard Labview environment.

 

I noticed the channel constant, and am curious how you specified the channel you want to use, for compact DAQ it has to be something like; cDAQ1Mod1/ai0

 

I normally use the attached VI; you can select the right module with this VI, so select cDAQ1Mod1 as device and offer a Boolean array to the sub VI; element 0 is channel 0 etc; the channels corresponding to the Boolean true elements will be added to the task. 

 

If the channel specification isn't the problem, please try an example like; Cont Acq&Graph Voltage-Int Clk.vi (example finder, hardware in and output => DAQmx => analog input => voltage) when you select the correct channel does it work? What is the exact error message?

 

Best regards,

Martijn S
Applications Engineer
NI Netherlands
0 Kudos
Message 7 of 9
(6,835 Views)

Dear Sir,

           Thanks for last time help and you idea really help me to find a solution now I have other problem with Displaying Multiple Plots on Waveform Graphs, I tried example like labview\examples\general\graphs\gengraph.llb but it does not help becuse I want to read both signals from DAQ(NI cDAQ-9172 ,NI9215) card at same time and see in one graph(prefeabley in wavefoem graph) because I want to see real time signal. In attachment you will find my VI. 

 

Best Regards

Talib Hussain

0 Kudos
Message 8 of 9
(6,768 Views)

Dear Mr Hussain,

 

Sorry for the late response; last week I was out of office. First of all you need to create one task for all the channels of this module; you can't create multiple tasks for one module. If you need different parameters (for example you are working with different voltage ranges) you need to call the DAQmx Create channel multiple times (please see the attached picture), if the channels have the same parameters you can are able to include all channels in the physical channel control.

The timing parameters (DAQmx timing.vi) needs to be the same for all channel; you have only one sample clock, so the sample rate needs to be the same for all channels. In case of a graph and or chart; the X axis needs to be the same for all channels (dX or dt).

 

Best regards,

Martijn S
Applications Engineer
NI Netherlands
0 Kudos
Message 9 of 9
(6,679 Views)