Go to Post Every now and then, the judicious application of a modicum of common sense can make all the difference in the world. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-02-2008, 15:52
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
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.
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #2   Spotlight this post!  
Unread 09-02-2008, 17:28
usbcd36's Avatar
usbcd36 usbcd36 is offline
Registered User
AKA: "DOS"
FRC #2399 (The Fighting Unicorns)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Solon, OH
Posts: 151
usbcd36 is a jewel in the roughusbcd36 is a jewel in the roughusbcd36 is a jewel in the rough
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   Spotlight this post!  
Unread 09-02-2008, 17:34
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
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?
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #4   Spotlight this post!  
Unread 09-02-2008, 17:41
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
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   Spotlight this post!  
Unread 09-02-2008, 18:24
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: interrupt enable

Code:
INTCONbits.GIE = 0;
This will definitely cause the red-light-of-death it turned off for any length of time. The GIE bit is also known as GIEH -- you've just disabled ALL interupts including the high priority interrupt that exchanges data between the master processor and user processor. If you wanted to disable all user interrupts you'd use GIEL bit instead.

See pg 121 in the PIC18F8722 manual (DS39646B;39646b.pdf)
  #6   Spotlight this post!  
Unread 09-02-2008, 18:45
3dude_2231's Avatar
3dude_2231 3dude_2231 is offline
no one messes with a Thingy =|
AKA: Menscher,Ran Menscher =]
FRC #2231 (Onyxtronix)
Team Role: Leadership
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Shoham, Israel
Posts: 233
3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough3dude_2231 is a jewel in the rough
Send a message via MSN to 3dude_2231
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
__________________
Redefining the word "Rookie". (for 2 years now..)


Israeli Off Season Games: WINNERS!
check out this cool project I'm into..

  #7   Spotlight this post!  
Unread 10-02-2008, 16:08
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Re: interrupt enable

Quote:
Originally Posted by 3dude_2231 View Post

aren't the 'IE's of kevin's code ISR in the GIEH?
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.
GIEH disables both high and low priority interrupts. GIEL enables/disables low prioriy interrupts. User's code should only assign interrupts to low priority.

The h/w logic for a low priority interrupt is something like;
Code:
if (GIEH && GIEL && (IPx=lo) && IEx && IFx) then interrupt processor...
There is one exception in Kevin's code base where he is setting up the local CCP hardware for PWM use - during the handful of lines that are setting up, the GIEH flag is used to disable all interrupts. But that is a one shot deal only done at setup. In all the other places I looked, the indivual IE is used to control specific interrups. As far as priority assignment, the following lines show that the interrupts are assigned to low priority.

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.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 09:24.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi