Thread: GTS Counting
View Single Post
  #11   Spotlight this post!  
Unread 28-02-2006, 22:14
Greg Ross's Avatar
Greg Ross Greg Ross is offline
Grammar Curmudgeon
AKA: gwross
FRC #0330 (Beach 'Bots)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Hermosa Beach, CA
Posts: 2,245
Greg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond reputeGreg Ross has a reputation beyond repute
Send a message via AIM to Greg Ross Send a message via Yahoo to Greg Ross
Re: GTS Counting

Quote:
Originally Posted by Astronouth7303
If you really need direction, I recomend going with quadrature.

The pulses off the GTS are so miniscule that by the time I got to the bottom of my ISR, the pulse had already passed. Just camera or high-priority interrupts could screw up timing. This is using PIC C, not EasyC.
Do you mind sharing your code? I haven't run the numbers myself, but it SEEMS like you should be able to differentiate a forward vs. reverse pulse. I'm wondering if you weren't trying to do too much in your interrupt routine.
Quote:
Originally Posted by teh_r4v3
A timer can go down to 100ns if you want I believe... but at that point the interrupts will be taking over way too many processor cycles.
I believe the 100ns number means that the timer counter increments that fast, but you have control over how many times the counter increments before it interrupts. I THINK that in your gear tooth sensor ISR, you should be able to set the timer to go off in 60 μs, and then in your timer ISR, check the gear tooth sensor line again. So then, all you really need to do in your gear tooth sensor ISR is to increment your gear tooth counter, set your timer, and return. Then in your timer ISR, if the line is still high, decrement your counter by 2. (At this point you might need to turn off your timer, so you don't get keep getting interrupted EVERY 60 μs.)

Note: If necessary, you can optimize your ISR code to add and subtract the VALUE of the I/O line, rather than TESTING the state, and conditionally subtracting.
__________________
Greg Ross (The Grammar Curmudgeon formerly known as gwross)
S/W Engineer, Team 330, the Beach 'Bots
<--The Grammar Curmudgeon loves this cartoon.
“Life should not be a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming "Wow! What a Ride!" Hunter S. Thompson
"Playing a practical joke means doing something mean and calling it funny." Me