LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pulse duration in labview FPGA

Solved!
Go to solution

Dear 

can one help to built a lv FPGA to measure the pulse duration 

my first start lv  VI is shown below for Spartan 3E kit the but its fail to work

is thei rany modify make it work??

 

for the case structure in false case the old value is moved instead of tick counter

best regards

pulse duartion.jpg

 

 

hi ?Q>

0 Kudos
Message 1 of 12
(4,515 Views)

Hey mangood,

 

Do you just want to count the number of ticks that a Digital line remains high and then output the result?

 

Regards,

 

Ryan

Ryan P.
CLA
0 Kudos
Message 2 of 12
(4,455 Views)

@Ryan-P wrote:

Hey mangood,

 

Do you just want to count the number of ticks that a Digital line remains high and then output the result?

 

Regards,

 

Ryan


 i want number of ticks that a Digital line remains high and  number of ticks that a Digital line remains low 

and can work for long time for more than 1 hour 

 

hi ?Q>

0 Kudos
Message 3 of 12
(4,449 Views)

Get rid of the boolean shift register and the timer function inside the loop.  Just have two shift registers one for the high count, one for the low count.  If the Digital Input is True, then increment the High shift register.  If it is False, increment the Low shift register.

Message 4 of 12
(4,436 Views)

Like RavensFan mentioned, the simplest way is to use a pair of shift registers and record two of the following three: cycles high, cycles low, or total cycles. Increment the value that is currently active based on the I/O value.

 

What is the expected pulse/cycle rate of the signal? You mentioned reading for over an hour, do you need to have exact values for verifcatoin, a rolling average of pulse counts, a median value, etc. All of these can change how you store and process the results.

Message 5 of 12
(4,430 Views)
Solution
Accepted by topic author mangood

There is also an Example in the NI Example finder on exactly how to do thisSmiley Happy

 

You can search for Pulse Measurement to find it, or use the snippet below:

PWM Measurement.png

 

Cheers!

TJ G
Message 6 of 12
(4,407 Views)

dear

thank you all for the replay

i will use the  NI Example for test

i think the iniail problem of such VI is the  timer wraps to zero.  If this timer will work under 40MHZ source clock 

how long is the timer will be work without  wraping??

 

back again after test

 

best regards

 

hi ?Q>

0 Kudos
Message 7 of 12
(4,380 Views)

40MHz inverted is 0.000000025  This is how many seconds a single tick takes.  If your tick counter is a U32 (the largest it goes to without extra work) you have 2^32 values which is 4294967296.  Multiply these two numbers and you get 107.3741824.  This means after 107 seconds your U32 counter will roll over.  For this to work long term you will need some way of keeping track of the amount of time passed.  I've seen some example 64 bit counters here, or here.

Message 8 of 12
(4,359 Views)

Using a U64 will work just fine for you.  It won't roll over for about 14,600 years give or take a couple decades.  I'm using a 64-bit value in my FPGA application.  I don't think I need to worry about it rolling over.Smiley Wink

Message 9 of 12
(4,349 Views)