|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Inputs for the Encoder
Hi all, I have a quick question and if it is documented somewhere I have not been able to find it.
The question is can any of the digital inputs be used for reading the encoder? I have a USdigital encoder connected to digital inputs 10 & 11 in slot 4 and use the GetEncoder() function and it would read 0 or 1 while turning the encoder. The direction would work if I recall bit no increment or decrement of counts. Both encoder outputs were verified with a scope. After a bit of pondering I changed the wiring to use digital inputs 8 & 9 and then all works. We are using Wind River with the C function call. In summary are there specific inputs that are required to be used for various sensors, i.e. encoders? Thanks, -pete |
|
#2
|
|||
|
|||
|
Re: Inputs for the Encoder
(I'm assuming you are using C++ for this...)
There are no specific inputs for the encoders. You specify the input module and channel in the constructor when you declare the encoder object. That declaration routes the channels to the appropriate part of the FPGA, which handles your counting and rate calculation. -Jeff Erickson, FRC 41 |
|
#3
|
|||
|
|||
|
Re: Inputs for the Encoder
The example was using C and the C libs, have not tried with C++. The digital inputs were defined in the function call.
if these are defined as 8 & 9 then everthing works, static const UINT32 ENC_A = 10; static const UINT32 ENC_B = 11; In the Initialize function.. StartEncoder(ENC_A, ENC_B); then in the OperatorControl function is enc = GetEncoder(ENC_A, ENC_B); GetEncoder() only returns a 0 or 1 for inputs 10&11 but if the inputs are moved to 8&9 and the code changed to reflect the input change all works. I think there still might be some issues that need to worked out either in the WPIlibs (C) or in the hardware. Will try with C++ and see is using inputs 10&11 still have issues jee7s, Thanks for the above reply, -pete |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using Analog Inputs as Digital (on the OI) | Guy Davidson | Control System | 16 | 10-03-2008 17:17 |
| Using Custom Inputs on the Controller Board | schenkin | Programming | 10 | 27-01-2005 10:26 |
| How do the Analog Inputs work? | JBotAlan | Electrical | 3 | 07-01-2005 00:11 |
| Choosing an Encoder for the Drive-train | MikeDubreuil | Electrical | 11 | 21-10-2004 00:50 |
| how to add steps in the provided encoder program for the edu | Zaramel2002 | Programming | 3 | 11-02-2004 08:35 |