Go to Post hmmm... big open space between arena and pits... thousands of poof balls...thousands of high school kids hopped up on sugar and robotics.... sounds a little dangerous. - Courtneyb1023 [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 08-02-2008, 11:17
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Interrupts, Interrupts, and more Interrupts!

There seems to be a lot of questions as well as misinformation about PIC18F interrupts and the robot code/devices. I thought a separate thread to ask more general questions would be worthwhile.

The purpose of this thread is share technical information at a detail level that most team members and even programmers won't care about. That's because building a solid device interrupt service routine only needs to be crafted once and then used multiple times. So if you're one of those crazies that want to understand how to craft interrupt service routines then welcome and have at it!


The are a couple documents that serve well for information:

DS31008A 33023a.pdf PICmicro™Mid-Range MCU Family Reference Manual
DS39646B 39646b.pdf PIC18F8722 Family Data Sheet
DS00097D MPLAB® C18 C COMPILER USER’S GUIDE

These documents, and more, are available from the Microchip website. For example, there are chip errata sheets that explain specific flaws that appear in specific chip models and how to get around them. There may be newer versions of the above, but these are the ones I currently have downloaded and use for references.


To answer a question, PLEASE DONT GUESS! Look it up and post the answer and reference if there is one.

For example, someone asked about interrupt latency in another thread. The chip latency is defined in DS31008A above as:

Quote:
Section 8.3
:
Interrupt latency is defined as the time from the interrupt event (the interrupt flag bit gets set) to the time that the instruction at <the interrupt vector address> starts execution (when that interrupt is enabled).

DS31008A-page 8-10
The interrupt latency is 3-4 instruction cycles in all cases, or 0.3-0.4 usec. The lower 0x7FF address range is protected by the configuration bits of the chip within the IFI controller as that is where the boot loader and other code resides. So there is a jump from the standard high/low priority vectors up to relocated vectors at 0x808 and 0x818. The standard IFI low priority interrupt handler starts with

Code:
#pragma code InterruptVectorReset = LOW_INT_VECTOR
void InterruptVectorLow (void)
{
  _asm
    goto InterruptHandlerLow  /*jump to interrupt routine*/
  _endasm
}
This IFI code just jumps to the real start of the service routine. So taking into account the chip latency of 3-4 instruction cycles and two GOTO instructions which are 2 cycles each, the user supplied interrupt handler will take 0.7-0.8usec before it starts execution.

If curious, you an see some of this information in the attached image in MPLAB's View->Program Memory window.
Attached Thumbnails
Click image for larger version

Name:	ProgramMemory.JPG
Views:	123
Size:	120.6 KB
ID:	6239  

Last edited by dcbrown : 08-02-2008 at 11:42.
 


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
How many interrupts is too many interrupts? Madison Programming 14 08-02-2008 12:09
More than 6 RC digital input interrupts? Jared Russell Programming 2 06-02-2007 15:41
Interrupts and Script Conundrums Jon236 Programming 2 08-02-2005 23:01
interrupts and putdata() doy Programming 4 23-02-2004 22:45
Interrupts and rotation sensors kor Programming 3 12-02-2004 11:05


All times are GMT -5. The time now is 23:46.

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