ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use angular Encoder position to trigger Digital out

Solved!
Go to solution

Hi,

 

I am a beginner labview user, I have access to three modules, two NI9201 and one NI9401.

 

I have an angular encoder that is used to measure the angular position of a motors crankshaft, what I'm trying to do is use the encoder to trigger a digital out (spark event in the engine) at a certain angular position.  For example, I would like to trigger at top dead center (or 0 degrees on the encoder), then I want to be able to change this to +5 degrees on the encoder, etc. 

 

So far I am able to read in the angular encoder when the motor is running, I am also able to output digital out signals although I can't find a way to link the two together.  

 

If anyone has any idea how to do this, it would be greatly appreciated, I have attached my VI.

 

Thanks in advance,

Nick

Download All
0 Kudos
Message 1 of 7
(3,514 Views)

Can you save your current VI for a previous version?  (i.e. 8.5)

 

I can't open your VI with v 8.5.

 

Thanks,

 

Bill

0 Kudos
Message 2 of 7
(3,512 Views)

Hi Bill,

 

Here's the earlier version (8.5).

 

Nick

0 Kudos
Message 3 of 7
(3,510 Views)
Solution
Accepted by topic author ngio

Hi Nick,

 

I hope the attached vi will get you on track.  It's just a general concept.

 

The while loop will run until you hit the stop button.

 

   I take it you will need one spark per revoultion.

 

This VI is really just an If/Then

 

   If the encoder value is equal to (in this example ) zero,

 

   Then trigger the digital output.

 

 

I know I have a broken wire, but I didn't know how to get the angular position from you DAQmx.

 

Let me know if this help. (Also let me know if I'm off target)

 

Good luck,

 

Bill

0 Kudos
Message 4 of 7
(3,508 Views)

Hi Bill,

 

Yes the concept you provided was exactly what I needed to do, it all seems easier now that I've seen it.

 

So I have implemented the concept and got a working function, now I am wondering if there's any way to do it faster.  I am trying to trigger the spark for the engine and the fact that I have to stop tasks every spark iteration slows my sampling down tremendously.  If there's any way you know that can do this without start/stop task blocks I would be very interested.

 

Thanks Again for the help,
Nick 

0 Kudos
Message 5 of 7
(3,504 Views)

I'm not that familiar with start/stop tasks.

 

Can you place the start and dtop outside of the while loop?

 

   For example, start your task before the loop and stop after you exit the loop?

 

Bill

0 Kudos
Message 6 of 7
(3,498 Views)
I'm afraid not, this is the only way the task can be performed(I.e. The task must be stopped before it's started again). I will work with it a bit more and see what I can come up with.

Thanks again for the assistance.
0 Kudos
Message 7 of 7
(3,496 Views)