Quote:
Originally Posted by DonRotolo
What you may want to use is called an "Interrupt". This is a special hardware connection (to the Digital sidecar) that signals the cRio's processor "STOP Whatever you are doing and run this piece of code. Immediately. Now". In your case, that code might add +1 (or subtract -1 if the lift motor is running backwards) to a counter that keeps track of lift position. Clearly, the code must be as brief as possible, since your processor is literally unable to do ANYthing else while the interrupt is active. (The interrupt gets activated by the sensor signal)
|
For an application like this, an interrupt is unnecessary... the FPGA design has counter logic in it that will deal with counting up or down as you wish. It is much faster and has no impact on your robot code's execution speed. Use interrupts only as a last resort.
-Joe