Encoder
Libraries:
Embedded Coder Support Package for Infineon AURIX TC4x
Microcontrollers /
AURIX TC4x
Description
Measures the rotation of the motor in ticks.
The ticks port outputs the encoder ticks count as an int32
value.
The dir port, when enabled, outputs the direction of the encoder.
0
- clockwise direction.1
- counter-clockwise direction.
The Encoder block is developed based on GPT12 (general purpose timer) module available in the AURIX TC4x devices, where timer T3 & T5(slow speed calculation) is used.
Examples
Field-Oriented Control of BLDC with Encoder Using Infineon AURIX Microcontrollers
Implement the field-oriented control (FOC) technique to control the speed of a three-phase brushless DC (BLDC) motor. The FOC algorithm requires rotor position feedback, which is obtained by using an encoder sensor. For more details about FOC, see Field-Oriented Control (FOC) (Motor Control Blockset).
Analyze Sensorless Observers for Field-Oriented Control Using Multiple Cores of Infineon AURIX
Use Embedded Coder® Support Package for Infineon® AURIX™ Microcontrollers for sensorless field-oriented control using multiple cores of an Infineon AURIX microcontroller board. This example uses a top-level model and two referenced models. You use the TriCore0 referenced model to implement a sensor-based field-oriented control (FOC) technique to control the speed of a three-phase brushless DC (BLDC) motor. You use the TriCore1 referenced model to implement and analyze different sensorless algorithms, such as the algorithms implemented in the Flux Observer (Motor Control Blockset), Sliding Mode Observer (Motor Control Blockset), and Extended EMF Observer (Motor Control Blockset) blocks.
Accelerate AI Based Software Development on Infineon AURIX TC4x Microcontroller
Implement AI based motor control functions using the Model-Based Design approach by deploying a multi-layer perceptron (MLP) neural network on the Infineon® AURIX™ TC4x microcontroller.
Ports
Input
The block converts this input SoC Blockset™ message into encoder position and outputs it in ticks port during simulation.
Dependencies
To view this port, select the Enable simulation port parameter and set the port type as SoC Data (Message based).
The simulation-only Simulink® signal input acts as pass-through with the output of the Encoder block during simulation.
Dependencies
To enable this port, select the Enable simulation port parameter and set the port type as Signal.
The offset_in port enables you to dynamically add the offset in raw position with respective to the motor if required.
Dependencies
To enable this port, select the Enable offset inport parameter.
Data Types: int32
The rate_in ports enables you to change the rate at which the data is sampled at run time in seconds.
Dependencies
To enable this port, select the Enable refresh rate inport parameter.
Data Types: Float32
Output
The ticks port outputs the encoder position in count as an
int32
value.
Data Types: int32
The dir port outputs the current direction of the motor as one of the following:
0
- Clockwise direction1
- Counter clockwise direction
Dependencies
To enable this port, select the Enable direction port parameter.
Data Types: Boolean
The speed port outputs the mechanical speed (in rad/s) of the motor as
an float32
value.
Dependencies
To enable this port, select the Enable speed port parameter.
Data Types: float32
The offset_out port outputs the offset in raw position with respective to the motor as an int32 value.
Dependencies
To enable this port, select the Enable offset outport parameter.
Data Types: int32
The rate port outputs the rate at which the data is sampled (in
seconds) as an float32
value.
Dependencies
To enable this port, select the Enable rate outport parameter.
Data Types: float32
Parameters
Inputs
Enable this parameter to dynamically add the offset in raw position with respective to the motor.
Enable this parameter to refresh the rate at which the data is sampled.
Select this parameter to enable peripheral simulation capability.
Select this parameter to configure either the SoC compatible or the simulink signal based simulation ports to enable peripheral simulation capability.
Dependencies
To view this parameter, select the Enable simulation port parameter.
Outputs
Enable this parameter to output the current direction of the motor.
Enable this parameter to output the mechanical speed (in rad/s) of the motor.
Enable this parameter to output the offset in raw position with respective to the motor.
Enable this parameter to output the rate at which the data is sampled in seconds.
Specify in seconds how often the block should read the pin value.
When you specify this parameter as -1
, Simulink determines the best sample time for the block based on the
block context within the model.
Version History
Introduced in R2022b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)