View Single Post
  #1   Spotlight this post!  
Unread 21-02-2004, 18:51
Kevin Karan's Avatar
Kevin Karan Kevin Karan is offline
Linux Guy
AKA: maxdamage
None #0174 (Arctic Warriors)
Team Role: Alumni
 
Join Date: Jan 2003
Location: Liverpool, NY
Posts: 141
Kevin Karan will become famous soon enoughKevin Karan will become famous soon enough
Send a message via AIM to Kevin Karan
Need interupts help, and another question...

Im having a problem getting the interupts working on the FRC. My sensor group has been working all the work period on seperate codes for the trackers, line sensors and encoders using the edubot. This week I ported everything for use on the FRC, but Im having a big problem getting the interupts to work. First, I just used the initialization routines that I made for the edubot, and worked on the edubot, in the FRC code but it didnt work. I tried putting the code out of kevin(.org)'s interupts example (they were almost identical) and still nothing. I tried using the code in first's timers guide but that was also identical. Im having this problems on timers 1,2 and interupts 1-6. Ive tried dissableing all interupts exept for one, but no luck. This is the code im using (as an example) to initialize the interupts for the drive encoders:
Code:
void Initialize_Encoders(void)  
{
	// init interupt 1
	TRISBbits.TRISB2 = 1;		//make input
	INTCON3bits.INT2IP = 0;		//low priority
	INTCON2bits.INTEDG2 = 1;	//rising-edge
	INTCON3bits.INT2IE = 1;		//enable
	
	// init interupt 2
	TRISBbits.TRISB3 = 1;		//make an input
	INTCON2bits.INT3IP = 0;		//low priority
	INTCON2bits.INTEDG3 = 1;	//rising-edge
	INTCON3bits.INT3IE = 1;		//enable
}
This is the code im using to initialize my 1khz timer:
Code:
void Initialize_Timer_2(void)  
{
	TMR2 = 0;				// 8-bit
	PR2	= 249;				// period register
	T2CONbits.T2OUTPS0 = 1;	// 1:10 postscaler
	T2CONbits.T2OUTPS1 = 0;	
	T2CONbits.T2OUTPS2 = 0;	
	T2CONbits.T2OUTPS3 = 1;

	T2CONbits.T2CKPS0 = 1;	// 1/4 prescaler
	T2CONbits.T2CKPS1 = 0;	

	PIE1bits.TMR2IE = 1;	// enable pr2

	IPR1bits.TMR2IP = 0;	// low priority

	T2CONbits.TMR2ON = 1;	// enable
}
I am using kevin(.org)'s interupt hander low (actualy im pretty much using his user_routines_fast.c) which is pretty much identical to FIRST's. The tracker interupt init is FIRST's.
Im calling the inits from User_Initialization like im supposed to.

My other question is if we can exclude some parts of firsts code, like the printf library since they take up a large chunk of the program flash memory and I want to use that space for other stuff.
Thanks,
Kevin Karan
Team 174 Arctic Warriors Programmer
__________________
It isnt ALWAYS the programmers falt!
2004: Buckeye team website award
2002: Rutgers semi-finalists
2001: National semi-finalists
2001: Rutgers semi-finalists
1998: Manchester Rookie All-Star Award