LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert pulsed signal into single thickness line

Solved!
Go to solution

Hi,

 

I have been trying to create a VI which will allow me to convert a pulsed signal (generated by a tachometer) into a single thickness line, indicating that a revolution has passed. I would like to overlay this line onto the other signals being generated.

 

I am able to detect the falling edge of the signal, but I have not been able to make a suitable line. I have tried creating a new waveform, and fiddling with markers, but neither method has worked for me.

 

Does anyone have any ideas of a good way to do this?

 

My test VI is below.

Tahcometer Pulse Detection.png

0 Kudos
Message 1 of 11
(2,780 Views)

@CamW wrote:

Hi,

 

I have been trying to create a VI which will allow me to convert a pulsed signal (generated by a tachometer) into a single thickness line, indicating that a revolution has passed. I would like to overlay this line onto the other signals being generated.

 

I am able to detect the falling edge of the signal, but I have not been able to make a suitable line. I have tried creating a new waveform, and fiddling with markers, but neither method has worked for me.

 

Does anyone have any ideas of a good way to do this?

 

My test VI is below. [snipped]

 


I've got a couple of problems here. First, I have no idea what you mean by "convert a pulsed signal ... into a single thickness line". Second, your posted VI throws an error every cycle (1 ms) because your stuff on the bottom of the BD makes no sense.

 

If you mean that you want to create a waveform to test your zero-crossing detection on, I would advise not using the Simulate Signal (Express) VIs, go to the Signal Processing -> Create Waveform subpallete and pick something from there, or add a few together and roll your own. Then throw it onto a waveform graph, look for zero-crossings,and process it further however you wish. Note that the Create Waveform VIs can be tailored however you wish so you can work with them comfortably.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 2 of 11
(2,744 Views)

Thanks for having a look,

 

The snippet process seems to have changed my block diagram, the property node should be linked to the waveform graph, rather than having a constant input.

It lets me change the colour of the tachometer plot between red and transparent, to allow the user to view the plot with and without the tacho.

 

I am trying to find a way to only show the negative edge of a square wave on a chart, as below (the top chart would be the input, the bottom is the desired plot).

 

Graph Comparison.PNG

 

I will trying re-producing my test VI with Create Waveform VIs, and see if I can find a way to do it.

 

Thanks,

Cam

0 Kudos
Message 3 of 11
(2,731 Views)

Looks like you should be able to do this with vertical line cursors.

Create your cursor with Cursor Style=2 and then Set the X position via property node.

0 Kudos
Message 4 of 11
(2,725 Views)

Hi Taki,

 

Ideally this should be done with charts, as graphs will not work well with the rest of the VI.

So no cursors, unfortunately. (Unless there there is a way to get a cursor onto a chart that I am unaware of!)

0 Kudos
Message 5 of 11
(2,715 Views)

Yeah, I find that those snippets don't always work exactly like attaching the real thing.

 

Taki1999's suggestion sounds good, or you may set your second (red) plot to flip between +5 and -5 when your signal goes positive, then negative, while keeping the graph's Y-scale at +/-1 (or whatever). You should also be able to program your red plot to go invisible when its level reaches -5, then to go visible when it reaches +5 again, to eliminate the positive transition. However, if you do this, you are going to have to consider your plotting rate, because using property nodes to change things takes a lot longer than straightforward programming. (There was a fairly long conversation a month or two ago on this, altenbach gave the definitive answer - as usual Smiley Happy .) Thinking about it a little more, you should be able to program things to ignore the positive transition by playing with the red plot's flip trigger.

 

Good luck.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 6 of 11
(2,711 Views)
Solution
Accepted by topic author CamW

Make the second plot style vertical lines (plot style: no points, no interpolation, fill to -inf). feed a NaN whener you don't want a line and a "+inf" whenever you want a vertical line.

 

Here's a simple example:

 

 

Message 7 of 11
(2,701 Views)

Thanks to everyone's help I've managed to solve my problem.

 

Here is a snippet showing the process working, for anyone else who may get stuck on this problem (the second plot on the chart has been configured as A

 

Negative Edge Detector.png

 

And here is a screenshot showing how I have implemented the solution with a custom scale and a tachometer. (The custom scale works as an ADC).

 

Negative Edge Detector in Practice.PNG

 

Thanks again to everyone who helped!

 

Cam

0 Kudos
Message 8 of 11
(2,668 Views)

These "solutions" can still be improved dramatically. I would never hardwire a size (1000 in the upper example). First of all, the loop needs to iterate one less than the number of samples and the array is right there to get the size. What is the size changes down the road. Do you really want to search for all diagram constants that need to be changed? What if you miss one by accident?

 

Also, the loop could be simplified quite a bit. Try it!

 

(Typically you would also mark the most helpful answer as solution, not your own summary)

0 Kudos
Message 9 of 11
(2,654 Views)

Firstly, I've changed the solution tag, I misunderstood it's purpose, sorry if I've annoyed people.

 

Secondly, I undertand what you mean about the number of interations, the second example doesn't actually have the same problem, bar the fact it loops one too many times, but I can't see a way to simplify the loop, could you enlighten me?

0 Kudos
Message 10 of 11
(2,628 Views)