Little problem with the minus sign to send position to a servo controller:

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Hi,

I have a Little problem with the minus sign.

The actual postion works fine but the send position doesn't arrive well in the drive.

So, my code for the actual position is:

Code:
        #TEMP_VARS.REC_POS_DWORD := ROL(
                                   IN := #PN_POS_ACT_D,
                                   N := 16);
                                   #TEMP_VARS.REC_POS_DINT := DWORD_TO_DINT(#TEMP_VARS.REC_POS_DWORD);
                                   #STD.RESULT."GRAPH RET"."ACT POS" := DINT_TO_REAL(#TEMP_VARS.REC_POS_DINT) / 10.0;

This works perfectly, when I control the axis manually below zero, this is correct.

But when I send with the following code to the drive, the position is the drive below zero is completely rubbish:

Code:
        #PN_POS_SET_D := ROL(
                             IN := DINT_TO_DWORD(ROUND(#STD.CMD."GRAPH CMD"."POS SET" * 10.0)),
                             N := 16);

I allready tried conversion from REAL_TO_DWORD, but that wasn't a succes either.

Owyeah, the ROL is because there is a word swap, the drive is a Lenze.

Any ideas ?

Thanks,
Gerry
 
Nothing wrong with your code with the test data I used.

Set a known position of -0.2 which converts to FFFEFFFF for the data you send to the drive and should be FFFFFFFE in the drive. Compare this bit pattern with the "rubbish" you see in the drive - there must be a correlation that you can see.

lenze.jpg
 
Hello

Hello,

An amazing thank you for doing the test. Yes I will do the test with minus 0,2 tomorow. Thanks for the advice. I'll give feedback here afterwards, thank you.

Kind regards,
Gerry


Nothing wrong with your code with the test data I used.

Set a known position of -0.2 which converts to FFFEFFFF for the data you send to the drive and should be FFFFFFFE in the drive. Compare this bit pattern with the "rubbish" you see in the drive - there must be a correlation that you can see.
 

Similar Topics

hey there. i have an ET200S connected to my pc using an MPI and to it it's connected an OP77B, using profibus. my question is: how do i connect to...
Replies
3
Views
2,572
Hi, Need a little bit guiding using SISTEMA software. As I understand a subsystem consist of components and are the same category. I'm confused...
Replies
11
Views
2,539
Good morning everyone, I've got 2 servo driven axes that each use a Heidenhain glass slide to the motion controller for position and velocity...
Replies
4
Views
1,387
RSLogix 500, what is the little image next to the ladder in the project tree? it looks like a little blue bug with a red dot on its back. just...
Replies
5
Views
2,015
Hi everyone, trying to get data out of a digital encoder that is little endian into my Siemens S7-1200 controller that is big endian...it's an...
Replies
7
Views
3,265
Back
Top Bottom