![]() |
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. |
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?)?
|
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? |
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?
|
Re: interrupt enable
Code:
INTCONbits.GIE = 0;See pg 121 in the PIC18F8722 manual (DS39646B;39646b.pdf) |
Re: interrupt enable
:D
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 :D |
Re: interrupt enable
Quote:
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:
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) |
| All times are GMT -5. The time now is 23:54. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi