Jump to content

checking if a motor is in position using canbus

Recommended Posts

Hello all,

First off, I am a total beginner in plc. Unfortunatly my first project is a little bit on the difficult side, a small machine containing motors and pneumatic cylinders. All communication to the motor is done with CANBUS.

Now, I would like to check if a motor is in position.

The way I do it now is by reading the position by reading pdo1 every 60ms. Then in my ladder program, I use a compare block to check if the position retrieved is equal to the commanded position.

I think this is kind of inefficient because now my program does a pdo rtr constantly every 60ms (to avoid canbus overflow), which is sometimes unnecessary because I only need to know the position sometimes.

so my question is, is there a better way to know when the motor is in position?


I was thinking about using the 4th bit from the status byte which turns to 1 when the motor is in position? But how to exactly implement this? Do I use a test bit to extract the bit and check it? But is this really better then checking the position via pdo1 and if so why?

And how to prevent the CANOPEN buffer to overflow? Right now there are timers in my program which only allow to read or write an instruction every 10ms... is there a better way to do this?


Thank you for everyone who can give some tips here.


Link to comment
Share on other sites

  • MVP 2023

In my last project, I used Lenze 8400 with embedded CANopen .

The capabilities of this driver make possible to prepare "hardware" PDO signal  "IN position", "0-position is known", "ACC", "DCC", ect...

I did not use timers in the program, but only use system bits SB288, 284, 242, 292  to avoid network collisions .

What motor driver used?

Maybe it is  ready to transfer needed bits or they can be re-assigned manually inside the drive.

Link to comment
Share on other sites

For the steppers I am using the SMC75 driver from JVL motors. We also have a MAC motor and MIS motor with integrated driver, also from JVL. I don't know if this driver can prepare the signal. If I understand you well, you mean that I can choose what exactly the PDO signal is? So I can change it to be "in position" instead of the actual position?

Can you also tell me that if I want to read the status bits, I need a special ladder block to update the status? Or is this done automatically? 

About the system bits, I have a program with more then 100 rungs. Each of the rungs also has a step counter, so I can only do one rung at a time.. Do you recommend reading that system bit as a NO contact at the beginning of each rung, so I skip it if the bit is low?


thanks for the response! (sorry about the many questions)

Link to comment
Share on other sites

  • MVP 2023

SMC75  and other JVL  driver with CAN offer commisioning  software for making application  setting.

As i see in pdf's  from JVL freeconfigurable  by software 32bit PDO register present.

I don't know your positioning configuration.  Is it  PDO used for transfer target position?

Why step counter is used,  when CANopen positioning in different mode present?

If it possible post image of project  connection (wiring).

In my application only isolated CANopen  connection OPLC to drive used.  Limit switches, home sensor,

and jog function switch conected to the motor driver and it's activity sended to OPLC via CANopen.

But signals must be preconfigured by driver software and linked to RPDO and TPDO.

On the OPLC side struct is used to conect MB array and ML or MI with the CANopen RPDO and TPDO.


About SB in ladder. I use it like NO only in CAN transmission rung.

 In attach i post my CANopen "first steps" realased for samba  but without driver side of configuration.

CANopen test lenze 8400.vlp

Link to comment
Share on other sites

Hi Kratmel


Thanks for the reply and added attachment, I will take a look at it. Also sorry for the late reply.

I will see if I can post an image of the wiring, but I must be careful because an NDA is involved here.


The other part of your post is difficult for me to follow.. 


but thank you very much for all the effort!




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...