Go to Post wood is the original carbon fibre! - dtengineering [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-2007, 13:47
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: Disable Encoders Problem

Quote:
Originally Posted by Qbranch View Post
Make sure to && your interrupt flag with the interrupt enable bit. When interrupt enable is off there will be no jump to the interrupt vector, but the flag will still get set.
I've never understood the && with the enable bit in the interrupt handler. If the interrupt isn't enabled, there will be no jump to the interrupt vector so that test will never be executed. Without the interrupt enabled, it's just an ordinary input pin.
  #2   Spotlight this post!  
Unread 09-02-2007, 14:28
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: Disable Encoders Problem

Quote:
Originally Posted by TimCraig View Post
I've never understood the && with the enable bit in the interrupt handler. If the interrupt isn't enabled, there will be no jump to the interrupt vector so that test will never be executed. Without the interrupt enabled, it's just an ordinary input pin.
Yes, it's weird but Qbranch/Alex is correct. The interrupt flag gets raised (set to one) even if the interrupt is disabled.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #3   Spotlight this post!  
Unread 09-02-2007, 14:29
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Disable Encoders Problem

Quote:
Originally Posted by TimCraig View Post
I've never understood the && with the enable bit in the interrupt handler. If the interrupt isn't enabled, there will be no jump to the interrupt vector so that test will never be executed. Without the interrupt enabled, it's just an ordinary input pin.
There is only one (low-priority) interrupt handler. It will be called when any interrupt occurs, and the handler has to check all the possible sources in order to service the interrupt properly. The program won't know not to deal with a flag for a disabled interrupt unless you also check the associated enable bit. You don't really want a serial port interrupt to end up running the service routine for a "disabled" encoder.
  #4   Spotlight this post!  
Unread 09-02-2007, 18:27
mftaberner mftaberner is offline
Registered User
FRC #0585
 
Join Date: Feb 2007
Location: Tehachapi
Posts: 7
mftaberner is an unknown quantity at this point
Smile Thank you

Thanks for all the help.
  #5   Spotlight this post!  
Unread 09-02-2007, 23:26
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: Disable Encoders Problem

Quote:
Originally Posted by Alan Anderson View Post
There is only one (low-priority) interrupt handler. It will be called when any interrupt occurs, and the handler has to check all the possible sources in order to service the interrupt properly.
Yes, I understand this part. Not as nice as processors that have a separate vector for each interrupt but beggars can't be choosers, I guess.

Quote:
Originally Posted by Alan Anderson View Post
The program won't know not to deal with a flag for a disabled interrupt unless you also check the associated enable bit. You don't really want a serial port interrupt to end up running the service routine for a "disabled" encoder.
This is where I part company with MicroChip's implementation. If you don't enable the interrupt, it should never set the interrupt flag for that interrupt, in my opinion, because an interrupt should not have occurred. I guess one more reason I'll probably opt for something other than PICs for my personal projects.
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
Autonomous enable/disable Culvan Van Li VEX 4 21-09-2006 13:03
Bypass Disable Switch jakep Control System 36 19-08-2006 12:46
Question about human disable Collmandoman Programming 6 10-03-2005 23:30


All times are GMT -5. The time now is 04:52.

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