|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have tried to look for some guides about Gear tooth sensor, but what I`ve found doesn`t really help me.
Some stuff is ambiguous for me. What are the meanings of quadrature encoder`s states, what does each of them tell me about? What is Get_Encoder_1_Count() and Get_Encoder_2_Count() , and what`s the meaning of the number in the name of the function. -I use MPLAB Thank you in advance. Last edited by beefy23 : 28-03-2008 at 15:13. |
|
#2
|
||||
|
||||
|
Re: Question about Gear Sensor
Quote:
In Kevin Watson's FRC code the functions like Get_Encoder_1_Count() return the net number of pulses sent by the encoder plugged into the port as declared in the encoder.h file. The numbers are used to distinguish between encoders, I believe Kevin's code allows for 6 to be used at a time. The value returned by Get_Encoder_1_Count() can be converted into distance traveled since the encoder was last reset by multiplying the value by the ratio of encoder turns to wheel turns then by multiplying by the wheel circumference. |
|
#3
|
|||
|
|||
|
Re: Question about Gear Sensor
Quote:
|
|
#4
|
||||
|
||||
|
Re: Question about Gear Sensor
Encoders and Gear tooth sensors are both traditionally digital sensors, you can find what ports to use in encoder.h
|
|
#5
|
|||
|
|||
|
Re: Question about Gear Sensor
Quote:
and where can I see exactly what the ports are in encoder.h? |
|
#6
|
|||||
|
|||||
|
Re: Question about Gear Sensor
it does not have more than 2 options...
|
|
#7
|
||||
|
||||
|
Re: Question about Gear Sensor
For encoder 1 phase A goes to dig_in 1 phase b to dig_in 11
encoder 2 uses 2 and 12, 3 uses 3 and 13, ans so on. There is not more than one option, the encoder or gear tooth sensor just pulses once for every set fraction of a rotation, ie when ever the gear tooth sensor senses a gear tooth. This pulse triggers an interrupt in Kevin's code and that tallies the number of pulses, adding one for each forward pulse and subtracting one for each reverse pulse. This tally is returned by get_encoder_count. Last edited by JamesBrown : 28-03-2008 at 16:03. |
|
#8
|
|||||
|
|||||
|
Re: Question about Gear Sensor
Quote:
Code:
from to direction 00 01 forward 00 10 reverse 01 11 forward 01 00 reverse 11 10 forward 11 01 reverse 10 00 forward 10 11 reverse |
|
#9
|
|||
|
|||
|
Re: Question about Gear Sensor
Quote:
Last edited by beefy23 : 28-03-2008 at 19:20. |
|
#10
|
|||||
|
|||||
|
Re: Question about Gear Sensor
Kevin Watson has written exactly what you need, and makes it available to all. Here it is, complete with detailed instructions for adding it to your project in MPLab.
|
|
#11
|
|||||
|
|||||
|
Re: Question about Gear Sensor
Do as above, but note that the gear tooth sensors in the kit have only a single phase. This means that the encoder code will only count either up or down.
If you want direction information (i.e. a count that goes up when rotating one way, and down when rotating the other), you need to estimate it based on other factors (such as commanded motor direction, etc.). |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Gear Tooth Sensor Question | Semicolon | Electrical | 7 | 19-01-2008 22:54 |
| Question about the IR sensor | DemonYawgmoth | Electrical | 4 | 08-01-2008 22:26 |
| Question about Gear-tooth? | Nicodemus | Control System | 4 | 21-01-2007 02:19 |
| Quick question regarding the gear tooth sensor... | Brad Voracek | Electrical | 3 | 12-01-2007 01:07 |
| Gear Tooth Sensor Question | (InsrtNameHere) | Electrical | 2 | 20-01-2006 02:19 |