PDO variable 64 bit
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 652
- Thank you received: 213
25 Dec 2024 11:16 #317339
by Hakan
Replied by Hakan on topic PDO variable 64 bit
In the bash prompt, you type in the command "ethercat pdos". This will list all pdos of all ethercat slaves in your system.
You have to wade through that output and see what options the device give you.
You have to wade through that output and see what options the device give you.
Please Log in or Create an account to join the conversation.
- papagno-source
- Offline
- Premium Member
-
Less
More
- Posts: 107
- Thank you received: 6
25 Dec 2024 11:29 #317341
by papagno-source
Replied by papagno-source on topic PDO variable 64 bit
Sorry, but I can't understand why look at what the drive can handle.
The problem is related to linuxcnc.
The created pin of pos-command is declared as a 32-bit float.
The drive returns more than 8,000.000 revolution counts and so after the movement of 326 cm, the variable becomes negative.
My question is: can we declare the created pin pos-command as a 64-bit float, so that we can handle larger values?
how do we do it, declaring: halType="double"?
The problem is related to linuxcnc.
The created pin of pos-command is declared as a 32-bit float.
The drive returns more than 8,000.000 revolution counts and so after the movement of 326 cm, the variable becomes negative.
My question is: can we declare the created pin pos-command as a 64-bit float, so that we can handle larger values?
how do we do it, declaring: halType="double"?
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 652
- Thank you received: 213
25 Dec 2024 11:41 - 25 Dec 2024 12:29 #317342
by Hakan
Replied by Hakan on topic PDO variable 64 bit
No, it is your drive.
Sorry, I am not being very helpful.
But you got to start with what the drive delivers to linuxcnc.
I doubt that it is a 64-bit float. Maybe a 64-bit integer, but also unlikely.
Anyway, you need to know what datatype the drive delivers.
When that is known, it can be converted and taken care of.
Actually the "ethercat pdos" doesn't list the datatype.
You can try with "lcec-configgen", it is better at guessing the datatype.
Nothing beats the manual though.
Sorry, I am not being very helpful.
But you got to start with what the drive delivers to linuxcnc.
I doubt that it is a 64-bit float. Maybe a 64-bit integer, but also unlikely.
Anyway, you need to know what datatype the drive delivers.
When that is known, it can be converted and taken care of.
Actually the "ethercat pdos" doesn't list the datatype.
You can try with "lcec-configgen", it is better at guessing the datatype.
Nothing beats the manual though.
Last edit: 25 Dec 2024 12:29 by Hakan.
Please Log in or Create an account to join the conversation.
- papagno-source
- Offline
- Premium Member
-
Less
More
- Posts: 107
- Thank you received: 6
25 Dec 2024 17:29 #317357
by papagno-source
Replied by papagno-source on topic PDO variable 64 bit
Ok I will try these commands, but I ask you, if I wanted to read or write in a PDO a float 64 value would it be possible?
This will mean that the pin that will be created will be declared as float 64.
halType="double"?
or hal non support pin declared 64 bit ?
This will mean that the pin that will be created will be declared as float 64.
halType="double"?
or hal non support pin declared 64 bit ?
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 652
- Thank you received: 213
25 Dec 2024 17:51 - 25 Dec 2024 18:10 #317359
by Hakan
Replied by Hakan on topic PDO variable 64 bit
It is already a 64-bit float or "double" as everyone calls it except in the ethercat-conf.xml file. Where it is called float.
Linuxcnc switched from 32-bit floats to 64-bit floats somewhere version 2.4 or so.
If this line works for you, then that is the best you can do.
This takes a signed integer from Ethercat, obviously the device's encoder position comes as a signed 32-bit integer. This is then converted into a halfloat, which is a double. I think this is what you ask for. All floats in hal are 64-bit doubles.
The conversions to float aren't named very good
"float": ethercat signed 32-bit integer to 64-bit hal float
"float-unsigned": ethercat unsigned 32-bit integer to 64-bit hal float
"float-ieee": ethercat floating point 32-bit REAL to 64-bit hal float
"float-double-ieee": ethercat floating point 64-bit LREAL to 64-bit hal float
Linuxcnc switched from 32-bit floats to 64-bit floats somewhere version 2.4 or so.
If this line works for you, then that is the best you can do.
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="poscommand" halType="float" scale="838860.7"/>
The conversions to float aren't named very good
"float": ethercat signed 32-bit integer to 64-bit hal float
"float-unsigned": ethercat unsigned 32-bit integer to 64-bit hal float
"float-ieee": ethercat floating point 32-bit REAL to 64-bit hal float
"float-double-ieee": ethercat floating point 64-bit LREAL to 64-bit hal float
Last edit: 25 Dec 2024 18:10 by Hakan.
Please Log in or Create an account to join the conversation.
- papagno-source
- Offline
- Premium Member
-
Less
More
- Posts: 107
- Thank you received: 6
25 Dec 2024 17:55 - 25 Dec 2024 17:57 #317360
by papagno-source
Replied by papagno-source on topic PDO variable 64 bit
so the possibilities of declaring a variable other than float are:
<pdoEntry idx="607A" subIdx="00" bitLen="64" halPin="poscommand" halType="float-sisgend" scale="838860.7"/>
<pdoEntry idx="607A" subIdx="00" bitLen="64" halPin="poscommand" halType="floa-ieee" scale="838860.7"/>
<pdoEntry idx="607A" subIdx="00" bitLen="64" halPin="poscommand" halType="float-double-ieee" scale="838860.7"/>
with bitLen = 64
it's correct ?
<pdoEntry idx="607A" subIdx="00" bitLen="64" halPin="poscommand" halType="float-sisgend" scale="838860.7"/>
<pdoEntry idx="607A" subIdx="00" bitLen="64" halPin="poscommand" halType="floa-ieee" scale="838860.7"/>
<pdoEntry idx="607A" subIdx="00" bitLen="64" halPin="poscommand" halType="float-double-ieee" scale="838860.7"/>
with bitLen = 64
it's correct ?
Last edit: 25 Dec 2024 17:57 by papagno-source.
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 652
- Thank you received: 213
25 Dec 2024 18:20 #317363
by Hakan
Replied by Hakan on topic PDO variable 64 bit
No that is not possible. BitLen refers to the ethercat data. It is 32-bit. It is what the device gives out. That's what I tried to make you verify hehe.
You can not change that to 64-bit, it is 32-bit. Device specification.
The line I showed, which is your first line, is ok. It makes a hal pin of type 64-bit float (or double as it is called) from 32-bit integer data from your device.
An alternative is to not make it a float, but keep it a 32-bit integer in hal is
This can help debugging, and there are type conversion functions in hal to turn it into a float.
You can not change that to 64-bit, it is 32-bit. Device specification.
The line I showed, which is your first line, is ok. It makes a hal pin of type 64-bit float (or double as it is called) from 32-bit integer data from your device.
An alternative is to not make it a float, but keep it a 32-bit integer in hal is
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="poscommand" halType="s32"/>
This can help debugging, and there are type conversion functions in hal to turn it into a float.
Please Log in or Create an account to join the conversation.
- papagno-source
- Offline
- Premium Member
-
Less
More
- Posts: 107
- Thank you received: 6
25 Dec 2024 18:30 - 25 Dec 2024 18:35 #317365
by papagno-source
Replied by papagno-source on topic PDO variable 64 bit
Ok, I think this is the limit and that is not being able to declare bitLen = 64.
Since bitLen = 32 is declared, the 32 bits saturate after 328 cm with a 10 mm pitch screw.
Ok, I think this is the limit and that is not being able to declare bitLen = 64.
Since bitLen = 32 is declared, the 32 bits saturate after 328 cm with a 10 mm pitch screw.
Is it not possible to extend to 64, by modifying the bitLen code?
You cannot assign a 32 bit to 64 bits.
The encoder value increases continuously and if the input variable has a length of 32 bits, when it has reached the maximum value, it will become negative to continue counting from the - sign towards 0 and continue counting in + until the next limit is reached.
Grotuius have send code the datatype handler.ccpp and is declared unint 64 in float 64.
Is it not possible to extend to 64, by modifying the bitLen code?
Since bitLen = 32 is declared, the 32 bits saturate after 328 cm with a 10 mm pitch screw.
Ok, I think this is the limit and that is not being able to declare bitLen = 64.
Since bitLen = 32 is declared, the 32 bits saturate after 328 cm with a 10 mm pitch screw.
Is it not possible to extend to 64, by modifying the bitLen code?
You cannot assign a 32 bit to 64 bits.
The encoder value increases continuously and if the input variable has a length of 32 bits, when it has reached the maximum value, it will become negative to continue counting from the - sign towards 0 and continue counting in + until the next limit is reached.
Grotuius have send code the datatype handler.ccpp and is declared unint 64 in float 64.
case 0x0011: // double
{
double val;
str >> val;
*(uint64_t *) target =
cpu_to_le64(*(uint64_t *) (void *) &val);
break;
}
break;
Is it not possible to extend to 64, by modifying the bitLen code?
Last edit: 25 Dec 2024 18:35 by papagno-source.
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 652
- Thank you received: 213
25 Dec 2024 19:04 #317366
by Hakan
Replied by Hakan on topic PDO variable 64 bit
We are there again. There are many things you can change.
But you can not change the data the drive's encoder gives out.
Ethercat only transports the data.
You should need to modify the device, how the device makes data available.
Not only as a 32-bit variable as it is today, but as a 64-bit variable. But you can not do that.
It is the drive that needs to give you that type of data. The drive needs to be modified,
a new PDO needs to be created with 64-bit encoder data. How can you do that?
How can you make the drive give out encoder position as a 64-bit integer?
You can not do that. It is what it is.
Ethercat only transports the PDO data the device has. Can not create new PDOs.
What you can do is to write a hal component that handles when the encoder wraps around.
But you can not change the data the drive's encoder gives out.
Ethercat only transports the data.
You should need to modify the device, how the device makes data available.
Not only as a 32-bit variable as it is today, but as a 64-bit variable. But you can not do that.
It is the drive that needs to give you that type of data. The drive needs to be modified,
a new PDO needs to be created with 64-bit encoder data. How can you do that?
How can you make the drive give out encoder position as a 64-bit integer?
You can not do that. It is what it is.
Ethercat only transports the PDO data the device has. Can not create new PDOs.
What you can do is to write a hal component that handles when the encoder wraps around.
Please Log in or Create an account to join the conversation.
- papagno-source
- Offline
- Premium Member
-
Less
More
- Posts: 107
- Thank you received: 6
25 Dec 2024 19:14 #317367
by papagno-source
Replied by papagno-source on topic PDO variable 64 bit
Ok thanks for support , i check the output encoder variable type if 32 or 64 bit.
But remember in some test if impose bitLen=64 have error because 64 bit not can use and this as limit.
I thing remain only gear reducer in drive 1/1 to 1/100.
again Thanks the your time.
But remember in some test if impose bitLen=64 have error because 64 bit not can use and this as limit.
I thing remain only gear reducer in drive 1/1 to 1/100.
again Thanks the your time.
Please Log in or Create an account to join the conversation.
Time to create page: 0.096 seconds