Go to Post Part of FRC and design/engineering is perseverance. Keep your chin up, your thoughts positive, and have respect for your work and the work of your teammates. - Nathan_Fraser [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 08-02-2007, 22:21
mftaberner mftaberner is offline
Registered User
FRC #0585
 
Join Date: Feb 2007
Location: Tehachapi
Posts: 7
mftaberner is an unknown quantity at this point
Exclamation Disable Encoders Problem

This is the first year our team has used the encoders and we have discovered you need to disable any inactive encoders. Kevin's readme in the encoder project sais that instructions to disable encoders are in the encoder.h file. After checking the latest code, no instructions were found.

Are the instructions in another file or can someone give help on disabling the encoders.
  #2   Spotlight this post!  
Unread 08-02-2007, 23:44
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Disable Encoders Problem

All you need to do is the following:

1. Open "encoder.h"

2. Find the lines that look like:

Code:
#define ENABLE_ENCODER_1
#define ENABLE_ENCODER_2
#define ENABLE_ENCODER_3
#define ENABLE_ENCODER_4
#define ENABLE_ENCODER_5
#define ENABLE_ENCODER_6
3. Comment out any line that corresponds to an encoder you aren't using. For example, if you are only using encoders 1 and 3, you should make the section look like the following:

Code:
#define ENABLE_ENCODER_1
//#define ENABLE_ENCODER_2
#define ENABLE_ENCODER_3
//#define ENABLE_ENCODER_4
//#define ENABLE_ENCODER_5
//#define ENABLE_ENCODER_6
4. Re-compile. Voila!
  #3   Spotlight this post!  
Unread 08-02-2007, 23: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 mftaberner View Post
This is the first year our team has used the encoders and we have discovered you need to disable any inactive encoders. Kevin's readme in the encoder project sais that instructions to disable encoders are in the encoder.h file. After checking the latest code, no instructions were found.

Are the instructions in another file or can someone give help on disabling the encoders.
Just disable the interrupts the encoder is attached to. The encoder will continue to generate the signal but the processor will ignore it and the interrupt routine will not be executed.
  #4   Spotlight this post!  
Unread 09-02-2007, 00:35
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Disable Encoders Problem

Quote:
Originally Posted by TimCraig View Post
Just disable the interrupts the encoder is attached to. The encoder will continue to generate the signal but the processor will ignore it and the interrupt routine will not be executed.
Tim,

I would still recommend that he comment out the #defines in the header file. Doing so would both disable irrelevant interrupts, and eliminate code that won't be called anyway from the hex file.
  #5   Spotlight this post!  
Unread 09-02-2007, 05:22
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 Abwehr View Post
Tim,

I would still recommend that he comment out the #defines in the header file. Doing so would both disable irrelevant interrupts, and eliminate code that won't be called anyway from the hex file.
When he said he wanted to disable an inactive encoder, I took it to mean the encoder was to be active for a while, possibly during autonomous, and then be disabled, not that the encoder was totally absent.
  #6   Spotlight this post!  
Unread 09-02-2007, 07:28
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Disable Encoders Problem

Quote:
Originally Posted by TimCraig View Post
Just disable the interrupts the encoder is attached to. The encoder will continue to generate the signal but the processor will ignore it and the interrupt routine will not be executed.
Remember.... watch out though. 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. Didnt know if your encoder code already had this or not.

good luck, and if I can help, gimme a yell.

-Q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #7   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.
  #8   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
  #9   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.
  #10   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.
  #11   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 00:29.

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