Go to Post On these forums, there are so many people that we see working all of the time to try to help teams out, and just overall good people. To everyone who does that, thanks. - miketwalker [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
  #10   Spotlight this post!  
Unread 05-02-2006, 09:51
Jon236's Avatar
Jon236 Jon236 is offline
Registered User
AKA: Jon Mittelman
FRC #2648 (Infinite Loop)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Windsor, Maine
Posts: 741
Jon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond reputeJon236 has a reputation beyond repute
Re: Problems Combining Camera Code and Driving Code

Quote:
Originally Posted by kaszeta
You should need an interrupt handler for tx1, rx1, tx2, and rx2, unless you are also using encoders, the adc code, or the gyro (which uses the adc code).

We do use all of those, and it's working fine. Here's our InterruptHandlerLow:

Code:
#pragma code

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



void InterruptHandlerLow(void)     

{                               

	unsigned char Port_B;

	unsigned char Port_B_Delta;

	

	if(PIR1bits.RC1IF && PIE1bits.RC1IE) // rx1 interrupt?

	{

		#ifdef ENABLE_SERIAL_PORT_ONE_RX

		Rx_1_Int_Handler(); // call the rx1 interrupt handler (in serial_ports.c)

		#endif

	}                              

	else if(PIR3bits.RC2IF && PIE3bits.RC2IE) // rx2 interrupt?

	{

		#ifdef ENABLE_SERIAL_PORT_TWO_RX

		Rx_2_Int_Handler(); // call the rx2 interrupt handler (in serial_ports.c)

		#endif

	} 

	else if(PIR1bits.TMR2IF && PIE1bits.TMR2IE) // timer 2 interrupt?

	{

		PIR1bits.TMR2IF = 0; // clear the timer 2 interrupt flag [92]

		Timer_2_Int_Handler(); // call the timer 2 interrupt handler (in adc.c)

	}                     

	else if(PIR1bits.ADIF && PIE1bits.ADIE) // ADC interrupt

	{

		PIR1bits.ADIF = 0; // clear the ADC interrupt flag

		ADC_Int_Handler(); // call the ADC interrupt handler (in adc.c)

	}

	else if (INTCON3bits.INT2IF && INTCON3bits.INT2IE) // encoder 1 interrupt?

	{ 

		INTCON3bits.INT2IF = 0; // clear the interrupt flag

		#ifdef ENABLE_ENCODER_1

		Encoder_1_Int_Handler(); // call the left encoder interrupt handler (in encoder.c)

		#endif

	}

	else if (INTCON3bits.INT3IF && INTCON3bits.INT3IE) // encoder 2 interrupt?

	{

		INTCON3bits.INT3IF = 0; // clear the interrupt flag

		#ifdef ENABLE_ENCODER_2

		Encoder_2_Int_Handler(); // call right encoder interrupt handler (in encoder.c)

		#endif

	}

	else if (INTCONbits.RBIF && INTCONbits.RBIE) // encoder 3-6 interrupt?

	{

		Port_B = PORTB; // remove the "mismatch condition" by reading port b            

		INTCONbits.RBIF = 0; // clear the interrupt flag

		Port_B_Delta = Port_B ^ Old_Port_B; // determine which bits have changed

		Old_Port_B = Port_B; // save a copy of port b for next time around

	 

		if(Port_B_Delta & 0x10) // did external interrupt 3 change state?

		{

			#ifdef ENABLE_ENCODER_3

			Encoder_3_Int_Handler(Port_B & 0x10 ? 1 : 0); // call the encoder 3 interrupt handler (in encoder.c)

			#endif

		}

		if(Port_B_Delta & 0x20) // did external interrupt 4 change state?

		{

			#ifdef ENABLE_ENCODER_4

			Encoder_4_Int_Handler(Port_B & 0x20 ? 1 : 0); // call the encoder 4 interrupt handler (in encoder.c)

			#endif

		}

		if(Port_B_Delta & 0x40) // did external interrupt 5 change state?

		{

			#ifdef ENABLE_ENCODER_5

			Encoder_5_Int_Handler(Port_B & 0x40 ? 1 : 0); // call the encoder 5 interrupt handler (in encoder.c)

			#endif

		}

		if(Port_B_Delta & 0x80) // did external interrupt 6 change state?

		{

			#ifdef ENABLE_ENCODER_6

			Encoder_6_Int_Handler(Port_B & 0x80 ? 1 : 0); // call the encoder 6 interrupt handler (in encoder.c)

			#endif

		}

	}

	else if(PIR1bits.TX1IF && PIE1bits.TX1IE) // tx1 interrupt?

	{

		#ifdef ENABLE_SERIAL_PORT_ONE_TX

		Tx_1_Int_Handler(); // call the tx1 interrupt handler (in serial_ports.c)

		#endif

	}                              

	else if(PIR3bits.TX2IF && PIE3bits.TX2IE) // tx2 interrupt?

	{

		#ifdef ENABLE_SERIAL_PORT_TWO_TX

		Tx_2_Int_Handler(); // call the tx2 interrupt handler (in serial_ports.c)

		#endif

	}

}
I've made all of those changes and still get the RLOD. We use the interrupts, timers, rx1&2 tx1&2.

Any other thoughts?

Jon
 


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
What is wrong with this code???? It won't Compile and I don't know why? Please Help CrashZero Programming 23 26-03-2004 09:44


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

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