LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

encoder readings problem

Hello to everyone, 

I am new in LabVIEW and FPGA programinga and I have a couple questions, so I would appreciate your help. I am working on a project, where  I need to read data from rotary encoder. And I have made program to do that. In attachments you can find pictures of my prorgams. I wanted to measure the difference between position counts in the current and previous moment. Like solution I used fifo and I have set loop to be 1000 ms on the target, and 100 ms on the host. I used position to be an element, and I have tried to measure the difference between position counts, and for that I used shift register. But mesauring thad I have notcied that the difference is very small of equal to zero. I think that is not correct, because I am mesauring pulses from encoder and I think that the difference should be bigger. IF am making misake, could you please tell me where and how can I fix it.

Thank you in advance 

Download All
0 Kudos
Message 1 of 5
(2,947 Views)

Hello,

 

Your target VI is configured to loop at 1000ms. So you can "see" a change on digital line every 1000ms. Changes that may occur faster will not be seen.

First of all, you are running a FPGA target. FPGA is designed to run things in parallele. If there is no need to synchronize digital input and analog output, use two parallel loops. Then, reduce the loop timer. If you want to catch short time line
changes, you have to run the loop faster.

About effective count, you can consider that reading the indicator position every second from host is sufficient. In that case, there is no need of DMA FIFO, and the count difference is software clocked.

If you need a hardware clocked acquisition, use an additional loop.  Use local variable to access Position value from this loop, and every loop iteration, send the Position value to the DMA FIFO (or the position difference). The FPGA will be in charge of a very precise clock, and you will just have to read information sent in the DMA FIFO from the host.

 

Best regards,

0 Kudos
Message 2 of 5
(2,927 Views)

Hello,

thank you on your answer. But i made mistake. Loop is not timed to be 1000 ms, it is 1000 ticks. And still, readings are the same.

0 Kudos
Message 3 of 5
(2,883 Views)

Hi!

 

You mentioned in your original post that you configured your code like a solution that you found previously.  Could you share what example you were looking at to get this set up?

 

 

Thanks!

 

Tucker
Applications Engineering
National Instruments
0 Kudos
Message 4 of 5
(2,845 Views)

Hi belmica05,

 

at a first sight, your FPGA code is not good implemented.

In fact, if you make division, multiplication, addition directly on FPGA target, you will lose a lot of performance.

So maybe the data you transfer to host are not the actual one since FPGA  is going slower than you expect.

 

I hope my answer will help you.

0 Kudos
Message 5 of 5
(2,650 Views)