Difference between revisions of "Component: Quadrature Encoder (EBM007) (EBM Modules)"

From Flowcode Help
Jump to navigationJump to search
 
(6 intermediate revisions by the same user not shown)
Line 16: Line 16:
  
 
==Component Source Code==
 
==Component Source Code==
 +
 +
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_EBM007v2.fcfx FC_Comp_Source_EBM007v2.fcfx]
  
 
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_EBM007v2.fcfx FC_Comp_Source_EBM007v2.fcfx]
 
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_EBM007v2.fcfx FC_Comp_Source_EBM007v2.fcfx]
  
 
==Detailed description==
 
==Detailed description==
 +
 +
 +
 +
 +
 +
  
  
Line 32: Line 40:
  
 
==Examples==
 
==Examples==
 +
 +
 +
 +
 +
 +
  
  
Line 46: Line 60:
  
 
{{Fcfile|EBM007 - Test Program.fcfx|EBM007 Example}}
 
{{Fcfile|EBM007 - Test Program.fcfx|EBM007 Example}}
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
 
==Macro reference==
 
==Macro reference==
  
 +
===CheckForChanges===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 63: Line 88:
  
  
 +
===Disable===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 76: Line 102:
  
  
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
+
===Enable===
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteCounter32'''
 
|-
 
| colspan="2" | Sets the value of the internal count variable. Range: -2147483648 to 2147483647 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-s32-icon.png]] - LONG
 
| width="90%" | Value
 
|-
 
| colspan="2" | Range: -2147483648 to 2147483647 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 107: Line 116:
  
  
 +
===ReadCounter===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 120: Line 130:
  
  
 +
===ReadCounter32===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteCounter'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCounter32'''
 
|-
 
|-
| colspan="2" | Sets the value of the internal count variable. Range: -32768 to 32767 
+
| colspan="2" | Reads the current dial counter as a 32-bit value This is a counter from -2147483648 to 2147483647 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s32-icon.png]] - LONG
| width="90%" | Value
 
|-
 
| colspan="2" | Range: -32768 to 32767 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===ResetCounter===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 151: Line 158:
  
  
 +
===WriteCounter===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCounter32'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteCounter'''
 
|-
 
|-
| colspan="2" | Reads the current dial counter as a 32-bit value This is a counter from -2147483648 to 2147483647 
+
| colspan="2" | Sets the value of the internal count variable. Range: -32768 to 32767 
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s32-icon.png]] - LONG
+
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
+
| width="90%" | Value
|}
 
 
 
 
 
 
 
 
 
==Property reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Count Variable
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Variable Type
 
|-
 
| colspan="2" | Selects the size of the encoder count variable depending on the number of encoder counts required to be stored. The 16 bit variable counter is accessed via the ReadCounter and WriteCounter functions. The 32 bit variable counter is accessed via the ReadCounter32 and WriteCounter32 functions. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Encoder Resolution
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Post Scaler
 
|-
 
| colspan="2" | Encoders with a mechanical click will often have 4 transitions per click. 1:1 would provide the maximum output resolution. 1:4 would provide the encoder click count. 
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | A
 
|-
 
| colspan="2" | Input pin A 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | B
 
|-
 
| colspan="2" | Input Pin B  
 
|-
 
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Repeat Rate
 
|-
 
| colspan="2" | Simulated repeat rate when clicking and rotating the encoder 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
 
| width="90%" | Rotation Increment
 
|-
 
| colspan="2" | Number of degrees to rotate when performing a single quadrature pin transition. 
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Scope Traces
 
|-
 
| colspan="2" |  
 
|}==Macro reference==
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckForChanges'''
 
|-
 
| colspan="2" | Polling function to check changes Returns 1 for chaged, 0 for no change, 255 for error 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Disable'''
 
|-
 
| colspan="2" | Disables the use of the quad encoder Once this ist called, the read functions will return zeros until the next Enable() call 
 
 
|-
 
|-
 +
| colspan="2" | Range: -32768 to 32767 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 252: Line 177:
  
  
 +
===WriteCounter32===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 268: Line 194:
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Enable'''
 
|-
 
| colspan="2" | Enables the use of the quad encoder If this is not called, the read functions will return zeros 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCounter'''
 
|-
 
| colspan="2" | Reads the current dial counter This is a counter from -32768 to 32767 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WriteCounter'''
 
|-
 
| colspan="2" | Sets the value of the internal count variable. Range: -32768 to 32767 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
 
| width="90%" | Value
 
|-
 
| colspan="2" | Range: -32768 to 32767 
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ResetCounter'''
 
|-
 
| colspan="2" | Resets the current dial counter to zero  
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCounter32'''
 
|-
 
| colspan="2" | Reads the current dial counter as a 32-bit value This is a counter from -2147483648 to 2147483647 
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s32-icon.png]] - LONG
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
 
 
  
  

Latest revision as of 13:09, 7 February 2023

Author Matrix TSL
Version 1.0
Category EBM Modules


Quadrature Encoder component

Provides a rotary encoder with dual digital outputs that provide rotation and direction information. When connected to two digital inputs of a microcontroller a “digital pot” can be implemented to convert to digital values.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_EBM007v2.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_EBM007v2.fcfx

Detailed description

No detailed description exists yet for this component

Examples

This example scans the encoder for changes and displays a counter on the LCD based on the movement of the encoder.

FC6 Icon.png EBM007 Example







Macro reference

CheckForChanges

Fc9-comp-macro.png CheckForChanges
Polling function to check changes Returns 1 for chaged, 0 for no change, 255 for error 
Fc9-u8-icon.png - BYTE Return


Disable

Fc9-comp-macro.png Disable
Disables the use of the quad encoder Once this ist called, the read functions will return zeros until the next Enable() call 
Fc9-void-icon.png - VOID Return


Enable

Fc9-comp-macro.png Enable
Enables the use of the quad encoder If this is not called, the read functions will return zeros 
Fc9-void-icon.png - VOID Return


ReadCounter

Fc9-comp-macro.png ReadCounter
Reads the current dial counter This is a counter from -32768 to 32767 
Fc9-s16-icon.png - INT Return


ReadCounter32

Fc9-comp-macro.png ReadCounter32
Reads the current dial counter as a 32-bit value This is a counter from -2147483648 to 2147483647 
Fc9-s32-icon.png - LONG Return


ResetCounter

Fc9-comp-macro.png ResetCounter
Resets the current dial counter to zero  
Fc9-void-icon.png - VOID Return


WriteCounter

Fc9-comp-macro.png WriteCounter
Sets the value of the internal count variable. Range: -32768 to 32767 
Fc9-s16-icon.png - INT Value
Range: -32768 to 32767 
Fc9-void-icon.png - VOID Return


WriteCounter32

Fc9-comp-macro.png WriteCounter32
Sets the value of the internal count variable. Range: -2147483648 to 2147483647 
Fc9-s32-icon.png - LONG Value
Range: -2147483648 to 2147483647 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Count Variable
Fc9-type-16-icon.png Variable Type
Selects the size of the encoder count variable depending on the number of encoder counts required to be stored. The 16 bit variable counter is accessed via the ReadCounter and WriteCounter functions. The 32 bit variable counter is accessed via the ReadCounter32 and WriteCounter32 functions. 
Fc9-conn-icon.png Encoder Resolution
Fc9-type-16-icon.png Post Scaler
Encoders with a mechanical click will often have 4 transitions per click. 1:1 would provide the maximum output resolution. 1:4 would provide the encoder click count. 
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png A
Input pin A 
Fc9-type-5-icon.png B
Input Pin B  
Fc9-conn-icon.png Simulation
Fc9-type-16-icon.png Repeat Rate
Simulated repeat rate when clicking and rotating the encoder 
Fc9-type-15-icon.png Rotation Increment
Number of degrees to rotate when performing a single quadrature pin transition. 
Fc9-type-7-icon.png Scope Traces