|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||||
|
||||||
|
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. |
|
#2
|
||||
|
||||
|
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 attached an EasyC pro project(vex) with this code. |
|
#3
|
||||
|
||||
|
Re: encoder counting and onscreen feedback *ASAP
Greg, did the encoder win or did you?
Last edited by Kingofl337 : 17-04-2007 at 16:11. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |