Go to Post I bet a lot of us (mentors and students) got into this line of work first because we wondered how things work, and stayed in it because we thought "I can make that work better". Thus starts a life-long battle between perfection and time. So far, time is ahead. - petek [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
  #31   Spotlight this post!  
Unread 04-02-2005, 23:07
dmurdz's Avatar
dmurdz dmurdz is offline
Registered User
AKA: Dan
FRC #1027 (Mechatronic Maniacs)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: West Springfield, Massachusetts
Posts: 54
dmurdz is on a distinguished road
Send a message via AIM to dmurdz Send a message via MSN to dmurdz
Re: encoders

Im working on my programming, when it comes to my code I do not know how to set up my interrupt handlers, is there demo code some where for this???
  #32   Spotlight this post!  
Unread 05-02-2005, 00:11
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: encoders

Quote:
Originally Posted by dmurdz
Im working on my programming, when it comes to my code I do not know how to set up my interrupt handlers, is there demo code some where for this???
See http://www.kevin.org/frc/ for lots of example programs, many of which are complete drop-in modules. Scroll down to frc_encoder.zip for interrupt-based encoder code.
  #33   Spotlight this post!  
Unread 05-02-2005, 10:20
dmurdz's Avatar
dmurdz dmurdz is offline
Registered User
AKA: Dan
FRC #1027 (Mechatronic Maniacs)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: West Springfield, Massachusetts
Posts: 54
dmurdz is on a distinguished road
Send a message via AIM to dmurdz Send a message via MSN to dmurdz
Re: encoders

Sample code from Kevin on www.kevin.org/frc, the interrupts program, in file interrupts.c, there is a spot that says:

/************************************************** *****************************
*
* FUNCTION: Int_3_Handler()
*
* PURPOSE: If enabled, the interrupt 3 handler is called when the
* interrupt 3/digital input 3 pin changes logic level.
*
* CALLED FROM: user_routines_fast.c/InterruptHandlerLow()
*
* PARAMETERS: RB4_State is the current logic level of the
* interrupt 3 pin.
*
* RETURNS: Nothing
*
* COMMENTS: The PIC18F8520's RB4/KBI0 pin on port b is mapped to
* interrupt 3 on the EDU-RC and digital input 3 on the
* FRC-RC [108].
*
************************************************** *****************************/
void Int_3_Handler(unsigned char RB4_State)
{
// this function will be called when an interrupt 3 occurs
}

Is this the final code??? What do I need to add???

HELP!!!!!!!!!!!!!!!!
  #34   Spotlight this post!  
Unread 05-02-2005, 12:52
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: encoders

Quote:
Originally Posted by dmurdz
Is this the final code??? What do I need to add???
It's just template code that shows you how to setup the interrupts. Check out some of the other examples that show you what you can do with interrupts.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #35   Spotlight this post!  
Unread 05-02-2005, 13:43
dmurdz's Avatar
dmurdz dmurdz is offline
Registered User
AKA: Dan
FRC #1027 (Mechatronic Maniacs)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: West Springfield, Massachusetts
Posts: 54
dmurdz is on a distinguished road
Send a message via AIM to dmurdz Send a message via MSN to dmurdz
Re: encoders

where can I find the other examples for interrupts?
  #36   Spotlight this post!  
Unread 05-02-2005, 13:44
roboticsjenkins's Avatar
roboticsjenkins roboticsjenkins is offline
robotics_jenkins
AKA: Andrew
#0616 (Southampton Indian Robotics)
Team Role: Electrical
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Courtland, Virginia
Posts: 15
roboticsjenkins can only hope to improve
Send a message via AIM to roboticsjenkins Send a message via Yahoo to roboticsjenkins
Re: encoders

How do I hook up th encoders to the RC. I know that they go on Digital I/O, but do I use two PWM CABLES to hook each encoder up or what do I do? Someone please help me.
__________________
  #37   Spotlight this post!  
Unread 05-02-2005, 15:48
stephenthe1 stephenthe1 is offline
Registered User
#1008
 
Join Date: Dec 2004
Location: Ohio
Posts: 113
stephenthe1 is on a distinguished road
Re: encoders

ok, I'm assuming you have a quadrature encoder (this means there are 4 places to hook up wires on the encoder). 1 is the + power pin. 1 is the - (ground) pin. one is the phase -a pin, and one is the phase b pin. this requires two digital ports on the rc. I'm assuming you are using Kevin watson's encoder template (the only way to do this if your a beginner). hook up the +, -, and phase a wires on the digital io 1. then put the phase b wire on digital io (I think, but check the template read me provided b Mr. Watson) on digital io 6. this is how the "left" motor encoder, or w/e our using it for is hooked up.

don't feel too bad, I had this same problem about a month ago, I started a couple threads before I was able to understand it.

hope this helps,
Stephen

Last edited by stephenthe1 : 05-02-2005 at 16:04.
  #38   Spotlight this post!  
Unread 05-02-2005, 16:16
roboticsjenkins's Avatar
roboticsjenkins roboticsjenkins is offline
robotics_jenkins
AKA: Andrew
#0616 (Southampton Indian Robotics)
Team Role: Electrical
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Courtland, Virginia
Posts: 15
roboticsjenkins can only hope to improve
Send a message via AIM to roboticsjenkins Send a message via Yahoo to roboticsjenkins
Re: encoders

Let me see if I have this right I have to hook one encoder to two different Digital I/O ports?...I'm so confused
__________________
  #39   Spotlight this post!  
Unread 05-02-2005, 16:25
stephenthe1 stephenthe1 is offline
Registered User
#1008
 
Join Date: Dec 2004
Location: Ohio
Posts: 113
stephenthe1 is on a distinguished road
Re: encoders

ok here it is, and yes, one encoder to two digital IO's. did you read what I said carefully? um, check to see if there are four pins on the encoder, if there are, then you need two digital ios. here-

dig. io 1 ------- phase a pin ------- positive power --------negative power

dig. io 6 ------- phase b pin (only, no power or anything here)

if this doesn't make sense, then you really need to go to the white papers section and read up on interrupts a little and on encoders, and read through the comments on mr. Watson's code. questions are fine, but really, after reading this, you shouldn't be having any problems.
  #40   Spotlight this post!  
Unread 07-02-2005, 07:24
stephenthe1 stephenthe1 is offline
Registered User
#1008
 
Join Date: Dec 2004
Location: Ohio
Posts: 113
stephenthe1 is on a distinguished road
Re: encoders

(didn't mean to sound mad ) came out that way I guess
  #41   Spotlight this post!  
Unread 07-02-2005, 15:47
dmurdz's Avatar
dmurdz dmurdz is offline
Registered User
AKA: Dan
FRC #1027 (Mechatronic Maniacs)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: West Springfield, Massachusetts
Posts: 54
dmurdz is on a distinguished road
Send a message via AIM to dmurdz Send a message via MSN to dmurdz
Re: encoders

Is it possible to change these pins if you adjust the code???
  #42   Spotlight this post!  
Unread 07-02-2005, 16:21
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: encoders

Quote:
Originally Posted by dmurdz
Is it possible to change these pins if you adjust the code???
The phase-A signals must be tied to an interrupt. The phase-B signals can be tied to any digital input. See encoder.h for directions.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #43   Spotlight this post!  
Unread 07-02-2005, 21:21
dmurdz's Avatar
dmurdz dmurdz is offline
Registered User
AKA: Dan
FRC #1027 (Mechatronic Maniacs)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: West Springfield, Massachusetts
Posts: 54
dmurdz is on a distinguished road
Send a message via AIM to dmurdz Send a message via MSN to dmurdz
Re: encoders

Quote:
Originally Posted by Kevin Watson
The phase-A signals must be tied to an interrupt. The phase-B signals can be tied to any digital input. See encoder.h for directions.

-Kevin

What do you mean " phase-A signals must be tied to an interrupt", can i hook them up to digital i/o pins 3-6???
  #44   Spotlight this post!  
Unread 07-02-2005, 23:40
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: encoders

Quote:
Originally Posted by dmurdz
What do you mean " phase-A signals must be tied to an interrupt", can i hook them up to digital i/o pins 3-6???
One of the two phases of the encoder needs to be able to interrupt the processor. Putting it on pin 1 or pin 2 makes that easy, with each pin causing its own interrupt upon the desired edge of the connected signal. Using pins 3-6 complicates the software quite a bit, because those pins all cause the same physical interrupt no matter which pin changed, and no matter which direction the signal transition went. You can still do it (in fact, you have to do it if you're using more than two encoders), but you need to know which bits of PortB mean what, and you need to do your own software filtering of signal transition direction. It takes a lot more work to do it that way rather than letting the RC hardware do it for you.
  #45   Spotlight this post!  
Unread 08-02-2005, 07:23
stephenthe1 stephenthe1 is offline
Registered User
#1008
 
Join Date: Dec 2004
Location: Ohio
Posts: 113
stephenthe1 is on a distinguished road
Re: encoders

I would suggest, especially Mr. Watson has it set up this way, putting the phase a's on 1-6, and b's on any other pins. Unless you can't already figure the direction your going, it won't be important to inerrupt the phase b's.
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
Mechanical Wheel Encoders? Jaine Perotti Electrical 15 04-12-2004 22:46
Shaft Encoders wun Programming 3 12-10-2004 16:40
encoders? what kind and where from? ajlapp Electrical 1 03-02-2004 01:49
Who used wheel encoders CyberWolf_22 Technical Discussion 12 04-05-2003 15:37


All times are GMT -5. The time now is 13:14.

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