Go to Post Friction is finicky. - Ether [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 19-02-2007, 22:51
Ianuser Ianuser is offline
Registered User
FRC #0570
 
Join Date: Feb 2007
Location: new york
Posts: 64
Ianuser is an unknown quantity at this point
Gear Tooh phase B? help?

I want to get rid of the phase B stuff for the encoder code. Where do I do that? Do I need ANYTHING in User_Routines_Fast.c...can I get rid of all of that stuff from Kevin's code or do I still need it? Do I need the Encoder_1_Int_Handler() funciton (and 2) at all?



Also I dont fully understand how the GTS works. I'm not using a regular CIM motor, this is for my forklift. Im using one of those small black motors with the big black pulley attached to it (like a winch). How can I attach it in this case?
Also, I have the GTS, its a chip that has two sides almost identical and I think I know how to connect it to the RC, but I just place that next to a gear and it should work? There's no other part except for the chip? No red box or anything?
Thanks for your help!
  #2   Spotlight this post!  
Unread 20-02-2007, 06:40
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,112
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: Gear Tooh phase B? help?

Quote:
Originally Posted by Ianuser View Post
I want to get rid of the phase B stuff for the encoder code. Where do I do that?
Find the places in the interrupt handler that it tests a Phase B signal and either adds or subtracts the delta. Change it to just add the delta without testing first.
  #3   Spotlight this post!  
Unread 20-02-2007, 08:17
Ianuser Ianuser is offline
Registered User
FRC #0570
 
Join Date: Feb 2007
Location: new york
Posts: 64
Ianuser is an unknown quantity at this point
Re: Gear Tooh phase B? help?

So quite literally:

Code:
void Encoder_2_Int_Handler1(void)
{
	// Encoder 2's phase a signal just transitioned from zero to one, causing 
	// this interrupt service routine to be called. We know that the encoder 
	// just rotated one count or "tick" so now check the logical state of the 
	// phase b signal to determine which way the the encoder shaft rotated.

	Encoder_22_Count += ENCODER_2_TICK_DELTA;
}
#endif

#ifdef ENABLE_ENCODER_3

?

Also, this line of code wasn't compiling..it came up with this problem:

Code:
C:\USFIRST\frc_camera_s_21\CAMERA CODE\encoder.c:130:Error [1205] unknown member 'INT3IP' in '__tag_223'
C:\USFIRST\frc_camera_s_21\CAMERA CODE\encoder.c:130:Error [1131] type mismatch in assignment
for this line of code:
Code:
// interrupt 2 is low priority
	INTCON2bits.INT3IP = 0;
So I just commented it out. Do I still need it? I cant find anywhere in the code where it could be changed or anything.
  #4   Spotlight this post!  
Unread 20-02-2007, 08:24
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Gear Tooh phase B? help?

Well if you are using encoder two, that line you commented out sets the phase a interrupt priority for your encoder. Really, if you look at the chip spec I think its power on reset value is zero, but i'm not sure. If zero is the reset value then you should be fine.

That line shouldnt be a problem though.... are your sure ifi_default.h is included? is there an error in the previous line?

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #5   Spotlight this post!  
Unread 20-02-2007, 08:35
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,112
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: Gear Tooh phase B? help?

Quote:
Originally Posted by Ianuser View Post
Also, this line of code wasn't compiling..it came up with this problem:

Code:
C:\USFIRST\frc_camera_s_21\CAMERA CODE\encoder.c:130:Error [1205] unknown member 'INT3IP' in '__tag_223'
C:\USFIRST\frc_camera_s_21\CAMERA CODE\encoder.c:130:Error [1131] type mismatch in assignment
for this line of code:
Code:
// interrupt 2 is low priority
	INTCON2bits.INT3IP = 0;
So I just commented it out. Do I still need it? I cant find anywhere in the code where it could be changed or anything.
Step 9 in the encoder_readme.txt file clearly explains this and tells how to correct it.
  #6   Spotlight this post!  
Unread 20-02-2007, 08: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,112
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: Gear Tooh phase B? help?

Quote:
Originally Posted by Ianuser View Post
Code:
void Encoder_2_Int_Handler1(void)
{
	// Encoder 2's phase a signal just transitioned from zero to one, causing 
	// this interrupt service routine to be called. We know that the encoder 
	// just rotated one count or "tick" so now check the logical state of the 
	// phase b signal to determine which way the the encoder shaft rotated.

	Encoder_22_Count += ENCODER_2_TICK_DELTA;
}
#endif

#ifdef ENABLE_ENCODER_3

?
I don't know where the "_22_" came from, but the logic (such as it is) is correct. However, I was hoping you'd also think to correct the comment to explain what you did and why you did it. Someone (perhaps you) is going to be reading this code later, and it will help to have comments that actually describe the code.
  #7   Spotlight this post!  
Unread 20-02-2007, 09:32
Ianuser Ianuser is offline
Registered User
FRC #0570
 
Join Date: Feb 2007
Location: new york
Posts: 64
Ianuser is an unknown quantity at this point
Re: Gear Tooh phase B? help?

Thank you. I made encoder_22_count because For some reason when I compiled, it said that there were MULTIPLE DEFINITIIONS for All of those variables in the Encoder.c file. All of the counters, all of the functions had multiple definitions...were declared more than once in the code, but I couldn't find out where! In using MPLAB, I looked everywhere, I did a search in all of the files..(Edit, Find in Files), and I found 16 declarations of Encoder_1_Count, and none of them were second declarations of the same variable. (same for all of the other variables). So I changed the variable names and I dont know where the original Encoder_1_Count is being used, but Im using Encoder_11_Count now, and Initialize_Encoders1() and Get_Encoder_1_Count1() now instead.
Thanks

P.S. I cant use the gear tooth sensor I found out, because im not using a regular CIM motor or gearbox. I'm using a ___ for a winch. I'm going to have to use a bunch of Limit Switches instead. How do I connect the limit switches? What is NC2, N03, and COM1? Do these all connect into a PWM cable and then into Digital In/Out on the RC? Is in Analog? Thanks for your help!
  #8   Spotlight this post!  
Unread 20-02-2007, 10:03
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,112
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: Gear Tooh phase B? help?

Quote:
Originally Posted by Ianuser View Post
Thank you. I made encoder_22_count because For some reason when I compiled, it said that there were MULTIPLE DEFINITIIONS for All of those variables in the Encoder.c file...
If you don't get expected results after following the directions, it's usually because you didn't follow the directions correctly. Instead of trying to compensate for the error, it's better to retrace your steps and find out what you did wrong. For example, the multiple definitions problem can happen if you have accidentally put #include encoder.c at the top of one of your files instead of #include encoder.h.

The Gear Tooth Sensor is not limited to use with a CIM motor. All it needs is a set of rotating teeth that can affect a magnetic field. Do you have no sprockets or gears anywhere on the winch?

Limit switches have three connections: common, normally open, and normally closed. The numbers after COM, NC, and NO are just pin numbers. When the switch is not pressed, the NO pin is open and the NC pin is connected to COM. When the switch is pressed, the NO pin is connected to COM and the NC contact is open.

The limit switch should be wired to a digital input on the Robot Controller. Connect the common pin to the black (ground) wire, and connect either the normally open or normally closed pin to the white (signal) wire, depending on whether you want the signal to be grounded when the switch is pressed or when the switch is released. The red (+5) wire is not used. The digital input value is read as 1 when the switch is open, and 0 when it is closed.
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
Phase A and Phase B on encoders kiettyyyy Programming 11 12-04-2006 13:05
between phase scoring calculation question? psycho7 Rules/Strategy 2 08-01-2006 22:05
most important phase? Jeremy L Rules/Strategy 3 15-01-2003 15:21
Help Gear Ratios !!!!!!! Help sanddrag Technical Discussion 5 16-08-2002 15:09
1 or 2 phase switch archiver 2001 0 24-06-2002 00:48


All times are GMT -5. The time now is 06:34.

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