New EtherCAT Slave Devices REAL data to HAL
- emresensoy
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 3
13 Aug 2025 08:19 #333318
by emresensoy
New EtherCAT Slave Devices REAL data to HAL was created by emresensoy
Hi there,
I made a new ethercat slave device, that you can connect any incremental encoder to ethercat network,
you can watch its video;
Everything is ok with Twincat, I can read A B Z pin situations, encoder puls register (s32), encoder rpm value (real)
But in HAL, I cant get ENC2RPM value correctly, it shows irrelevant numbers,
in xml file there is;
Main question;
what should be the halType for a variable that can read successfully in Twincat (REAL)
Slave devices ethercat xml command output is here;
I made a new ethercat slave device, that you can connect any incremental encoder to ethercat network,
you can watch its video;
Everything is ok with Twincat, I can read A B Z pin situations, encoder puls register (s32), encoder rpm value (real)
But in HAL, I cant get ENC2RPM value correctly, it shows irrelevant numbers,
in xml file there is;
<pdoEntry idx="0006" subIdx="01" bitLen="32" halPin="ENC2RPM" halType="float" />
Main question;
what should be the halType for a variable that can read successfully in Twincat (REAL)
Slave devices ethercat xml command output is here;
<!-- Slave 3 -->
<Vendor>
<Id>1640067</Id>
</Vendor>
<Descriptions>
<Devices>
<Device>
<Type ProductCode="#x00000001" RevisionNo="#x00000002">ENCODER INTERFACE</Type>
<Name><![CDATA[ENCODER INTERFACE]]></Name>
<Sm Enable="1" StartAddress="#x1000" ControlByte="#x64" DefaultSize="0" />
<Sm Enable="1" StartAddress="#x1200" ControlByte="#x20" DefaultSize="0" />
<RxPdo Sm="0" Fixed="1" Mandatory="1">
<Index>#x1600</Index>
<Name>Outputs</Name>
<Entry>
<Index>#x0005</Index>
<SubIndex>1</SubIndex>
<BitLen>32</BitLen>
<Name>ENC1_PULS_PER_REV</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x0005</Index>
<SubIndex>2</SubIndex>
<BitLen>32</BitLen>
<Name>ENC2_PULS_PER_REV</Name>
<DataType>UINT32</DataType>
</Entry>
</RxPdo>
<TxPdo Sm="1" Fixed="1" Mandatory="1">
<Index>#x1a00</Index>
<Name>Inputs</Name>
<Entry>
<Index>#x0006</Index>
<SubIndex>1</SubIndex>
<BitLen>32</BitLen>
<Name>ENC1RPM</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>2</SubIndex>
<BitLen>32</BitLen>
<Name>REAL_ENC1_PULSE_PER_REV</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>3</SubIndex>
<BitLen>32</BitLen>
<Name>ENC2RPM</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>4</SubIndex>
<BitLen>32</BitLen>
<Name>REAL_ENC2_PULSE_PER_REV</Name>
<DataType>UINT32</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>5</SubIndex>
<BitLen>16</BitLen>
<Name>ENC2POSITION</Name>
<DataType>UINT16</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>6</SubIndex>
<BitLen>16</BitLen>
<Name>ENC1POSITION</Name>
<DataType>UINT16</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>7</SubIndex>
<BitLen>8</BitLen>
<Name>ENC2A</Name>
<DataType>UINT8</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>8</SubIndex>
<BitLen>8</BitLen>
<Name>ENC2B</Name>
<DataType>UINT8</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>9</SubIndex>
<BitLen>8</BitLen>
<Name>ENC2Z</Name>
<DataType>UINT8</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>10</SubIndex>
<BitLen>8</BitLen>
<Name>ENC1A</Name>
<DataType>UINT8</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>11</SubIndex>
<BitLen>8</BitLen>
<Name>ENC1Z</Name>
<DataType>UINT8</DataType>
</Entry>
<Entry>
<Index>#x0006</Index>
<SubIndex>12</SubIndex>
<BitLen>8</BitLen>
<Name>ENC1B</Name>
<DataType>UINT8</DataType>
</Entry>
</TxPdo>
</Device>
</Devices>
The following user(s) said Thank You: tommylight, besriworld
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 796
- Thank you received: 273
13 Aug 2025 12:47 - 13 Aug 2025 13:07 #333332
by Hakan
Replied by Hakan on topic New EtherCAT Slave Devices REAL data to HAL
halType="float-ieee" matches REAL type
Cool board, is there IO on the board as well?
I see you have this in the ESI fileYou might have a mixup on names, ESI file says ENC2RPM is at 0x0006:03
They are also specified here as UINT32. And you say float (Ethercat REAL type).
This doesn't match.
Make the datatype REAL for this variable, read it as a float in the processor and as float-ieee in hal (gous into a float type hal variable)
Cool board, is there IO on the board as well?
I see you have this in the ESI file
<Entry>
<Index>#x0006</Index>
<SubIndex>1</SubIndex>
<BitLen>32</BitLen>
<Name>ENC1RPM</Name>
<DataType>UINT32</DataType>
</Entry>
They are also specified here as UINT32. And you say float (Ethercat REAL type).
This doesn't match.
Make the datatype REAL for this variable, read it as a float in the processor and as float-ieee in hal (gous into a float type hal variable)
Last edit: 13 Aug 2025 13:07 by Hakan. Reason: after checking ESI file content
The following user(s) said Thank You: emresensoy
Please Log in or Create an account to join the conversation.
- emresensoy
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 3
13 Aug 2025 14:00 #333335
by emresensoy
Replied by emresensoy on topic New EtherCAT Slave Devices REAL data to HAL
Dear Hakan,
thank you very much,
Now everything is ok, and works good,
This encoder interface has no IO,
But I made another IO card, it has 12x Digital input, 12x Digital output, 4x Analog 0-10V input and 4x Analog 0-10V output,
thank you very much,
Now everything is ok, and works good,
This encoder interface has no IO,
But I made another IO card, it has 12x Digital input, 12x Digital output, 4x Analog 0-10V input and 4x Analog 0-10V output,
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
-
Less
More
- Posts: 796
- Thank you received: 273
14 Aug 2025 07:14 #333384
by Hakan
Replied by Hakan on topic New EtherCAT Slave Devices REAL data to HAL
The boards looks nice, is it a hobby or are you going to sell them?
I guess you already know this but just in case, here is how you create individual pins for i/o
I guess you already know this but just in case, here is how you create individual pins for i/o
<pdoEntry idx="6002" subIdx="00" bitLen="8" halType="complex">
<complexEntry bitLen="1" halPin="in-1" halType="bit"/>
<complexEntry bitLen="1" halPin="in-2" halType="bit"/>
<complexEntry bitLen="1" halPin="in-3" halType="bit"/>
and so on
The following user(s) said Thank You: emresensoy
Please Log in or Create an account to join the conversation.
- emresensoy
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 3
14 Aug 2025 18:08 #333432
by emresensoy
I also checked the XML files, they are REAL too,
But output of ethercat xml command, it seems like UINT32, I dont know why,
By the way, I am planning to sell the boards via ebay, and the Turkish local market via n11.com
there is 3. board, it can control 4x RC servo motor, actually it has 4x isolated PWM output,
Replied by emresensoy on topic New EtherCAT Slave Devices REAL data to HAL
as you can see, in the twincat ENC1RPM and ENC2RPM is REAL,
They are also specified here as UINT32. And you say float (Ethercat REAL type). This doesn't match. Make the datatype REAL for this variable, read it as a float in the processor and as float-ieee in hal (gous into a float type hal variable)
I also checked the XML files, they are REAL too,
But output of ethercat xml command, it seems like UINT32, I dont know why,
By the way, I am planning to sell the boards via ebay, and the Turkish local market via n11.com
there is 3. board, it can control 4x RC servo motor, actually it has 4x isolated PWM output,
Please Log in or Create an account to join the conversation.
Time to create page: 0.065 seconds