Go to Post Use the mentor to lay down the law. They're not there to be your friends they're there to keep the kids focused on the job at hand. - Koko Ed [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 27-02-2007, 10:58
Greg Needel's Avatar Unsung FIRST Hero
Greg Needel Greg Needel is offline
REVving up for a new season
FRC #2848 (All-sparks)
Team Role: Engineer
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Dallas, TX
Posts: 3,110
Greg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond reputeGreg Needel has a reputation beyond repute
encoder counting and onscreen feedback *ASAP

Hey,
I am working on a project and need some help. I am using a vex wheel encoder connected to a shaft which I need to see # of revolutions and RPM on my computer. I was thinking I could do this through the real time link with the controller. I really have no idea where to start and I have a signifigant time crunch on this. Also what is the max RPM that the encoder can detect, I am planning on using it at about 450 RPM.


Thanks..

P.s. this is for 5:00 tonight (2/27) any help would be appreciated.
__________________
Greg Needel│www.robogreg.com
Co-founder REV Robotics LLC www.REVrobotics.com
2014 FRC World Champions with 254, 469, & 74
  #2   Spotlight this post!  
Unread 27-02-2007, 11:46
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: encoder counting and onscreen feedback *ASAP

The vex encoder ticks 90 times per revolution. That is ~700 ticks a sec. at 450 rpm. The vex controller may be able to handle that, but I haven't tried it.

You could use the terminal built into IFI/Intelitek Loader. I assume you will want to use EasyC if you're on a tight schedule. If you are not familiar with MPLab, interrupts, and timers, then you want to use EasyC.

I would suggest somthing like this(this is easyC).
Code:
void Main (void)
{
  unsigned long count = 0;
  unsigned long old_count = 0;
  unsigned long timer;
  unsigned long old_timer;
  int rpm;
  int diff;

  StartEncoder(1);
  StartTimer(1);
  while(1)
  {
     timer = GetTimer(1);
     if (timer - old timer >= 1000) //only do the calculation once a second.
     {
        old_timer = timer;
        count = GetEncoder(1);
        diff = count - old_count;
        old_count = count;
        rpm = (diff * 60) / 90; //# of ticks * 90 secs / 90 ticks per rev.
        PrintToScreen("RPM = %d\n", (int)rpm;
     }
  }
}
I have not tested this code, but it should at least get you started.

I have attached an EasyC pro project(vex) with this code.
Attached Files
File Type: zip RPM Test.zip (1.9 KB, 64 views)
__________________
Eric Haskins KC9JVH
  #3   Spotlight this post!  
Unread 28-02-2007, 09:11
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: encoder counting and onscreen feedback *ASAP

Greg, did the encoder win or did you?
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni

Last edited by Kingofl337 : 17-04-2007 at 16:11.
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
Problems with Encoder Counting bjimster1 Programming 19 07-03-2007 09:59
Encoder Counting Problems RyanW Programming 1 14-02-2007 15:17
Encoder counting randomly off by x4 factor jgeorge Programming 5 02-02-2006 21:17
Problems counting encoder pulses bludstayne Programming 7 02-02-2004 23:07
Chamionship Qualification - feedback needed ASAP! dlavery General Forum 97 11-10-2003 07:17


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

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