Go to Post Yes, I have lost it! - Alan Anderson [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 18-01-2006, 18:13
Andrew Schreiber Andrew Schreiber is offline
Joining the 900 Meme Team
FRC #0079
 
Join Date: Jan 2005
Rookie Year: 2000
Location: Misplaced Michigander
Posts: 4,071
Andrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond reputeAndrew Schreiber has a reputation beyond repute
Interupts on the Pic18

We are trying to use interupts with our gear tooth sensors. And looking at the data sheet i see about 9 types of interupts. After asking a mentor he was as confused as I.

In short, does anyone know which inputs (other than 1&2) are interupt driven?
  #2   Spotlight this post!  
Unread 18-01-2006, 19:37
CyberWolf_22's Avatar
CyberWolf_22 CyberWolf_22 is offline
Programming and Electrical Mentor
AKA: Allen Gregory
FRC #2587 (Afrobots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Houston, Texas
Posts: 227
CyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really nice
Re: Interupts on the Pic18

Digital Inputs 1-6 all can be interrupts. I would suggest reading Interrupts for Dummies and Kevin Watson's Interrupt code (yes the code it is commented very well).
__________________
  #3   Spotlight this post!  
Unread 18-01-2006, 19:53
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,079
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: Interupts on the Pic18

www.kevin.org/frc. Check the encoder code...a gear-tooth sensor really isn't much different, aside from how it keeps track of direction.

Keep us posted on how those gear-tooth sensors work. We've been able to use them in the past to get a good reading of raw speed, but direction is another beast altogether. Measuring the pulse width seems difficult given the overhead of interrupt calls and other factors.
  #4   Spotlight this post!  
Unread 18-01-2006, 20:32
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: Interupts on the Pic18

Quote:
Originally Posted by Abwehr
Measuring the pulse width seems difficult given the overhead of interrupt calls and other factors.
Yes, this is proving to be difficult. I kinda have it working, but I fear it will all spectacularly fall apart in different interrupt configurations. When I mean spectatular, I mean robot controllers rebooting themselves, going into programming mode and staying there, red-light-of-death, etc. I have at least one more possible solution to investigate, but for now, just use the first two channels of the encoder code.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #5   Spotlight this post!  
Unread 18-01-2006, 20:52
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Interupts on the Pic18

Quote:
Originally Posted by Abwehr
www.kevin.org/frc. Check the encoder code...a gear-tooth sensor really isn't much different, aside from how it keeps track of direction.

Keep us posted on how those gear-tooth sensors work. We've been able to use them in the past to get a good reading of raw speed, but direction is another beast altogether. Measuring the pulse width seems difficult given the overhead of interrupt calls and other factors.
Is your interrupt overhead still bad? We had excellent results timing the sensors using external interrupts. If you continue to have trouble, you can always use an external processor that has capture capabilities.

This year you also have the ability to time an event (using dig input 02 and the ECCP module in capture mode). In addition, you can use dig input 14 to count events on timer 1 or 3.

Just a few possibilities. They are quite limited because almost all of the pins related to useful modules on the processor are not exposed.

I think the most reliable way to approach this is with an external processor that has all of it's modules available. If you are using a quadrature encoder (like the ones that Kevin suggests on his site), then Microchip has processors that can decode that signal for you (I think those processors can decode 3 of those signals simultaneously in hardware). Since it decodes it for you, it counts in the registers. There's no worry about latency. It just happens in hardware. When you want to know how many you have, just go read it.

There are many possibilities, but the external interrupts on the RC should be good enough to measure for the direction.

Cheers!
-Joe
  #6   Spotlight this post!  
Unread 18-01-2006, 20:54
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Interupts on the Pic18

Quote:
Originally Posted by Kevin Watson
Yes, this is proving to be difficult. I kinda have it working, but I fear it will all spectacularly fall apart in different interrupt configurations. When I mean spectatular, I mean robot controllers rebooting themselves, going into programming mode and staying there, red-light-of-death, etc. I have at least one more possible solution to investigate, but for now, just use the first two channels of the encoder code.

-Kevin
Kevin,

What are you trying to do that is causing those problems?

-Joe
  #7   Spotlight this post!  
Unread 18-01-2006, 21: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: Interupts on the Pic18

Quote:
Originally Posted by Joe Hershberger
Kevin,

What are you trying to do that is causing those problems?

-Joe
The 2.4 compiler is brain-dead when it comes to automatically saving data when a low-priority ISR is called. You have to pretty much manually tune the ISR with different compiler #pragma statements. Because I can't anticipate how someone will use my code, I have to err on the conservative side and save quite a bit of data, which introduces a bunch of latency. Trying to capture a 38us pulse when you've got ~50us of latency is a problem. Yes, I know that I don't necessarily have to time the width of the pulse, I could simply check to see if the output is still high when my ISR code finally executes and if it's low, conclude the pulse width is narrower than my latency and therefore one of the 38us pulses flew by. But the problem is this solution is half-arsed and I don't do anything half-arsed <grin>. This and other possible solutions are being explored.

If you'd like to see the RC malfunction, load up the ADC code I posted and change this line in user_routines_fast.c from:

#pragma interruptlow InterruptHandlerLow save=PROD,section(".tmpdata")

to:

#pragma interruptlow InterruptHandlerLow save=PROD

And you should see the RC do things it shouldn't.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #8   Spotlight this post!  
Unread 18-01-2006, 23:43
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Interupts on the Pic18

Quote:
Originally Posted by Kevin Watson
Trying to capture a 38us pulse when you've got ~50us of latency is a problem. Yes, I know that I don't necessarily have to time the width of the pulse, I could simply check to see if the output is still high when my ISR code finally executes and if it's low, conclude the pulse width is narrower than my latency and therefore one of the 38us pulses flew by. But the problem is this solution is half-arsed and I don't do anything half-arsed <grin>. This and other possible solutions are being explored.
-Kevin
Just to add... I have had the same experience as Kevin. The problem is that even if you did the "half-arsed" solution (and I wouldn't recommend it either), one would still have the problem that the whole timing thing is offset by other interrupts that may be happening in the system.

I believe Kevin's right when he said to have hardware between the gear tooth sensor and the microprocessor to discriminate the pulse width and not leave it to the program.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #9   Spotlight this post!  
Unread 19-01-2006, 12:04
kevlarman kevlarman is offline
"why cant i install Linux?" guy
AKA: Roman Tetelman
None #0100
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Belmont, CA
Posts: 11
kevlarman is an unknown quantity at this point
Re: Interupts on the Pic18

Quote:
Originally Posted by Kevin Watson
The 2.4 compiler is brain-dead when it comes to automatically saving data when a low-priority ISR is called. You have to pretty much manually tune the ISR with different compiler #pragma statements. Because I can't anticipate how someone will use my code, I have to err on the conservative side and save quite a bit of data, which introduces a bunch of latency. Trying to capture a 38us pulse when you've got ~50us of latency is a problem. Yes, I know that I don't necessarily have to time the width of the pulse, I could simply check to see if the output is still high when my ISR code finally executes and if it's low, conclude the pulse width is narrower than my latency and therefore one of the 38us pulses flew by. But the problem is this solution is half-arsed and I don't do anything half-arsed <grin>. This and other possible solutions are being explored.

If you'd like to see the RC malfunction, load up the ADC code I posted and change this line in user_routines_fast.c from:

#pragma interruptlow InterruptHandlerLow save=PROD,section(".tmpdata")

to:

#pragma interruptlow InterruptHandlerLow save=PROD

And you should see the RC do things it shouldn't.

-Kevin
speaking of which: does the comment preceding that still have the wrong page number in the compiler manual
  #10   Spotlight this post!  
Unread 21-01-2006, 22:50
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Interupts on the Pic18

Does anyone understand the significance of the INT3IP bit field being turned into a place holder in the p18f8722 header file? I am trying to get code rooted in Kevin's interrupt template code going. After including the different header, I got an error that INT3IP was not defined. An examinatinon of the header, compared to the one for last years controller, revealed a place holder for the bit corresponding to this portion of control register 2. The data sheet for the 18f8722 processor family shows this as a valid field in the control register, so I am wondering what is going on.

Eugene
  #11   Spotlight this post!  
Unread 21-01-2006, 22:54
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Interupts on the Pic18

Quote:
Originally Posted by eugenebrooks
Does anyone understand the significance of the INT3IP bit field being turned into a place holder in the p18f8722 header file? I am trying to get code rooted in Kevin's interrupt template code going. After including the different header, I got an error that INT3IP was not defined. An examinatinon of the header, compared to the one for last years controller, revealed a place holder for the bit corresponding to this portion of control register 2. The data sheet for the 18f8722 processor family shows this as a valid field in the control register, so I am wondering what is going on.

Eugene
Kevin's post on the subject.

There is also a similar error with the Timer0 structure. (At least in the full 2.40 compiler they gave us last year.)
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
Interupts? Validius Programming 6 11-01-2006 18:29
Need interupts help, and another question... Kevin Karan Programming 7 22-02-2004 11:20


All times are GMT -5. The time now is 18:22.

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