Interrupts with CMUCam

For our robot, we want to use a quadrature encoder so that we can move our manipulator to preset heights on the arm. I read the “Quadratuer Encoders” white paper, and modified the example code to work with one interrupt.
This works fine with the default code, but I noticed that on Kevin’s CMUCam code, the use of serial_ports means that user_Serialdrv.c and user_Serialdrv.h must be deleted. Where, then, do I put the interrupt code, and how do I hook the encoder up to the robot controller? I read through serial_ports.c, but I didn’t really see a place for an interrupt handler where I could add the encoder code…

Look at Kevin’s encoder code. It supports 8 interrupts for quadrature encoders, and is easily integrated with his camera code.

Thank you! This is my first year programming in C, which still makes me one of the senior programmers this year…we’re not exactly a rookie team, but a few years ago we lost everyone who knew what they were doing.

The encoders work fine now, and plugging in the camera doesn’t give me a code error any more! Now if I could only get the camera to work…

You might want to try using EasyC. When you program using EasyC, you’re actually just creating code that runs with the FRC library that team 190 wrote, WPILib. WPILib is very good at setting these kinds of things up, and you can set up the camera and encoders in just a few lines of code.

If you dont like using EasyC and would rather code by hand, you can download WPILib here and use it as you wish…

I thought the RC only has 6 interrupts. Where are the other 2?

That was a typo, six is correct.

Oh good, I’m not going crazy. :slight_smile: I was expecting something like, oh well if you use the relay ports and you change this and that boom 2 more.

Game On!