|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Interupts on the Pic18
We are trying to use interupts with our gear tooth sensors. And looking at the data sheet i see about 9 types of interupts. After asking a mentor he was as confused as I.
In short, does anyone know which inputs (other than 1&2) are interupt driven? |
|
#2
|
|||||
|
|||||
|
Re: Interupts on the Pic18
Digital Inputs 1-6 all can be interrupts. I would suggest reading Interrupts for Dummies and Kevin Watson's Interrupt code (yes the code it is commented very well).
|
|
#3
|
|||||
|
|||||
|
Re: Interupts on the Pic18
www.kevin.org/frc. Check the encoder code...a gear-tooth sensor really isn't much different, aside from how it keeps track of direction.
Keep us posted on how those gear-tooth sensors work. We've been able to use them in the past to get a good reading of raw speed, but direction is another beast altogether. Measuring the pulse width seems difficult given the overhead of interrupt calls and other factors. |
|
#4
|
||||
|
||||
|
Re: Interupts on the Pic18
Quote:
-Kevin |
|
#5
|
|||
|
|||
|
Re: Interupts on the Pic18
Quote:
This year you also have the ability to time an event (using dig input 02 and the ECCP module in capture mode). In addition, you can use dig input 14 to count events on timer 1 or 3. Just a few possibilities. They are quite limited because almost all of the pins related to useful modules on the processor are not exposed. I think the most reliable way to approach this is with an external processor that has all of it's modules available. If you are using a quadrature encoder (like the ones that Kevin suggests on his site), then Microchip has processors that can decode that signal for you (I think those processors can decode 3 of those signals simultaneously in hardware). Since it decodes it for you, it counts in the registers. There's no worry about latency. It just happens in hardware. When you want to know how many you have, just go read it. There are many possibilities, but the external interrupts on the RC should be good enough to measure for the direction. Cheers! -Joe |
|
#6
|
|||
|
|||
|
Re: Interupts on the Pic18
Quote:
What are you trying to do that is causing those problems? -Joe |
|
#7
|
||||
|
||||
|
Re: Interupts on the Pic18
Quote:
If you'd like to see the RC malfunction, load up the ADC code I posted and change this line in user_routines_fast.c from: #pragma interruptlow InterruptHandlerLow save=PROD,section(".tmpdata") to: #pragma interruptlow InterruptHandlerLow save=PROD And you should see the RC do things it shouldn't. -Kevin |
|
#8
|
|||
|
|||
|
Re: Interupts on the Pic18
Quote:
I believe Kevin's right when he said to have hardware between the gear tooth sensor and the microprocessor to discriminate the pulse width and not leave it to the program. |
|
#9
|
|||
|
|||
|
Re: Interupts on the Pic18
Quote:
![]() |
|
#10
|
|||
|
|||
|
Re: Interupts on the Pic18
Does anyone understand the significance of the INT3IP bit field being turned into a place holder in the p18f8722 header file? I am trying to get code rooted in Kevin's interrupt template code going. After including the different header, I got an error that INT3IP was not defined. An examinatinon of the header, compared to the one for last years controller, revealed a place holder for the bit corresponding to this portion of control register 2. The data sheet for the 18f8722 processor family shows this as a valid field in the control register, so I am wondering what is going on.
Eugene |
|
#11
|
|||||
|
|||||
|
Re: Interupts on the Pic18
Quote:
There is also a similar error with the Timer0 structure. (At least in the full 2.40 compiler they gave us last year.) |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Interupts? | Validius | Programming | 6 | 11-01-2006 18:29 |
| Need interupts help, and another question... | Kevin Karan | Programming | 7 | 22-02-2004 11:20 |