Go to Post Please no reboots. I'm so sick of reboots. Hollywood has ruined them for me. I don't even reboot my computer anymore. - Michael Hill [more]
Home
Go Back   Chief Delphi > Technical > Robotics Education and Curriculum
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 20-12-2003, 03:01
misterikkit's Avatar
misterikkit misterikkit is offline
will code for food
AKA: Jon B
#0258 (Sea Dawgs)
Team Role: Programmer
 
Join Date: Dec 2003
Location: San Jose, CA
Posts: 7
misterikkit will become famous soon enoughmisterikkit will become famous soon enough
Send a message via AIM to misterikkit
Question Optical Encoders

Does anyone know how to go about using the optical encoders (as in a mouse) w/interrupts in our new controllers?
I have two for each axis coming out of the mouse I got at the WRRF programming seminar, and I'd like to use them.

Thanks!
__________________
-j
[:\\|//: ]
  #2   Spotlight this post!  
Unread 20-12-2003, 11:55
IrisLab's Avatar
IrisLab IrisLab is offline
Mentor
AKA: Dave Page
#1466 (Webb School)
Team Role: Mentor
 
Join Date: Dec 2003
Location: Knoxville, Tennessee
Posts: 33
IrisLab will become famous soon enough
Question Re: Optical Encoders

Along these lines...

a) What encoders from Digikey have teams had success with? What part numbers? Are these up for the rigors of competition?

b) Where do most teams mount encoders on the wheel shafts? on a special gear for encoding?

c) How counts per revolutoin (CPR) do most teams use? What design strategy do most teams use when seleteting CPR and encoders in general?

d) Custom circuits? Or us RC PIC interrupts directly? What the trade-offs?

Just curiuos.
  #3   Spotlight this post!  
Unread 20-12-2003, 14:26
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: Optical Encoders

Quote:
Originally Posted by misterikkit
Does anyone know how to go about using the optical encoders (as in a mouse) w/interrupts in our new controllers?
I have two for each axis coming out of the mouse I got at the WRRF programming seminar, and I'd like to use them.

Thanks!
You promted me to create some example code that should work with your mouse encoders. Details can be found in this thread. Enjoy.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #4   Spotlight this post!  
Unread 22-12-2003, 03:41
The Lucas's Avatar
Happy Birthday! The Lucas The Lucas is offline
CaMOElot, it is a silly place
AKA: My First Name is really "The" (or Brian)
FRC #0365 (The Miracle Workerz); FRC#1495 (AGR); FRC#4342 (Demon)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Dela-Where?
Posts: 1,564
The Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond reputeThe Lucas has a reputation beyond repute
Send a message via AIM to The Lucas
Re: Optical Encoders

Kevin, Great work on the interupt coding. You saved be a good deal of time looking for the names of the bits I needed to set. I think I noticed an error where the bits for timers 3 and 4 were polled in user_routines_fast.c:

else if (PIR1bits.TMR1IF) // timer 3 interrupt?
{
PIR2bits.TMR3IF = 0; // clear the timer 3 interrupt flag [93]
Timer_3_Int_Handler(); // call the timer 3 interrupt handler (in interrupts.c)
}
else if (PIR1bits.TMR2IF) // timer 4 interrupt?
{
PIR3bits.TMR4IF = 0; // clear the timer 4 interrupt flag [94]
Timer_4_Int_Handler(); // call the timer 4 interrupt handler (in interrupts.c)
}

Should it be "else if (PIR2bits.TMR3IF)" and "else if (PIR3bits.TMR4IF)"? I do things like that all the time after copying chunks of code. Thanks again.
__________________
Electrical & Programming Mentor ---Team #365 "The Miracle Workerz"
Programming Mentor ---Team #4342 "Demon Robotics"
Founding Mentor --- Team #1495 Avon Grove High School
2007 CMP Chairman's Award - Thanks to all MOE members (and others) past and present who made it a reality.
Robot Inspector
"I don't think I'm ever more ''aware'' than I am right after I burn my thumb with a soldering iron"
  #5   Spotlight this post!  
Unread 22-12-2003, 11:08
misterikkit's Avatar
misterikkit misterikkit is offline
will code for food
AKA: Jon B
#0258 (Sea Dawgs)
Team Role: Programmer
 
Join Date: Dec 2003
Location: San Jose, CA
Posts: 7
misterikkit will become famous soon enoughmisterikkit will become famous soon enough
Send a message via AIM to misterikkit
Re: Optical Encoders

So wait, I don't quite understand how to use interrupts. Are those macros you're using to refer to interrupt pins? Do I have to write code that invokes the handler?
__________________
-j
[:\\|//: ]
  #6   Spotlight this post!  
Unread 22-12-2003, 13: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: Optical Encoders

Quote:
Originally Posted by The Lucas
I think I noticed an error where the bits for timers 3 and 4 were polled in user_routines_fast.c...
Brian,

Ugh, you're right and it does look like I just copied the lines above and forgot to change the if() statements. Thanks for catching that. I've updated the code on the website.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #7   Spotlight this post!  
Unread 22-12-2003, 14:04
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: Optical Encoders

Quote:
Originally Posted by misterikkit
So wait, I don't quite understand how to use interrupts. Are those macros you're using to refer to interrupt pins?
No, I'm manipulating the memory-mapped bits directly. The bits are defined in ifi_picdefs.h.


Quote:
Originally Posted by misterikkit
Do I have to write code that invokes the handler?
No, that's one of the cool things about interrupts: The hardware executes your code in the interrupt handler automatically when some event happens (e.g., a timer rolls-over or an interrupt pin changes from a 0 to a 1).
What you do need to do is configure the interrupt hardware so it knows how to behave (e.g., interrupt on the rising-edge or falling-edge of the signal on the interrupt pin). Have a look at the interrupt initialization routines for a description of the various ways to configure an interrupt. Also have a look at user_routines_fast.c because this is where the interrupt handlers are mapped to the different types of interrupts.

My goal is to get folks using interrupts, so if you have additional questions, ask away.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #8   Spotlight this post!  
Unread 22-12-2003, 23:13
misterikkit's Avatar
misterikkit misterikkit is offline
will code for food
AKA: Jon B
#0258 (Sea Dawgs)
Team Role: Programmer
 
Join Date: Dec 2003
Location: San Jose, CA
Posts: 7
misterikkit will become famous soon enoughmisterikkit will become famous soon enough
Send a message via AIM to misterikkit
Re: Optical Encoders

Okay, I'll post questions as I come across them.

To start, how are all those structs in picdefs 'memory mapped'?
__________________
-j
[:\\|//: ]
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
Who used wheel encoders CyberWolf_22 Technical Discussion 12 04-05-2003 15:37
optical sensors majormusic2005 Electrical 5 11-03-2003 21:32
Q&A Discuss: optical sensors CD47-Bot Extra Discussion 0 15-02-2003 22:58
optical sensors great_one411 General Forum 1 15-02-2003 19:54
range of optical sensors Allie Technical Discussion 1 29-01-2002 09:09


All times are GMT -5. The time now is 17:36.

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