LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time elapsed between two counters on LabView FPGA

Hi guys,

 i am working with cRIO 9073 and new to labview programming. I have implementeed counters on FPGA  vi and would like to measure period between two pulses. How can I measure the time between two counters on Labview FPGA vi? Here is screenshoot of FPGA vi (pfga-diagram). Please let me know

Kodjo

.NEt software developer 

 

0 Kudos
Message 1 of 7
(4,043 Views)

I normally do something like this.  I use a Timed Loop instead of the While Loop.  In LabVIEW FPGA, we call this a Single Cycle Timed Loop because everything inside of the loop must execute in a single clock cycle.  I am assuming you are using a digital input that can handle the 40MHz.  I use a Feedback Node instead of a Shift Register for the previous state of the digital input since I think it is a little cleaner.  Then I increment the count (stored in a shift register) when a rising edge is not detected.  When the rising edge is detected, I write the count in the front panel indicator (for the RT to read) and reset the count.  I typically just let the RT do the math to convert the number of cycles into seconds, Hz, or whatever you are getting out of this counter.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(4,033 Views)

Please,Can you attach the FPGA vi code I am having trouble finding items from toolbox?

thanks

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

What I attached previous is called a Snippet.  Save the image file to your desktop and then drag it onto your block diagram.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(4,021 Views)

I run to some issue, I am not getting  a display of counters continuously. I am using a rotational machine which generate pulses. When the machine runs no display of counters appear on my labview front panel. And when I turn off the machine the total number of counters appear. I am wondering if it is related to debouncing signal or I have some issue with my setup of hardware?.

Thanks

Kodjo

.NET software developer

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

You likely have the indicators outside of the loop so they don't update until the loop finishes.  In text-based, that's like doing:

 

int i,j = 0

while (i < 10) {

j++

}

 

print j

 

Would you expect to see a print of 0123456789 or just 9?

0 Kudos
Message 6 of 7
(3,973 Views)

In the FPGA code I gave you, the counter only updates on a rising edge (cycle is complete).  From your description, this is not where the error is.  So you will need to share your RT code if you want us to help diagnose your issue.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(3,956 Views)