Go to Post I hate to do say it with these words but...We're all in this together. - dellagd [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 18-02-2007, 14:19
cgront's Avatar
cgront cgront is offline
Registered User
None #0159
Team Role: Operator
 
Join Date: Jan 2006
Rookie Year: 2000
Location: blah blah
Posts: 5
cgront is an unknown quantity at this point
Encoder Problemo

Help! It's not displaying the data frrom the encoders. Please any help would be appreciated asap
we checked the encoders and they are wired correctly.
we are trying to print the functions which should return the values in the code.

Thank you.
__________________
some of Murphy's Laws of Computing


1)When computing, whatever happens, behave as though you meant it to happen.

  #2   Spotlight this post!  
Unread 18-02-2007, 14:21
robind robind is offline
Registered User
FRC #0675
 
Join Date: Dec 2006
Location: Rohnert Park
Posts: 31
robind is an unknown quantity at this point
Re: Encoder Problemo

Are you sure you followed all the steps in the encoder readme for enabling the encoders? I.E. uncommenting the #defines in encoders.h to enable the encoders?
  #3   Spotlight this post!  
Unread 18-02-2007, 14:41
Seamus's Avatar
Seamus Seamus is offline
fattest man west of the equator
AKA: Fatman
FRC #1647 (Iron Devils)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2006
Location: The Future
Posts: 4
Seamus is an unknown quantity at this point
Re: Encoder Problemo

Yes we followed the readme and are still getting zero
Yes I am on cgront's team
  #4   Spotlight this post!  
Unread 18-02-2007, 15:19
Seamus's Avatar
Seamus Seamus is offline
fattest man west of the equator
AKA: Fatman
FRC #1647 (Iron Devils)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2006
Location: The Future
Posts: 4
Seamus is an unknown quantity at this point
Re: Encoder Problemo

Do we have to call an encoder function after initialization?
if so Where?
  #5   Spotlight this post!  
Unread 18-02-2007, 16:19
Seamus's Avatar
Seamus Seamus is offline
fattest man west of the equator
AKA: Fatman
FRC #1647 (Iron Devils)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2006
Location: The Future
Posts: 4
Seamus is an unknown quantity at this point
Re: Encoder Problemo

somebody please respond to this please
  #6   Spotlight this post!  
Unread 18-02-2007, 16:25
Coz's Avatar
Coz Coz is offline
Registered User
FRC #1647 (Iron Devils)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2006
Location: The Future
Posts: 3
Coz is an unknown quantity at this point
Re: Encoder Problemo

We need help!
__________________
Their are no stupid answers!
  #7   Spotlight this post!  
Unread 18-02-2007, 16:30
Tureyhall Tureyhall is offline
Registered User
AKA: Thomas Hall
FRC #0668 (Apes Of Wrath)
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2004
Location: San Jose
Posts: 40
Tureyhall will become famous soon enoughTureyhall will become famous soon enough
Re: Encoder Problemo

posting the code that isn't working is always a good way to get help.
__________________
/*Nerd Camouflage*/

2005 SVR - 668+1072+840 - Semifinalists.
2006 SVR - 668+1280+1693 - Finalists.
2007 SVR - 668+604+624 - Quarter-finalists, Xerox Creativity Award, two highest scores (290-2, 128-0) at SVR.
2007 Nat's - TBA.
  #8   Spotlight this post!  
Unread 18-02-2007, 16:32
Coz's Avatar
Coz Coz is offline
Registered User
FRC #1647 (Iron Devils)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2006
Location: The Future
Posts: 3
Coz is an unknown quantity at this point
Re: Encoder Problemo

we can not because its the whole project.
__________________
Their are no stupid answers!
  #9   Spotlight this post!  
Unread 18-02-2007, 16:58
Ari Allyn-Feuer Ari Allyn-Feuer is offline
Registered User
FRC #0753
 
Join Date: Feb 2006
Location: Bend, OR
Posts: 22
Ari Allyn-Feuer is on a distinguished road
Re: Encoder Problemo

How are you getting the data out of Kevin's variables? Do you just have a printf grabbing it out? Or do you hand it to one of your variables and then printf? How do you know it's really zero? Did you do the printf right? I messed up and spent two days futzing with encoders when the problem was in a printf call once.

Can you try to show me the parts of the code where the Encoders are dealt with? Forget Kevin's code, show me what you did?

Ari.
  #10   Spotlight this post!  
Unread 18-02-2007, 17:02
jesusescobar's Avatar
jesusescobar jesusescobar is offline
Jesus Escobar- PFTB-Programer
FRC #2066 (Pftb Of Doom)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: El Centro California
Posts: 32
jesusescobar is an unknown quantity at this point
Send a message via MSN to jesusescobar Send a message via Yahoo to jesusescobar
Re: Encoder Problemo

first of all did you make that function or did you add an exsiting function to the program your making are you getting an linking error or what maybe the globals are wrong


(are you using easyc)
__________________
Beware Of PFTB OF DOOM Robotics Team From EL Centro California Southwest Eagles!!!!!!!!!

http://pftbrobotics.com Our Site
  #11   Spotlight this post!  
Unread 18-02-2007, 17:06
BossOfTheGame BossOfTheGame is offline
Not the garbage man
FTC #0020 (The Rocketeers)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2003
Location: Clifton Park
Posts: 6
BossOfTheGame will become famous soon enough
Send a message via AIM to BossOfTheGame
Re: Encoder Problemo

Did you remember to #include <stdio> ? Did you do something like:

int myVar = 0;

printf("This is %d",myVar); ?
__________________
printf > System.out.println
  #12   Spotlight this post!  
Unread 18-02-2007, 17:40
cgront's Avatar
cgront cgront is offline
Registered User
None #0159
Team Role: Operator
 
Join Date: Jan 2006
Rookie Year: 2000
Location: blah blah
Posts: 5
cgront is an unknown quantity at this point
Re: Encoder Problemo

In encoder.h, we modified it to have the digital imputs 12 and 13 for encoders 1 and 2.

From encoder.h:
Code:
#ifndef _encoder_h
#define _encoder_h

#define ENABLE_ENCODER_1 //right
#define ENABLE_ENCODER_2 //left

#define ENCODER_1_PHASE_B_PIN	rc_dig_in12 //right
#define ENCODER_2_PHASE_B_PIN	rc_dig_in13 //left

#define ENCODER_1_TICK_DELTA	1
#define ENCODER_2_TICK_DELTA	1
From userroutinesfast.c:

Code:
#pragma code
//#pragma interruptlow InterruptHandlerLow save=PROD,section(".tmpdata")
#pragma interruptlow InterruptHandlerLow save=PROD //encoder
void InterruptHandlerLow (void)     
{
	unsigned char int_byte;
unsigned char Port_B;//encoder
	unsigned char Port_B_Delta;//encoder
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
	}
	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)       /* The INT2 pin is RB2/DIG I/O 1. */
	{
		INTCON3bits.INT2IF = 0;
	//	printf("Left Interrupt hit\r");
	//	Left_Encoder_Int_Handler();
	}
	else if(INTCON3bits.INT3IF && INTCON3bits.INT3IE)  /* The INT3 pin is RB3/DIG I/O 2. */
	{
		INTCON3bits.INT3IF = 0;
	//	printf("Right Interrupt hit\r");
	//	Right_Encoder_Int_Handler();
	}
	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
		}
	}

}
We called Initialize_Encoders in User_Initialization.

We would like some suggestions about checking the wires incase the code is properly set up.
__________________
some of Murphy's Laws of Computing


1)When computing, whatever happens, behave as though you meant it to happen.

  #13   Spotlight this post!  
Unread 18-02-2007, 17:56
Scandellous Scandellous is offline
Registered User
FRC #1647
 
Join Date: Feb 2007
Location: Medford Lakes
Posts: 1
Scandellous is an unknown quantity at this point
Re: Encoder Problemo

Hey Cgront, Its Randell if your reading this I need you to get my memstick and give it to me tomorrow at robotics
  #14   Spotlight this post!  
Unread 18-02-2007, 22:18
benhulett benhulett is offline
Registered User
FRC #1895
 
Join Date: Feb 2007
Location: Manassas
Posts: 28
benhulett is on a distinguished road
Re: Encoder Problemo

You said you have encoders 1 & 2 for 12 & 13?

Those are phase B from what I see in the code.

Have you edited the phase A digitial i/o's?? Are they still getting 1 & 2?
  #15   Spotlight this post!  
Unread 18-02-2007, 23:41
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Encoder Problemo

Quote:
Originally Posted by cgront View Post
Help! It's not displaying the data frrom the encoders. Please any help would be appreciated asap
we checked the encoders and they are wired correctly.
we are trying to print the functions which should return the values in the code.

Thank you.
How are you trying to print the functions? The Get_Encoder... functions return long integers. If you try to print them using the %d format, you'll likely get zero unless the encoders have turned far enough to start setting the high bytes of the value.

Also, here's my standard question for problems of this type: what exactly does "wired correctly" mean?
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
Encoder Problems bjimster1 Programming 2 10-02-2007 08:04
Encoder Error Anime-niac_2.9 Programming 1 27-01-2007 16:23
Encoder Problem DustinB_3 Programming 22 03-01-2007 20:42
Encoder help Windward Programming 21 14-01-2006 15:10
encoder.c Gary Bonner Programming 2 14-01-2005 13:41


All times are GMT -5. The time now is 00:30.

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