# Performing a reference run

The reference point of the drive system is determined through referencing. The reference point is determined by activating a reference switch.

1. Configure the stepper motor modul.
2. A reference switch must be connected correctly to the stepper motor module.
3. The stepper motor module must be parameterised for using a reference switch.
4. Enable the motor driver. in_enabled is TRUE.

1. Set out_operation_mode to 1 (referencing).
2. Set out_ref_pos to the position of the reference switch.
3. To initiate referencing, set out_start to TRUE.

1. The drive system performes a reference run in the parameterised direction.
2. After a successful reference run, in_referenced changes to TRUE. The current position of the stepper motor and the current position of the rotary encoder are set to the value of out_ref_pos.