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.
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.
11-30-2016 08:32 PM
I am coding an RT program on cRIO. I have a DC motor that contains a disk on its shaft. This disk has a hole to detect its rotation speed. The rotation speed is obtained by an optic sensor. If we store the time of two consecutive hole detection by the sensor, their difference is the period and we can calculate the angular velocity. The sensor is connected to NI 9401 digital module on the cRIO and for the calculation, we should detect the rising edge of the sensor output. I wrote code that works but at very very low speeds. This algorithm works properly on FPGA. I think I have a mistake in RT and scan mode approach.
11-30-2016 09:15 PM
A single VI for a cRIO project isn't entirely helpful.
I did notice you brought up the scan engine. How slow is "very very low"? Numbers are key here rather than vague terms that have different meanings to different people. Keep in mind the scan engine runs at 1kHz. Are you hoping to go faster?
11-30-2016 10:02 PM
Thank you so much for your reply. You are right. I should give the numbers. When its rotation period is 600 ms, it can not detect the rising edge. With 1kHz, could not it detect the rising edge at this speed? As the motor specification, its period is 16ms in its max speed. Which kind of programming do you suggest on cRio? Just FPGA? Is there any solution to coding in RT?
12-01-2016 02:19 AM - edited 12-01-2016 02:20 AM
Hi mmehrabin,
- use a counter instead of checking for rising edges on your own: some DIO modules can be configured to provide several functions like DI/DO/PWM/CTR…
- why do you need to compare a boolean value with TRUE? Rube-Goldberg alarm… 😄
- why do you set your loop with a 1MHz clock and 1000µs instead of 1kHz clock and 1ms?