reading interrupt ports directly with easyc pro

I am using the interrupt watcher and that works great. But I want to at times read the interrupt port directly like any digital port. How do you do that under easycpro?

Honestly Doug, we haven’t implemented such a feature. You could use a Y cable to a digital input and a interrupt. We haven’t done this because we are worried about confusing the user.

Thanks good to know. I was hoping there was user code you could directly read those ports.

I think this is needed for two reasons:

  1. Though you know the state when it the switches closes, you can not know the state if it has already fired. Example if the machine comes up the first time (booting for the first time) you can not read the state to see if the limit switch is closed.

  2. I am maxing out the IO and want to use the ports without using the interrupt watcher. Along with this I am maxing out the memory and using the interrupt watcher takes additonal memory which I am out of.

BTW EasyC Pro is a great product. We are competing in an high end NASA contest. We have a video camera on two servos, CMUCAM, 6 speed controllers with 8 motors, two encoders, gyro, 6 flex sensors, weight sensor, 3 current sensors, 8 limit switches (some multi-plexed) and the VEX this runs on communicates through a IP router connected to a wifi to serial communications all controlled remotely on a notebook computer.

To say the least we have maxed out the VEX. People we are competing with are using onboard PC and National Instruments.

Thank you for the feedback, and the best of luck to you.

Ok, I did some digging and here is how you do it.

You need to include: p18f8520.h

Then you can just set the direction and call the port. You can also make the interrupt pins an output if you like.

defining ports for use
PORTBbits.RB2 = 1; - Is interrupt input port 1
PORTBbits.RB7 = 1; - Is interrupt input port 6

TRISBbits.TRISB2 = 0; - Sets Port 1 as a output
TRISBbits.TRISB7 = 0; - Sets Port 7 as a output

Var = PORTBbits.RB2 - read interrupt port 1 status
PORTBbits.RB2 = 0; - set interrupt port 1 to off
PORTBbits.RB2 = 1; - set interrupt port 1 to off

Sample V2 Program attached, note this may require the latest version of V2 as V2 now uses the WPILib driver model. It also works with Pro. (1.27 KB)

wow thanks, that is what I am looking for. Problem right now I am very low on memory, so I hope it works within my memory constraints.