Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

trigger digital output at every 10 digital pulses

How can i generate an output pulse at every 10 input pulses comming from an encoder?

 

I need to trigger a sensor at every 10 encoder pulses to get data from the sensor.

0 Kudos
Message 1 of 18
(6,548 Views)

Hello jyp777,

 

What you will need is a counter with an if statement that activates a digital output every 10 ticks. To do this, I would look at a LabVIEW example titled: Counter - Count Edges (Continuous Clock) that can be found under Help >> Find Examples... >> Hardware Input and Output >> DAQmx >> Counter Input in LabVIEW. Using this example VI, it should be a simple step to add a condition that triggers a digital output when the count reaches 10. 

 

You can also use a Digital Output example if you need help in this area. These examples can be found by going to :

Help >> Find Examples... >> Hardware Input and Output >> DAQmx >>Digital Output. I would recommend "Digital - Continuous Output.vi". 

 

Happy LabVIEW coding!

 

Thanks,

Collin D.
Software Product Manager
0 Kudos
Message 2 of 18
(6,521 Views)

I came up with this solution.

is this solution reliable?

 

and i am not getting the accurate results with this solution in the saved file.

 

0 Kudos
Message 3 of 18
(6,505 Views)
That does not do anything like what you want. You are writing to the daq assistant with each and every read. There is no comparison at all whether the data read is a logic one or zero. You are also configuring and closing the task continuously. This should be done outside the loop.

What is your hardware? Why not use the counter as recommended?
0 Kudos
Message 4 of 18
(6,500 Views)

As of now i need to save the output data from Encoder.

and once accurate results are saved then i will go ahead and count the pulses and then trigger a signal at every 10 pulses.

 

So this is just for saving the encoder results.

 

0 Kudos
Message 5 of 18
(6,495 Views)
Since you have not provided any information on what exactly is in the file and what you expect, it's impossible to answer.
0 Kudos
Message 6 of 18
(6,489 Views)

Attached is the VI to save the output of an encoder for channel A.

and the output is not accurate.

0 Kudos
Message 7 of 18
(6,470 Views)
I asked before what you mean by inaccurate data but you still have not provided that. That means you need to explain exactly what is in the saved file and how is it different from what you want.
0 Kudos
Message 8 of 18
(6,465 Views)

The file contain the stream of 0s and 1s. which is the channel A output.

So right now the stream provides correct number of samples but the stream of 0 and 1 is not in the way it should be(i.e. continuous toggling of 0 and 1 with no repetition). So what i want is continuous stream of 0 and 1 with no repetition.

0 1 0 1 0 1 0 1 0 1 0 1 0 1 like this.

 

what i am getting right now is 0 0 1 1 1 0 1 0 0 0 1 1 1 1 0 1 0 0 like this.

 

0 Kudos
Message 9 of 18
(6,459 Views)
You are just sampling twice as fast as the signal is changing.
0 Kudos
Message 10 of 18
(6,454 Views)