Delta Servo position register.

More
4 years 11 months ago #226984 by serdigi
Hello;

I already checked the ESTUN servo driver with EL6751. The pdo of the target location in the ESTUN driver was U32 bit.
I wanted to run my Delta ASD-A2 drive on the side to improve myself. However, in the Canopen whitepaper I found that the pdo target location consists of High(16bit) and low(16bit) words. As you know, Linuxcnc sends the Float type target location command. To solve this problem I will need low and high 16 bit conversion from Float. And of course, it needs to convert as fast as possible to match real time. My opinion is to convert from float to binary as fast as possible. The Ethercat Hal driver does the rest by dividing and sending complex data type bits. Waiting for your valuable ideas.
Kind regards.

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #227205 by andypugh
LinuxCNC HAL has float-to-int conversion:
linuxcnc.org/docs/2.8/html/man/man9/conv_float_u32.9.html

But it probably makes sense to write a custom component to output two 16-bit values as I imagine that there is some scaling required?

Do you know C at all?
linuxcnc.org/docs/2.8/html/hal/comp.html
The following user(s) said Thank You: serdigi

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #227235 by serdigi
Yes Andy.
I am proficient in C language.
Thanks for your support and advice. Earlier, I converted an integer 16bit value to 2 8bit values ​​(high and low). Of course, it's not that simple when it comes to converting a floating number.

void split(uint16_t pxreg1,uint16_t pxreg2)
{

px2=(uint8_t)(0x00ff)&(pxreg1);// low byte
pxreg1=pxreg1>>8;
px1=(uint8_t)((0x00ff)&pxreg1); high byte

px4=(uint8_t)(0x00ff)&(pxreg2);//low byte
pxreg2=pxreg2>>8;
px3=(uint8_t)((0x00ff)&pxreg2); high byte
}

I'm continuing to work. If I find a fast algorithm like I mentioned, I will share it. Being open to ideas has always improved me.

Best Regards.

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #227242 by andypugh
I don't think that you need to worry too much about speed. The component will run once every mS and will probably complete in nanoseconds.

I would let the compiler convert the float to an int, then split that into two HAL pins.
The following user(s) said Thank You: serdigi

Please Log in or Create an account to join the conversation.

More
4 years 10 months ago - 4 years 9 months ago #228533 by serdigi
Hello. This is a simple component. I have tested on the EL6751. The result is very good. I haven't had any lag issues. I wish you good luck. Kind regards.
SERDIGI.
Code:
component split "Delta ASD-A2 Firmware 1.03 linear Interpolation position register splitting HIGH Word and LOW Word"; pin in  float pos_in; pin out u32   pos_out; pin out u32   pos_low; pin out u32   pos_high; pin in     float resulation; variable uint32_t xtemp=0; variable uint16_t px1=0; variable uint16_t px2=0; function _; license "GPL"; author "serdigi"; ;; #include "rtapi_math.h"      FUNCTION(_) {     xtemp = pos_in * resulation;     px1 = (uint16_t)(xtemp)&;(0xFFFF);     px2 = (uint16_t)(xtemp>>16);     pos_low = px1;     pos_high = px2;      }
Last edit: 4 years 9 months ago by andypugh.

Please Log in or Create an account to join the conversation.

More
4 years 10 months ago #228572 by rodw
Replied by rodw on topic Delta Servo position register.
Hi, this is interesting as I'm just starting out with Ethercat. I am wondering why you are using the EL6751 when there is direct support for CIA402 drives which the ASD-A2 drive appears to be
github.com/dbraun1981/hal-cia402

I really want to get internal homing working with my drives via a component.. Stall homing sounds very cool.

It would also be great if the mods could move this to the Ethercat section


 

Please Log in or Create an account to join the conversation.

Time to create page: 0.377 seconds
Powered by Kunena Forum