Go to Post CD, you are crazy!!! - Tottanka [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 13-08-2003, 11:15
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
Questions about the pic microcontrollers

I have seen so much information about how the Picc microcontrollers have interupt handlers. What are they and what do they do?
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill

Last edited by Adam Y. : 14-08-2003 at 09:52.
  #2   Spotlight this post!  
Unread 13-08-2003, 12:23
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Adam,

Without getting too detailed, an interrupt is usually a signal to the microprocessor which causes the processor to momentarily halt execution and "call" a subroutine at a specified address.

One of the most popular is a UART (Universal Asynchronous Transmitter/Receiver) for a RS232 communications link. The UART issues an interrupt when it receiver's a character and the interrupt handler takes the character from the UART register and puts it in a queue for use by your program.

After the interrupt handler is finished, it returns to the code where it was interrupted.

Another popular one is a low battery interrupt. The handler saves all your work in temporary files and then initiates a shutdown.

You have interrupts for your hard drive, floppy drive, CDROM, DMA, et cetera. There are also interrupts for a timer to allow multitasking by the operating system.

Interrupts are processed an a priority basis (a higher priority interrupt can interrupt a lower priority).

Hope this short explanation helps.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #3   Spotlight this post!  
Unread 13-08-2003, 19:03
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
Skip over the next paragraph - goto '2'

'1' - Write your thoughts out and store them, you'll want 'em later. On the PIC's (Microchip's abbreviation of "Programmable Interface Controller"), when an interrupt request is sensed, the program counter, which has the location of the instruction being executed, is saved, and refilled by the PIC with "4", the location at which you've cleverly put a small program which saves the registers, figures out which interrupt has occasioned this call, and the "services" the interrupt with an appropriate action. Then it stuffs the old values back in, and resets the program counter to what it was, and goes on from where it left off. Read your thoughts so you recall them, then Return From Interrupt.

'2' - You cleverly put a jump to a location beyond your interrupt service, so the PIC will jump to an executable program on start-up. Before you go on, service an interrupt by going to '1': remember what we're talking about, and where you came from. Carry on with '3'

'4' - At the risk of hearing from interrupt junkies, if you have a loop in your program which is fast enough that you won't notice the time it takes to act on an arising external condition, you don't NEED to use interrupts if you poll your inputs regularly. Return From Subroutine.

'3' - interrupts are available on demand - meaning you program the PIC to respond to things like internal timer overflows, internal watchdog timer timeouts (same thing-different time reg), change in the state of a chosen input pin, overflow from the count associated with a particular pin; all depending on the model of PIC and how you've designed your circuit. As mentioned, some communication processes are capable of generating interrupts, too. Do subroutine '4', now: remember where you are so you can come back. On return, goto '5'.

'5' - You may have noticed that the interrupt service was little different from a subroutine, except that a subroutine is called during the flow of a program, and you have an idea of what you're doing. Time is not as important, so finish what you're doing, and gosub. In an interrupt, it is important to do it NOW - the delay from int to service is called the "Latency" of the interrupt. Just store everything, service it, recall your "thoughts', and get back smoothly to what you were doing before. You want to make the service take as little time as possible, too, because multiple interrupts are sometimes possible.
  #4   Spotlight this post!  
Unread 14-08-2003, 00:26
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Do interrupt handlers matter though?

If we could send out data as soon as an interrupt occurred, so the robot reacted right away, it might matter, but if we just have a similar "Get Input, Process Data, Ouptut, Redo" loop, it won't matter when you process a set of data, because it's all outputted at the same time, no?

I can't see having any system better than we did last year, beyond upping the speed and a better language. Beyond that though, it starts to get really complicated, and most teams would get lost, I think, in programming.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
  #5   Spotlight this post!  
Unread 14-08-2003, 01:10
FotoPlasma FotoPlasma is offline
\: |
no team
 
Join Date: Jul 2001
Rookie Year: 2001
Location: San Jose
Posts: 1,900
FotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond reputeFotoPlasma has a reputation beyond repute
Send a message via AIM to FotoPlasma
Quote:
Originally posted by Ian W.
[Ian's post here.]
The original question wasn't about the robot's control system. It was a general question, with reference to PIC microcontrollers.
__________________
I played hacky sack with Andy Baker.

2001-2004: Team 258, The Sea Dawgs
2005: Team 1693, The Robo Lobos
  #6   Spotlight this post!  
Unread 14-08-2003, 08:25
Unsung FIRST Hero
Matt Leese Matt Leese is offline
Been-In-FIRST-Too-Long
FRC #1438 (The Aztechs)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1998
Location: Long Beach, CA
Posts: 937
Matt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond reputeMatt Leese has a reputation beyond repute
Send a message via AIM to Matt Leese
Quote:
Originally posted by Ian W.
Do interrupt handlers matter though?

If we could send out data as soon as an interrupt occurred, so the robot reacted right away, it might matter, but if we just have a similar "Get Input, Process Data, Ouptut, Redo" loop, it won't matter when you process a set of data, because it's all outputted at the same time, no?

I can't see having any system better than we did last year, beyond upping the speed and a better language. Beyond that though, it starts to get really complicated, and most teams would get lost, I think, in programming.
In a word, yes. The main advantage to interrupts is that they allow you to immediately process an event that occurs (whether that be a low battery condition or data being ready to read) without having to sit in a busy-wait loop looking for it. This means that you can be doing additional background processing at the same time.

Now, it's possible to implement a similiar system without interrupts, but it's significantly much harder and more complicated. Interrupts make the programming cleaner and easier to use.

The way the controller is set up now, interrupts are useless for the most part because all the data is read in at one point in time. If different sections of data were read at different times, this could make quite a bit of difference.

Matt
  #7   Spotlight this post!  
Unread 14-08-2003, 09:56
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
Another question should I learn assembly or go with a compiler? I will probably go with a compiler but I don't know which one. I have narrowed it down to:
http://www.basicmicro.com/ProductDet...x?productID=24
http://www.melabs.com/products/pbc.htm
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill

Last edited by Adam Y. : 14-08-2003 at 10:03.
  #8   Spotlight this post!  
Unread 14-08-2003, 10:26
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
Here is a free C compiler for the PIC devices, it is pretty nice

http://www.picant.com/c2c/c.html
__________________
Robonaut Next Generation Control System Development

2003 GLR Champions (302,67,226)
2003 Buckeye Semi-Finalists(902,494,226)
2002 Nationals QuarterFinalists
2001 West MI QuarterFinalists
2000 GLR Semi-Finalists
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
New Controller programmable in C dez250 Programming 48 02-10-2003 19:28


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

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