Go to Post Coming between me and my Hawaiian shirts would be like trying to get between Dean and denim. - dlavery [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 11-02-2006, 18:38
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,185
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Serial Driver and 2K6 Encoder Driver Not compatible

Has anyone else had this problem?

The 2k6 encoder driver works fine on its own. The 2k6 serial driver works fine on its own. Combining them would be easy enough, right?

We have combined them with the interrupt handler below. When what should be interrupt 1 fires (Dig In 1), the Encoder 2 count goes up. (When E2 is positive, E1 is -1. When E2 is negative, E1 is 0) When what is supposed to be Encoder 2 (dig in 2) fires, the Encoder 4 count changes, and the same pattern happens on E3 that happed on E1.

Also, no matter what the tick delta is, E4 always fluctuates in the same direction (backwards in relation to the bot.

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

void InterruptHandlerLow()     
{
	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.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
	}
	if (INTCON3bits.INT2IF && INTCON3bits.INT2IE) // left encoder interrupt?
	{ 
		INTCON3bits.INT2IF = 0; // clear the interrupt flag [91]
		Left_Encoder_Int_Handler(); // call the left encoder interrupt handler (in encoder.c)
		stdout_serial_port=SERIAL_PORT_ONE;
		printf("int 1\r");
		stdout_serial_port=SERIAL_PORT_TWO;
	}
	if (INTCON3bits.INT3IF && INTCON3bits.INT3IE) // right encoder interrupt?
	{
		INTCON3bits.INT3IF = 0; // clear the interrupt flag [91]
		Right_Encoder_Int_Handler(); // call right encoder interrupt handler (in encoder.c)
		stdout_serial_port=SERIAL_PORT_ONE;
		printf("int 2\r");
		stdout_serial_port=SERIAL_PORT_TWO;
	}



}
Any ideas?
  #2   Spotlight this post!  
Unread 11-02-2006, 19:17
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: Serial Driver and 2K6 Encoder Driver Not compatible

seeing the printf's in the interrupt made me dizzy..

I put the rx and tx checks last. That may help you.

I'm not sure what is causing the problem. Maybe more information would help unearth the problem? Like, the header definitions for the encoder driver.
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003
  #3   Spotlight this post!  
Unread 11-02-2006, 19:19
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,185
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Serial Driver and 2K6 Encoder Driver Not compatible

Quote:
Originally Posted by Joel J.
seeing the printf's in the interrupt made me dizzy..

I put the rx and tx checks last. That may help you.

I'm not sure what is causing the problem. Maybe more information would help unearth the problem? Like, the header definitions for the encoder driver.
Yeah that was kind of a last resort thing.. and I just posted the newest version of the code.

The encoder header is unmodified, pulled from this workspace.
http://kevin.org/frc/frc_encoder.zip
  #4   Spotlight this post!  
Unread 12-02-2006, 00:37
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Serial Driver and 2K6 Encoder Driver Not compatible

Quote:
Originally Posted by Tom Bottiglieri
Any ideas?
How many interrupts per second are you generating?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #5   Spotlight this post!  
Unread 12-02-2006, 00:45
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,185
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Serial Driver and 2K6 Encoder Driver Not compatible

I guess the build has tired me out.

I'm not quite sure why I was trying to merge the encoder driver with the serial driver. It comes that way...
  #6   Spotlight this post!  
Unread 12-02-2006, 00:56
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Serial Driver and 2K6 Encoder Driver Not compatible

Quote:
Originally Posted by Joel J.
I put the rx and tx checks last.
Rx should be first thing to check because at 115200 baud you've got less than 100 us to grab the received byte before the next one shows up. Tx should be checked last.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #7   Spotlight this post!  
Unread 12-02-2006, 01:11
Joel J's Avatar
Joel J Joel J is offline
do you..
no team
 
Join Date: May 2001
Rookie Year: 2000
Location: San Jose, CA
Posts: 1,445
Joel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond reputeJoel J has a reputation beyond repute
Re: Serial Driver and 2K6 Encoder Driver Not compatible

I'll make that modification. Thanks for the info.
__________________
Joel Johnson

Division By Zero (229) Alumni, 2003-2007
RAGE (173) Alumni, 1999-2003
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


All times are GMT -5. The time now is 12:52.

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