Go to Post And who knows, maybe one day you'll prove the impossible possible! - MissInformation [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #17   Spotlight this post!  
Unread 06-02-2007, 01:21
radicalnerd radicalnerd is offline
Registered Luser
FRC #0668 (Apes of Wrath)
Team Role: Programmer
 
Join Date: Dec 2005
Location: San Jose, CA
Posts: 12
radicalnerd is an unknown quantity at this point
Send a message via AIM to radicalnerd
Re: Encoders not changing...

There might be a problem with storing a long to an int without typecasting... Kevin's Get_Encoder_n_Count() functions return a long. If you want to store them as ints you should typecast them:
Code:
LeftWheelCount = (int)Get_Encoder_1_Count();
RightWheelCount = (int)Get_Encoder_2_Count();
Otherwise you might get only the most significant bits of the long, which make the int variables 0. In other words, it's counting, but you're not printing them correctly. We had a similar problem with printf displaying longs without typecasting:

Code:
printf("Left encoder count = %d", Get_Encoder_1_Count() );      //incorrect
printf("Left encoder count = %d", (int)Get_Encoder_1_Count() ); //correct
I believe the first one tripped us up because it only printed the highest 16 bits of the long, making it appear like it's not counting.

This might be something you already know, in which case I'm sorry I can't help. But if you have a problem with encoders generating too many counts, BaneBots has an encoder divider board that we're using this year. They have jumpers to select divide by factor: 1, 4, 8, or 16. We have one 128/revolution encoder coupled 2:1 to each CIM motor shaft (that's ~5000 counts/sec at no load speed), divided by 4 so we don't overwhelm the processor with counts.
 


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
Changing Fields? Steve W Championship Event 8 08-04-2003 19:37
Changing Chairman's Jacqui Sutton Chairman's Award 1 03-04-2003 09:47
Changing gears archiver 2000 1 23-06-2002 23:26
::CHANGING SERVERS:: Brandon Martus General Forum 5 21-12-2001 10:33
changing my name Travis Covington CD Forum Support 1 09-10-2001 08:37


All times are GMT -5. The time now is 02:16.

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