|
Re: Ultrasonic sensors on digital ports 3-6 problems
I have that interrupt routine function called inside the one that is written in the default code under user_routines_fast.c. Thats where I check the INCONbits.RBIF flag as well as the RBIE. Sorry I forgot to mention that. I do turn the actual interrupt off a lot so I do not get any bad data (from when I send the pulse) and each time I access it in Get_Distance() I turn it off, copy it, and turn it back on. I turn it off when I turn off the timer on the falling edge as well. I did see one where I have "//disable it" then I have it set to 1, but that shouldn't have effected it. Although I don't need to re-enable it in Get_Distance now that I think about it, because I re-enable it every time I call Ping(). But that shouldn't effect it either.
I was looking at Kevin's encoder code as a guide on how to get the interrupts 3-6 to work, and I have it almost how he has it.
__________________
Programming in LabVIEW? Try VI Snippets!
FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
|