XG5000 Project Encoder Flag Variables
An XG5000 project for the XMC comes with pre-defined flag variables for the encoder inputs. These can be used in code without having to declare any local or global variables. The variables can be viewed in the Flag tab of the Global/Direct Variables screen. Select Encoder as Flag Type.
Variable Name | Data Type | Address | Description |
---|---|---|---|
_ENC1_POS | LREAL | %KL0 | Encoder 1 input position |
_ENC2_POS | LREAL | %KL1 | Encoder 2 input position |
_ENC1_UNIT | UINT | %KW8 | Encoder 1 unit (0:pulse, 1:mm, 2:inch, 3:degree) |
_ENC2_UNIT | UINT | %KW9 | Encoder 2 unit (0:pulse, 1:mm, 2:inch, 3:degree) |
_ENC1_VEL | LREAL | %KL3 | Encoder 1 Speed |
_ENC2_VEL | LREAL | %KL4 | Encoder 2 Speed |
_ENC1_POS_LATCH | LREAL | %KL5 | Encoder 1 input position latch value |
_ENC2_POS_LATCH | LREAL | %KL6 | Encoder 2 input position latch value |
Step | Action |
---|---|
1 |
Double-click Global/Direct Variables to open the Global/Direct Variables screen.
|
2 |
Select Flag tab on the Global/Direct Variables screen.
|
3 |
Set Flag type to Encoder.
|
LM005-1