Go to Post I would rather Andy Baker be at champs than Will.i.am. - Grim Tuesday [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 12-02-2005, 14:27
Dean Dean is offline
Registered User
#0201
 
Join Date: Feb 2005
Location: rochester
Posts: 1
Dean is an unknown quantity at this point
Question enable interrupt

I am trying to use an encoder and want to use interrupts, but I cannot figure out how to enable them! How do you enable interrupts? I have it programmed, just not enabled!
  #2   Spotlight this post!  
Unread 12-02-2005, 14:37
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: enable interrupt

You need to call "Initialize_Interrupts();"..
...which is called in user_routines.c under function "void User_Initialization (void)" (at least in my teams code it works there)
__________________
- from B B frank


Last edited by AIBob : 12-02-2005 at 14:41.
  #3   Spotlight this post!  
Unread 13-02-2005, 07:37
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: enable interrupt

Quote:
Originally Posted by AIBob
You need to call "Initialize_Interrupts();"..
...which is called in user_routines.c under function "void User_Initialization (void)" (at least in my teams code it works there)
He's refering to Kevin Watson's interrupt code which is avialable at http://www.kevin.org/frc.

If you want to just turn on the interrupts without having to go through that, then you'll have something like this in User_Initialization() (Or somewhere are there. You just have to do this before the interrupts are on)
I just copied this from the function in Watson's code which was referred to earlier, with one change (in bold) which actually enables the interrupt. Kevin's code just sets it up.
Code:
TRISBbits.TRISB2 = 1;	// make sure the RB2/INT2 pin is configured as an input [108]
INTCON3bits.INT2IP = 0;	// 0: interrupt 1 is low priority (leave at 0 for IFI controllers) [91]
			// 1: interrupt 1 is high priority
INTCON2bits.INTEDG2 = 0;// 0: trigger on the falling-edge [90]
			// 1: trigger on the rising-edge
INTCON3bits.INT2IF = 0;	// 0: external interrupt 1 hasn't happened (set to 0 before enabling the interrupt) [91]
			// 1: external interrupt 1 has happened
INTCON3bits.INT2IE = 1;	// 0: disable interrupt	1 [91]
			// 1: enable interrupt 1
That enables the interrupt on digital input 1. To learn how to do the rest, I'd look at Mr. Watson's code and read this white paper.
__________________


Last edited by Ryan M. : 13-02-2005 at 07:39.
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
heres the code. y this not working omega Programming 16 31-03-2004 15:18
Timer interrupt hic-cupping - HELP roknjohn Programming 9 15-03-2004 17:56
Interrupt Handlers and Variable Scope kaszeta Programming 2 14-02-2004 18:30
Easy interrupt setup steven114 Programming 3 04-02-2004 00:07
Interrupts Questions mightywombat Programming 0 03-01-2004 14:50


All times are GMT -5. The time now is 09:25.

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