# Stepper motor control without encoder, using mappControl and MpAxisBasic

**URL:** <https://community.br-automation.com/t/stepper-motor-control-without-encoder-using-mappcontrol-and-mpaxisbasic/6998>\
**Category:** Mechatronics & Motion\
**Tags:** motors, library, stepper, mapp-services, mapp-motion\
**Created:** [May 19, 2025, 2:44pm UTC](https://community.br-automation.com/t/stepper-motor-control-without-encoder-using-mappcontrol-and-mpaxisbasic/6998 "2025-05-19T14:44:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Snide21](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@Snide21](https://community.br-automation.com/u/Snide21)\
**Post date:** [May 19, 2025, 2:44pm UTC](https://community.br-automation.com/t/stepper-motor-control-without-encoder-using-mappcontrol-and-mpaxisbasic/6998/1 "2025-05-19T14:44:46Z")

</div>

Hi, I have an X20SM1436-1 with which I want to control a stepper motor without any form of feedback.  
The idea would be to do a calibration everytime before operation by moving the actuator to a set position which will trigger a digital input to confirm it’s reached, and from there just count the steps.  
I’ve setup my motorwith mappMotion and I’ve been trying to move it useing MpAxisBasic library but with no results. I haven’t found any examples of stepper motor control without feedback so I’m a bit confused on the programming part, any suggestions or help?

---

<div class="post-metadata">

**Author:** ![michael.bertsch](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/michael.bertsch/32/239_2.png) [@michael.bertsch](https://community.br-automation.com/u/michael.bertsch)\
**Post date:** [May 19, 2025, 3:09pm UTC](https://community.br-automation.com/t/stepper-motor-control-without-encoder-using-mappcontrol-and-mpaxisbasic/6998/2 "2025-05-19T15:09:39Z")

</div>

Hello,

In the Configuration of the SM1436-1 there should be this line were you can set up the Feedback / Encoder Link. If you set it to no encoder the system knows that there is no feedback and just generates a set value for the movement.  
On the Programming Part there is no differences.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/5/57a81e10cf2699268f8afd531c52c9175db768b1.png)

I would also hint to read the Guide which contains a lot of information about how to commission a stepper axis. The most important part is that you configure the timing of SystemTimer and X2X/Powerlink in an synchron way.

> [@Guide: Motion Comissioning for Beginners](https://community.br-automation.com/t/guide-motion-comissioning-for-beginners/1679):
>
> Introduction Preparation Single Axis 3.1. Visual inspection 3.2. EMC 3.3. Checking the parameterization 3.3.1. Timing settings 3.3.2. Logical axis parameters 3.3.3. Parameters of the drive actuator 3.3.4. Motor parameters 3.4. Initial commissioning of the hardware 3.4.1. Checking the communication to the drive plate / detecting a firmware upgrade 3.4.2. Testing any existing reference/limit switches 3.4.3. Testing any existing safety/additional brakes 3.4.4. Testing the STO re…

Greetings  
Michael Bertsch

---

<div class="post-metadata">

**Author:** ![Snide21](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@Snide21](https://community.br-automation.com/u/Snide21)\
**Post date:** [May 20, 2025, 7:26am UTC](https://community.br-automation.com/t/stepper-motor-control-without-encoder-using-mappcontrol-and-mpaxisbasic/6998/3 "2025-05-20T07:26:30Z")

</div>

I set up the axis object, configured the SM card with it, and configured the SystemTimer and X2X/Powerlink both at 1000us without tolerance.  
Then when using MpAxisBasic I just wanted to enable it and see “MpAxisBasic.info.communicationReady = TRUE”, instead I get an error “mcAXIS\_ERR\_MPLINK\_CORRUPT”.

the code I wrote is literally only:

> PROGRAM \_INIT  
> MpAxisBasic\_0.Enable := 1;  
> MpAxisBasic\_0.MpLink := ADR(axis\_1);  
> END\_PROGRAM
> 
> PROGRAM \_CYCLIC  
> MpAxisBasic();  
> END\_PROGRAM

---

<div class="post-metadata">

**Author:** ![michael.bertsch](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/michael.bertsch/32/239_2.png) [@michael.bertsch](https://community.br-automation.com/u/michael.bertsch)\
**Post date:** [May 20, 2025, 8:10am UTC](https://community.br-automation.com/t/stepper-motor-control-without-encoder-using-mappcontrol-and-mpaxisbasic/6998/4 "2025-05-20T08:10:40Z")

</div>

Hello,

your Program looks quite well. You only missed the Parameter reference but up now this is not relevant.

Local Variables  
 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/9/9c8fa6cfdeb9aa71c9d62897037cddd759d28a93.png)

Declaration of Axis

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/3/3d130c5c6901109bc8698dcd6cf5af6c9a651c2f.png)

```auto
PROGRAM _INIT
	MpAxisBasic_0.Enable := TRUE;
END_PROGRAM

PROGRAM _CYCLIC
	MpAxisBasic_0.MpLink := ADR(gAxis_1);
	MpAxisBasic_0.Parameters := ADR(MpAxisBasicPar_0);
	MpAxisBasic_0();
END_PROGRAM

```

The Axis Reference Variable contains some Adress Information to the System and is only filled with data during start up of the motion system.  
So if you did your first Transfer, and the plc did not restart, the entry of the Variable is empty. This will lead to the descriped error.  
Solution is just do a restart of the PLC to bring the motion system through startup.  
You can have a look into the contend of the Axis-Reference.

The initialised data should look like this… the numbers can be differend as they are pointers to internal memory.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/1/19efcbb0d19eb566a9095d1f425a11df572877e2.png)

If you make a transfer and the only task using this variable gets deleted, the contend of a global variable can be lost. To prevent this, i generate a dummy Task only containing the Axis-References. So this task is unlikly to change and the variable is used by more than one task.

```auto
PROGRAM _INIT
      gAxis_1; 
END_PROGRAM

```

Greetings  
Michael

---

<div class="post-metadata">

**Author:** ![Snide21](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@Snide21](https://community.br-automation.com/u/Snide21)\
**Post date:** [May 20, 2025, 11:35am UTC](https://community.br-automation.com/t/stepper-motor-control-without-encoder-using-mappcontrol-and-mpaxisbasic/6998/5 "2025-05-20T11:35:26Z")

</div>

apparently the problem is that the content of the axis reference is alway null:

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/7/72026eba058809f7d2bea91c296c203afdb8049a.png)

I’ve tried creating a dummy task with only an init program that calls for my axistype but nothing, still empty. tried also restarting the PLC, still nothing.

---

<div class="post-metadata">

**Author:** ![michael.bertsch](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/michael.bertsch/32/239_2.png) [@michael.bertsch](https://community.br-automation.com/u/michael.bertsch)\
**Post date:** [May 20, 2025, 3:41pm UTC](https://community.br-automation.com/t/stepper-motor-control-without-encoder-using-mappcontrol-and-mpaxisbasic/6998/6 "2025-05-20T15:41:14Z")

</div>

Hello,

1. Check that the used axis reference has the same name as the configuration object defines.

2. Did you set up the AxisReference at the SM-Hardware Module Configuration

3. Check that the library McStpAx is part of the project.

4. Check logger for messages about the axis

Greetings Michael
