From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

trigger digital output at every 10 digital pulses

Edit - should be at least twice as fast as the signal its changing.
Message 11 of 18
(3,009 Views)

Now i have got the correct reading of encoder which is 2000 pulses a revolution.

how can i trigger a pulse at every 10 pulses.

I got one indicator working for this but when i feed this same signal to the DAQ ASSIST block to generate the pulse at a port. it doen't work.

the following image shows the VI that i made.

Please suggest any changes required.

Here i am using a remainder to compare that the value is a multiple of 10 and when the value is true i used conversion to feed it to the DAQ ASSIST block and an indicator to verify.

but i don't see an output at the port even though i can see the indicator working.

 

Trigger sensor.PNG

0 Kudos
Message 12 of 18
(2,965 Views)

Hello jyp777,

 

The reason this isn't working is because your DAQ assistant is outside of your never-ending while loop. Because you have a false constant wired to the stop terminal of your while loop, the loop will never end and thus, never send data to the DAQ assistant. Try either placing the DAQ assistant inside the while loop or creating a DAQmx Write Node inside the while loop where your Boolean array indicator is. Let me know if this helps. Almost there!

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

I already tried putting the DAQ Assist and the DAQmx write blocks inside the loop but it gives me the following error.

 

"Specified read or write operation failed, because the number of lines in the data for a channel does not match the number of lines in the channel.

If you are using the Digital Waveform datatype, make sure the number of lines in the digital waveform matches the number of lines in the channel. If you are using boolean data, make sure the array dimension for lines in the data matches the number of lines in the channel.

Number of Lines in Channel: 1
Number of Lines in Data: 16"

 

So even when i put those two blocks outside the loop and put one more loop with the input condition which the present loop it still doesn't seem like working. I don't see my LED glowing anyways.

 

Please suggest any other ideas i have attached my VI if you want to try something with it.

 

0 Kudos
Message 14 of 18
(2,939 Views)

Hello jyp777, 

 

This is because you are attempting to write a Boolean array to 1 digital port. Essentially, you are trying to put multiple booleans into your LED which is not possible. Instead of doing the Boolean to Number and then Number to Boolean Array, try writing the output of the "Equal to 0" comparator directly to the DAQ Assistant inside the While Loop. This way, you will write one Boolean instead of attempting to write an entire array of Booleans. 

 

Thanks!

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

Hello TheNIDragon,

I already found a solution for it.

the DAQ Assist block does not directly take an input from comparator of equal to 0 that is the reason why i tried converting it to bool and then to array.

but now i used the output of the comparator to the DAQmx Write block and used this in a for loop inside the present while loop with 1 loop iteration.

So it does not loop for ever and not read the counts.

 

Thank you anyways.

Jyp777

0 Kudos
Message 16 of 18
(2,919 Views)

Hello all,

Can anyone tell me how to reset the counter edge number to 0 when one revolution is done (i.e. counter is at 2000 pulses).

 

Thanks in advance,

Jyp777

0 Kudos
Message 17 of 18
(2,905 Views)

Hello jyp777,

 

Here is a link that should show you how to do that:

 

https://decibel.ni.com/content/docs/DOC-26249

 

 

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