|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Encoder help
Hello,
We have been trying to use Kevin Watson's encoder code for our robot, but we can't tell if it is working. I've used Mr. Watson's code, unmodified and loaded it onto the robot. Even when I spin the encoder by hand, it doesn't count or print it out. I've tested with different encoders and tried to have the electrician on the team re-wire it. Any advice? -Windward Robotics 1452 |
|
#2
|
|||||
|
|||||
|
Re: Encoder help
First step to solving any programming problem, is to isolate the problem. How do you know the problem is with Kevin's code... and you don't have a problem with your encoder?
With that being said, have you tried hooking the encoder up to an oscilloscope? That would tell you whether it is a bad encoder, or bad code. |
|
#3
|
|||||
|
|||||
|
Re: Encoder help
Did you plug your it into the right pins? The correct way to wire it is on Kevins website in the encoder FAQ section. Check his encoder.h/reamde files to see where to plug in the right pins. Follow all the instructins carefully and then follow through and see why it is not working. His unedited code has always worked flawlessly for me.
|
|
#4
|
|||
|
|||
|
Re: Encoder help
Also, how are you printing it out? If you are just using %i, be aware it will cause some strange things to happen. I believe the proper thing to use is %li, but I can't exactly remember. I do remember spending about a week trying to debug why the encoder worked eletrically, but it wasn't changing the variables in the code.
|
|
#5
|
||||
|
||||
|
Re: Encoder help
Quote:
-Kevin |
|
#6
|
||||
|
||||
|
Re: Encoder help
Quote:
The encoders are Grayhill 63R128 (recommended from http://kevin.org/frc/encoder_faq.html) The encoder is plugged in to Digital In/Out 1 and 6, with the power and ground connected to the Digital In/Out 5. Is this a possible problem? The only other problem I could possibly see is that the FRC Robot Controller is from 2004. Could this be another possible problem? Thank you in advance, -Windward Robotics 1452 -- Update: We think it might be a problem with the computer. Whenever we program it the yellow program state is constantly orange. Any advice? We are going to try to steal the 2005 FRC Robot Controller from the builders. Last edited by Windward : 01-12-2005 at 17:27. |
|
#7
|
||||
|
||||
|
Re: Encoder help
Quote:
-Kevin |
|
#8
|
|||||
|
|||||
|
Re: Encoder help
Try making the variables and functions that are longs ints instead.
e.g. instead of "long Get_Left_Encoder_Count()" change it to "int Get_Left_Encoder_Count()" I had a problem much like that before; none of my variables (longs) would change ever. Then I changed them to ints and it worked. Hope that helps, ~Stephanie |
|
#9
|
|||||
|
|||||
|
Re: Encoder help
Quote:
|
|
#10
|
||||
|
||||
|
Re: Encoder help
Sorry about posting only on Tuesdays and Thursday, until the competition starts that is the only time I can work on it.
I am pretty sure there is a problem with the printfs. When I basically added the same statement (minus the ++counter and just while 1==1) into User_initialization it worked properly; I believe when I added the ++counter part of the original printf in User_initialization it didn't work. I assume I'm having printf problems. Could this be compiler/cable related (we are using a USB to Serial converter) Thanks. |
|
#11
|
||||
|
||||
|
Re: Encoder help
Quote:
Yes it still remains yellow, and still doesn't print. |
|
#12
|
||||
|
||||
|
Re: Encoder help
Quote:
-Kevin |
|
#13
|
||||
|
||||
|
Re: Encoder help
Quote:
IFI loader is 1.0.10 After I hit restart on the CPU, "IFI>" comes up in the COM4 Terminal but no encoder output using the precompiled .hex file. Although after pressing reset, the Program Light state becomes green. |
|
#14
|
||||
|
||||
|
Re: Encoder help
Quote:
-Kevin Last edited by Kevin Watson : 13-12-2005 at 17:36. Reason: Icky grammer. |
|
#15
|
||||||
|
||||||
|
Re: Encoder help
Quote:
The USB to Serial is good enough to download code but not to talk to the printf? If that wasn't enough, he also says that his terminal program shows a "IFI>" on the screen. Why the "IFI>" but not the stuff from the printf? I have no clue what it is, but I will bet a case a Mt. Dew (at even odds) against it being the USB to Serial device's fault. How about this? Is it possible that the printf is sending data to a different serial port on the controller than the one that the "IFI>" message is being sent? Joe J. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Encoder Output Problems | Mike | Electrical | 5 | 25-11-2005 21:43 |
| encoder vs. motor | stephenthe1 | Programming | 55 | 06-01-2005 22:07 |
| Updated Encoder Code Available | Kevin Watson | Programming | 2 | 04-01-2005 01:00 |
| how to add steps in the provided encoder program for the edu | Zaramel2002 | Programming | 3 | 11-02-2004 08:35 |