Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   GTS Code (http://www.chiefdelphi.com/forums/showthread.php?t=63439)

windell747 06-02-2008 21:19

GTS Code
 
Hi, I'm looking for some sample GTS code that uses interrupts to keep count of teeth. I know that Kevin has posted some encoder code that keeps track of the quadrature for forward and backward directions, however I would like to go the simpler route and use the GTS. Any assistance would be apprecated!

Thanks,
windell

usbcd36 06-02-2008 22:13

Re: GTS Code
 
Kevin's code can be easily modified to use simple gear tooth sensors instead of quadrature encoders. All you need to do is open the encoder.c file and remove the code that uses the second phase.

You'll probably be using two sensors, so you need to do this to both. Find the functions in encoder.c called Encoder_n_Int_Handler, where n stands for the digital port you're using for that sensor. Modify it to look like so:

Code:

void Encoder_n_Int_Handler(void)
{
                Encoder_n_Count += ENCODER_n_TICK_DELTA;
}

Should be fairly simple to do this.

billbo911 07-02-2008 00:00

Re: GTS Code
 
Here is another alternative to what usbcd36 said. We are not using quadrature encoders with our drive system but we are using a gear tooth sensor. The following code is what we used for one side to determine if we need to increment or decrement the counter.
Code:

if(pwm13 < 118) 
        {
                Encoder_3_Count -= ENCODER_3_TICK_DELTA;
        }
        else if (pwm13 > 136)
        {
                Encoder_3_Count += ENCODER_3_TICK_DELTA;
        }

What we are doing is looking at the PWM value for the drive on that side and if it is outside of a designated window we will then increment or decrement the counter based on the value of the PWM.

wt200999 07-02-2008 00:07

Re: GTS Code
 
One problem you are going to run into with that is if you are using your speed controllers with coasting then when you cut power to the motors your wheels will turn, but the values will not go up or down

Gamer930 07-02-2008 00:09

Re: GTS Code
 
Quote:

Originally Posted by wt200999 (Post 693714)
One problem you are going to run into with that is if you are using your speed controllers with coasting then when you cut power to the motors your wheels will turn, but the values will not go up

?? Totally incorrect information ?? (error in your code)

windell747 http://www.chiefdelphi.com/forums/sh...ad.php?t=62915 if you read that I posted my GTS code. . . . Then I posted how to fix the code I posted. . . With some minor changes that could be working for you guys also

billbo911 07-02-2008 00:29

Re: GTS Code
 
Quote:

Originally Posted by wt200999 (Post 693714)
One problem you are going to run into with that is if you are using your speed controllers with coasting then when you cut power to the motors your wheels will turn, but the values will not go up or down

Absolutely correct! That is why we have the coast/break jumpers set to break. We fully understand the possible hole in this code, but without using a quadrature encoder there are very few other alternatives that we can use.
Thanks for the input, if you have any other ideas that might help us, we would love to hear them.:)


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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi