Difference between revisions of "Component: Quadrature Encoder (General Input)"
Line 5: | Line 5: | ||
|- | |- | ||
| width="20%" style="color:gray;" | Version | | width="20%" style="color:gray;" | Version | ||
− | | 1. | + | | 1.4 |
|- | |- | ||
| width="20%" style="color:gray;" | Category | | width="20%" style="color:gray;" | Category | ||
Line 13: | Line 13: | ||
==Quadrature Encoder component== | ==Quadrature Encoder component== | ||
− | Quadrature Encoder component implements a rotary encoder connected to two pins. Quadrature Encoders provides incremental positioning rather than absolute positioning. | + | Quadrature Encoder component implements a rotary encoder connected to two pins. Quadrature Encoders provides incremental positioning rather than absolute positioning. |
==Component Source Code== | ==Component Source Code== | ||
− | Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/ | + | Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_Encoder_Quadrature_2dgi.fcfx FC_Comp_Source_Encoder_Quadrature_2dgi.fcfx] |
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
Mechanical encoders can be a bit electrically noisy when switching and so to have reliable operation it is recommended to have a simple filter as shown here. | Mechanical encoders can be a bit electrically noisy when switching and so to have reliable operation it is recommended to have a simple filter as shown here. | ||
Line 26: | Line 28: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
Line 248: | Line 252: | ||
| colspan="2" | Simulated repeat rate when clicking and rotating the encoder | | colspan="2" | Simulated repeat rate when clicking and rotating the encoder | ||
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9-type- | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] |
− | | width="90%" | | + | | width="90%" | Scope Traces |
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-12-icon.png]] | ||
+ | | width="90%" | Poiner Style | ||
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | |
|- | |- | ||
− | | width="10%" align="center" | [[File:Fc9-type- | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] |
− | | width="90%" | | + | | width="90%" | Style |
|- | |- | ||
| colspan="2" | | | colspan="2" | | ||
|} | |} |
Revision as of 14:40, 16 January 2023
Author | Matrix TSL |
Version | 1.4 |
Category | General Input |
Contents
Quadrature Encoder component
Quadrature Encoder component implements a rotary encoder connected to two pins. Quadrature Encoders provides incremental positioning rather than absolute positioning.
Component Source Code
Please click here for the component source code: FC_Comp_Source_Encoder_Quadrature_2dgi.fcfx
Detailed description
Mechanical encoders can be a bit electrically noisy when switching and so to have reliable operation it is recommended to have a simple filter as shown here.
Examples
Polling
Example program showing how to use a quadrature encoder component using a polling method.
Quad_Encoder_Test
Timer Interrupt Based Polling
Example program showing how to use a quadrature encoder component using a polling method via a timer interrupt.
Quad_Encoder_Timer
Interrupt On Change
Example program showing how to use a quadrature encoder component using a interrupt on pin state change interrupt (IOC).
Quad_Encoder_IOC
Downloadable macro reference
![]() |
CheckForChanges |
Polling function to check changes Returns 1 for chaged, 0 for no change, 255 for error | |
![]() |
Return |
![]() |
Disable |
Disables the use of the quad encoder Once this ist called, the read functions will return zeros until the next Enable() call | |
![]() |
Return |
![]() |
WriteCounter32 |
Sets the value of the internal count variable. Range: -2147483648 to 2147483647 | |
![]() |
Value |
Range: -2147483648 to 2147483647 | |
![]() |
Return |
![]() |
Enable |
Enables the use of the quad encoder If this is not called, the read functions will return zeros | |
![]() |
Return |
![]() |
ReadCounter |
Reads the current dial counter This is a counter from -32768 to 32767 | |
![]() |
Return |
![]() |
WriteCounter |
Sets the value of the internal count variable. Range: -32768 to 32767 | |
![]() |
Value |
Range: -32768 to 32767 | |
![]() |
Return |
![]() |
ResetCounter |
Resets the current dial counter to zero | |
![]() |
Return |
![]() |
ReadCounter32 |
Reads the current dial counter as a 32-bit value This is a counter from -2147483648 to 2147483647 | |
![]() |
Return |