Thread: GeneratePWMS
View Single Post
  #9   Spotlight this post!  
Unread 24-02-2004, 01:05
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: GeneratePWMS

Quote:
Originally Posted by Jay Lundy
You don't have to do it like that. Dig I/O pins 3-6 are interrupt on change, so just plug it into dig io pin 3 and when RBIF triggers check to see that it is indeed pin 3 that changed (since 3-6 all trigger the same flag). You can sense both rising and falling edges on the same pin.
Just FYI, interrupts 1 and 2 can also exhibit this behavior if you flip the INTEDGx bit in the interrupt handler. As a starting point, I'd suggest using the code in receiver.c/.h because it pretty much does exactly what you need to do (pulse width discrimination). I'm not sure if it's usable (IFI may have wired-in a output buffer on the CCP pins), but you might also look into using the CCP Capture mode to do this.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org