Interrupt on driver station digital input

Is it possible to attach an interrupt to a digital input on the driver station? I would like to use an encoder as an input device, and I don’t believe there is any other way use them than with interrupts. I looked through the WPILib beta 5 code and didn’t see anything about driver station interrupts in DriverStation.h/cpp and FRCComm.h.

If this isn’t possible, I’m considering using a microprocessor to take in the encoder readings, keep track of the encoder offset, and output that as a PWM signal to the driver station analog input. For example, if the encoder is turned halfway around, the microprocessor would send a 50% PWM to the driver station. Would this work correctly? Also, does the driver station have a power source I could use? (As I understand it, external power is not allowed.)

For the visual people:
http://img258.imageshack.us/img258/651/diagramkl2.png](http://imageshack.us)

You can’t interrupt on the digital inputs on the DS. If you’re using a very coarse encoder (4-8 cycles per revolution) you might be able to manage it by simply sampling it every data packet from the DS… If it isn’t turned too fast.

That said, if you’re only interested in the angular position of the encoder is there any reason you can’t use a plain old potentiometer to do this? There’s stopless potentiometers if you need it to roll over, or multi-turn ones if you need a couple of turns. Expending all that effort to turn an encoder into just a potentiometer seems a little… excessive.

You would have to put a low pass filter on your PWM signal for the analog input to read it properly. If you post the specific frequency you will be duty cycle modulating, we can help you design the filter. It won’t be much more than an RC network or two.

There is a 5V power supply on the DS that you can use, it is set up just like the DSC.

I’d transplant the encoder out of a USB joystick into the mechanical controls, while keeping the encoder attached electrically to the original processing hardware.

Has anyone cracked open the Attack 3’s? We’ve drilled them to mount them, but we didn’t break them open. Is the “thumb wheel” on the base an encoder, or a potentiometer?

You can also buy encoders with an analog interface, like the US Digital MA3. http://www.usdigital.com/products/encoders/absolute/rotary/shaft/ma3/

Have we been allowed to create custom processing circuits and attach them to the OI in past years?

Portable computing devices
must not be connected to joystick input ports on the Operator Interface.

Where do they draw the line?

Ah, my fear was right about the lack of interrupts. Thanks for the ideas, everyone. I didn’t know about the ‘portable computing devices’ rule, and that definitely invalidates my workaround idea.

However, the stopless potentiometers and analog/absolute encoders look interesting. I’ve heard of stopless potentiometers before… do they come that way, or do they have to be modified to become limitless?

Our team used the US Digital MA2 and MA3 on the robot each of the past two years with excellent results. They are small, extremely accurate, reliable, durable, and have no “dead spot” like a stopless potentiometer. I would highly recommend these for applications where “continuous rotation” is needed.

That said, I have never used the MA2 or MA3 on a Driver Station, but they should work just fine!

I agree, whatever you were trying to do with an incremental encoder on the controls side could probably be done with an absolute encoder with an analog output, or probably even a continuous pot.

I imagine the code would be simple enough to just check the value each cycle and compare it to previous to get the “distance traveled”.

Big Caveat, It’s been forever since I really sat down and programmed.