FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

How to measure a pulse width and it location as the unit is moving

I need to measure a pulse width an its location as the unit is traveling.

 

My unit travels  1.05" on 1.5 sec or  .47 in/sec. At 12.5 Vdc the pulse is about .100 inch in width by design we know were the pulse should be as the unit travels. I use a linear encoder to measure the position of the unit. I need to capture the position of the start of the pulse and the position of the end of the pulse.

 

The pulse is analog V see attach for description of pulse.

I am using a cRIO 9074, 9205, 9411 in scan mode with LabView 11.

 

Hope some one can get me an idea how or point me in a direction or an example.

 

 

 

0 Kudos
Message 1 of 9
(8,397 Views)

Greetings, Toro;

 

If I understand correctly, you are getting a pulse from some device and are attempting to measure the location of an object when this pulse goes high until it goes low, correct? 

 

In order to figure out this location, you are using the linear encoder, right? Are you attempting to do this in the Real Time side and thus scan mode, or will you be coding in FPGA? What kind of signal are you getting from the encoder? 

 

An example of how to measure pulses (in regards to PWM signals) may be found in the following link: 

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

 

Anyhow, I wish you a great day!

 

Cordially;

Simon P.

National Instruments
Applications Engineer
0 Kudos
Message 2 of 9
(8,370 Views)

Hi Simon:

 

Thanks for your answer.

To answer your questions...

 

1.. Yes,

2.. Yes, .... Yes, .. Real time in scan mode, the signal from the linear encoder is digital, the signal for the pulse is analog.

 

I was able to use XY Graph to get the type of information I am looking for but my signal is not quiet perfect as you can see in the attach file. Any subjections

0 Kudos
Message 3 of 9
(8,339 Views)

Greetings;

 

I see the graph and it does, indeed, look a bit jagged.

 

The graph seems to be on a VI that is on "My Computer" instead of the target. You are thus acquiring on the Real Time target and passing the data to the Host Computer via a Network Shared Variable or a Network Stream, correct? How exactly are we writing to this Variable? Are we reading / writing to the variables on more than one place?

 

Additionally, do you have an RT FIFO enabled variable in your deterministic acquisition Loop? 

 

What I am wondering is whether we are missing points or reading points more than once. 

 

Cordially;

Simon P.

 

 

National Instruments
Applications Engineer
0 Kudos
Message 4 of 9
(8,324 Views)

Hi Simon:

 

1... Yes the VI is in My Computer not the target.

2... Yes, you are correct.

3... I created a VI that contains all the Variables and they are selected using an Enum with a list.

4..  When I need to read or write to a variable I use the same with the correct selection.

 

The picture you saw is a single VI that I am using for testing why I get that signal in that VI there are only to Variables one is the linear scale and the second  reads and analog signal inside a while loop.

 

5... No I do not have an RT FIFO enabled variable in my deterministic aquasition Loop.

 

To me it looks like I am missing points it is like the target or my Computer are busy doing something else then comes back and continuous reading

0 Kudos
Message 5 of 9
(8,318 Views)

Hi Simon:

 

I though this image may help. I probably have something wrong on it.

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

Greetings, 

 

That image indeed helps quite a bit. We are running through 100 points in the inner for loop but could we be taking multiple data points repeatedly? 

 

Furthermore, is there a reason as to why we are acquiring 100 points instead of simply acquiring continuously? I would reccomend attempting to use a Network Stream or a buffered Network Shared Variable to ensure that we are not reading the same point multiple times. 

 

More information may be found here:

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

 

Additionally, is there a reason as to why we are setting up the graph in parallel with the data acquisition? Do we need to reset the graph's parameters every iteration of the while loop?

 

Cordially;

Simon P.

National Instruments
Applications Engineer
0 Kudos
Message 7 of 9
(8,301 Views)

Hi Simon:

 

1... I was trying to make sure I was collecting sufficient points.

2.. I try using Network Share Variable it did not work

3.. No, I gest not the only reason I using the graph is for displaying the graph for the Engineering or when we ae trying to figure out what is wrong with the part.

 

4... My loop is now continuosly aquiring data.

 

My main purpose is to be able to test for this pulse during the automatic test. capture it, measure its width and position or location with respect to a linear position. My scan rate in my cRIO is 1000 sample per sec. at 8 usec. convertion

When I removed some of the Network Share Varaible I was able to get a nice square pulse but that  only lasted for a while then it come back. Could this be cause by my computer gets busy doing other things. I know the cRIO it is capable of a lot more acurate meassurements

 

0 Kudos
Message 8 of 9
(8,264 Views)

Greetings, Toro;

 

Indeed, the cRIO itself and the modules are able to acquire quite accurately. However, if attempting to read values from the Network Shared Variables and plotting them without some sort of buffering mechanism, it is normal to be running into this kind of behaviour.

 

When you removed some of the variables, you likely decreased network traffic which meant that the computer was able to more accurately read the values that were being pushed out.  However, when the matter came back, was it after some time or when other things were added to the code?

 

Would you happen to have been able to use a Network Stream to send points instead? You are correct in that the computer might get busy doing other things, but switching to a stream (which buffers points) you might eliminate that problem.

 

Cordially;

Simon P.

National Instruments
Applications Engineer
0 Kudos
Message 9 of 9
(8,253 Views)