Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

crank angle measurement with 1 degree resolution

I have a 1440 turns/rev encoder for measuring crank angle. Using the quadrature encoder example in labview example finder, i was able to get some data off the encoder. However i'm not able to get a resolution of 1 degree from the set up. From my calculation, at 2000rpm, i need to be a minimum sampling rate of 120kHz and the compactrio i'm using has an internal clock of 40MHz so i'm assuming catching every data point shouldn't be a problem. Can anyone help me with an explanation as to how to achieve this?

 

Also, i'm trying to measure pressure as a function of crank angle but need to make sure that i'm getting pressure at the exact crank position. Is it enough to just have both of them in the same while loop or do i need to set a hardware trigger using the encoder's A output as a trigger for the pressure sensor reading? If so, what's the easiest way to do this? Find attached the FPGA and the RT vis.

 

Thanks.

Download All
0 Kudos
Message 1 of 7
(6,285 Views)
You should have no problem with the FPGA code running at speeds faster than 120kHz.  How fast is the code running on the RT side?  The code that is running on the host (RT) side is asynchronous from the FPGA.  You will need to use interrupts to sync the code. Another option would be to buffer the readings in FPGA and use DMA to send the data to the host. 
0 Kudos
Message 2 of 7
(6,258 Views)
Thanks for your reply. However, how do i use interrupts to sync the codes? And how do i use buffer? Also, how do i know how fast my RT is running? Thanks.
0 Kudos
Message 3 of 7
(6,247 Views)
figured out the time profiler thing. I think what i need is the buffered data acquisition thing (FIFO) not the synchronizing option because it seems to me that synchronizing will only make the fpga vi reduce its speed to that of the host vi. I'd rather capture all the data points the fpga clock can provide me with and like you said with a 40MHz clock, 120kHz should be nothing. Any suggestion on how i might apply FIFO to the vis i uploaded previously? Thanks.
0 Kudos
Message 4 of 7
(6,243 Views)

There are lots of examples for DMA FIFOs, heres one:

http://zone.ni.com/devzone/cda/epd/p/id/5919

0 Kudos
Message 5 of 7
(6,218 Views)
That example on that site is way too complicated for what i need. I tried storing data in FIFO in the FPGA, and tried reading them off in the host vi. The problem i encounter is that the data i get in the host come in arrays of values (as expected) for each channel i'm reading but manipulating data arrays is not straightforward and i'm not able to use the vi's and plots i already set up to convert the raw data to the actual forms because they just won't work. An example is the "Select" vi. It doesn't take arrays as input and same thing goes for many of the other vis i have in the RT vi.  
0 Kudos
Message 6 of 7
(6,206 Views)
2000 RPM is 33.333 revs/sec * 360 samples per rev is 12000 samples per second.  by setting up a timed loop at 12k and sampling crand angle and pressure, pushing them into a DMA FIFO to RT should not be difficult.
Stu
0 Kudos
Message 7 of 7
(6,200 Views)