|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
interrupt enable
Hi all
been thinking about interrupts, I didn't really dig into Kevin's code, but if I'm not mistaken, enabling the interrupts is done by a '#define', and is done only once, to affect the entire code, I might be mistaken here, but.. I don't want the IR affecting my teleop period's maneuvers, so. I wanna disable the interrupts altogether, and this can be done by putting this: INTCONbits.GIE = 0; at the beginning of teleop code, and this: INTCONbits.GIE = 1; at the beginning op autonomous mode. now, some questions: 1. am I right?, does the GIE (general interrupts enable) bit apply to all of the interrupts? I havn't dealt with ints for a while now.. 2.is that even necessary? are the interrupts enabled in teleop anyway? thanks in advance, Ran. |
|
#2
|
||||
|
||||
|
Re: interrupt enable
The answer to your second question is yes, interrupts are enabled in the teleop period. My question for you is this: why would the interrupts affect the teleop period anyway (i.e., are they simply unnecessary or do they cause problems?)?
|
|
#3
|
||||
|
||||
|
Re: interrupt enable
thanks, usbcd36
my answer to your question is: ..they might cause problems, don't you agree that anything that can cause you robot to move to a position you don't want him to move might be bad? |
|
#4
|
||||
|
||||
|
Re: interrupt enable
Hopefully you don't have the interrupts actually trigerring the robot's movement. Otherwise, couldn't you add in the code an if to check if the robot is in autonomous before changing pwms based on IR inputs? What exactly would your interrupt look like? Turning on a flag that dictates what routine to run (only handled in autonomous), or are PWMs set in the interrupts?
|
|
#5
|
|||
|
|||
|
Re: interrupt enable
Code:
INTCONbits.GIE = 0; See pg 121 in the PIC18F8722 manual (DS39646B;39646b.pdf) |
|
#6
|
||||
|
||||
|
Re: interrupt enable
![]() good thing it's in theory. "If you wanted to disable all user interrupts you'd use GIEL bit instead." aren't the 'IE's of kevin's code ISR in the GIEH? nevermind, there are (as mentioned above) much smarter ways to do this ![]() |
|
#7
|
|||
|
|||
|
Re: interrupt enable
No. And IEs are neither high or low in association - they just allow or disallow the associated interrupt from occuring.
The IP is what assigns the interrupt to high or low priority... There are three things that control each interrupt, IP, IE, and IF. Code:
. IP, Interrupt Priority - can be assigned to low or high if IPEN (interrupt
priority enable) is set which it should be. The high priority interrupt
handler is provided as part of the default code. Assigning any peripheral
interrupts to high priority should get the red-light-of-death as that
interrupt handler won't check for or clear any interrupt its not expecting.
. IE, Interrupt Enable - enable an interrupt to occur if or when IF is set.
. IF, Interrupt Flag - the pin or device sets this flag when interrupt conditions
are met. The flag is set regardless of whether IE is on or off allowing
code to poll for interrupt (request for service) conditions.
The h/w logic for a low priority interrupt is something like; Code:
if (GIEH && GIEL && (IPx=lo) && IEx && IFx) then interrupt processor... Code:
interrupts.c:65: INTCON3bits.INT2IP = 0; // 0: interrupt 1 is low priority (leave at 0 for IFI controllers) interrupts.c:100: INTCON2bits.INT3IP = 0; // 0: interrupt 2 is low priority (leave at 0 for IFI controllers) interrupts.c:138: INTCON2bits.RBIP = 0; // 0: interrupts 3-6 are low priority (leave at 0 for IFI controllers) serial_ports.c:313: IPR1bits.RC1IP = 0; // receive interrupt priority bit (must be 0 for IFI controllers) [130] serial_ports.c:341: IPR1bits.TX1IP = 0; // transmit interrupt priority bit (must be 0 for IFI controllers) [130] serial_ports.c:497: IPR3bits.RC2IP = 0; // receive interrupt priority bit (must be 0 for IFI controllers) [132] serial_ports.c:526: IPR3bits.TX2IP = 0; // transmit interrupt priority bit (must be 0 for IFI controllers) [132] : etc. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Paly Robotics Team 8 laser-enable the disabled | pstrapp | General Forum | 2 | 22-04-2007 17:53 |
| Competition port Enable/disable switch box | mpm967 | Technical Discussion | 3 | 10-01-2007 12:51 |
| Autonomous enable/disable | Culvan Van Li | VEX | 4 | 21-09-2006 13:03 |
| enable interrupt | Dean | Programming | 2 | 13-02-2005 07:37 |
| Interrupt limitations? | randomperson | Programming | 2 | 27-12-2003 21:40 |