- Posts: 295
- Thank you received: 125
Ethercat HAL driver
- chimeno
- Offline
- Elite Member
-
someone can help me, I have a doubt with this part of the file code, I think this serves for the home function, I do not understand its operation, I can not find any concrete example of how to connect it to the .hal file.
thanks
Chimeno
// update raw position counter
pos_cnt = EC_READ_S32(&pd[hal_data->pos_mot_pdo_os]);
pos_cnt_rel = pos_cnt - hal_data->home_raw;
*(hal_data->enc_raw) = pos_cnt;
*(hal_data->enc_raw_rel) = pos_cnt_rel;
*(hal_data->on_home_neg) = (pos_cnt_rel <= 0);
*(hal_data->on_home_pos) = (pos_cnt_rel >= 0);
pos_cnt <<= 8;
pos_cnt_diff = pos_cnt - hal_data->last_pos_cnt;
hal_data->last_pos_cnt = pos_cnt;
hal_data->pos_cnt += pos_cnt_diff;
rel_count = ((long long) pos_cnt_rel) << 8;
// check for index edge
if (*(hal_data->index_ena)) {
index_tmp = (hal_data->pos_cnt >> 32) & 0xffffffff;
if (hal_data->do_init || !hal_data->last_index_ena) {
hal_data->index_ref = index_tmp;
} else if (index_tmp > hal_data->index_ref) {
hal_data->index_cnt = (long long)index_tmp << 32;
*(hal_data->index_ena) = 0;
} else if (index_tmp < hal_data->index_ref) {
hal_data->index_cnt = (long long)hal_data->index_ref << 32;
*(hal_data->index_ena) = 0;
}
}
hal_data->last_index_ena = *(hal_data->index_ena);
// handle initialization
if (hal_data->do_init || *(hal_data->pos_reset)) {
hal_data->do_init = 0;
hal_data->index_cnt = hal_data->pos_cnt;
}
// compute net counts
net_count = hal_data->pos_cnt - hal_data->index_cnt;
// update raw counter pins
*(hal_data->pos_raw_hi) = (net_count >> 32) & 0xffffffff;
*(hal_data->pos_raw_lo) = net_count & 0xffffffff;
// scale count to make floating point position
*(hal_data->pos_fb) = ((double) net_count) * hal_data->pos_scale_cnt;
*(hal_data->pos_fb_rel) = ((double) rel_count) * hal_data->pos_scale_cnt;
- chimeno
- Offline
- Elite Member
-
- Posts: 295
- Thank you received: 125
chimeno wrote: Hello,
someone can help me, I have a doubt with this part of the file code, I think this serves for the home function, I do not understand its operation, I can not find any concrete example of how to connect it to the .hal file.
thanks
Chimeno
// update raw position counter
pos_cnt = EC_READ_S32(&pd[hal_data->pos_mot_pdo_os]);
pos_cnt_rel = pos_cnt - hal_data->home_raw;
*(hal_data->enc_raw) = pos_cnt;
*(hal_data->enc_raw_rel) = pos_cnt_rel;
*(hal_data->on_home_neg) = (pos_cnt_rel <= 0);
*(hal_data->on_home_pos) = (pos_cnt_rel >= 0);
pos_cnt <<= 8;
pos_cnt_diff = pos_cnt - hal_data->last_pos_cnt;
hal_data->last_pos_cnt = pos_cnt;
hal_data->pos_cnt += pos_cnt_diff;
rel_count = ((long long) pos_cnt_rel) << 8;
// check for index edge
if (*(hal_data->index_ena)) {
index_tmp = (hal_data->pos_cnt >> 32) & 0xffffffff;
if (hal_data->do_init || !hal_data->last_index_ena) {
hal_data->index_ref = index_tmp;
} else if (index_tmp > hal_data->index_ref) {
hal_data->index_cnt = (long long)index_tmp << 32;
*(hal_data->index_ena) = 0;
} else if (index_tmp < hal_data->index_ref) {
hal_data->index_cnt = (long long)hal_data->index_ref << 32;
*(hal_data->index_ena) = 0;
}
}
hal_data->last_index_ena = *(hal_data->index_ena);
// handle initialization
if (hal_data->do_init || *(hal_data->pos_reset)) {
hal_data->do_init = 0;
hal_data->index_cnt = hal_data->pos_cnt;
}
// compute net counts
net_count = hal_data->pos_cnt - hal_data->index_cnt;
// update raw counter pins
*(hal_data->pos_raw_hi) = (net_count >> 32) & 0xffffffff;
*(hal_data->pos_raw_lo) = net_count & 0xffffffff;
// scale count to make floating point position
*(hal_data->pos_fb) = ((double) net_count) * hal_data->pos_scale_cnt;
*(hal_data->pos_fb_rel) = ((double) rel_count) * hal_data->pos_scale_cnt;
hello again, you can expand the scale, now I need to use the scale correctly.
regards
Chimeno
- Automata27
- Offline
- New Member
-
- Posts: 11
- Thank you received: 6
i am using panasonic A6 drives with linuxcnc ethercat hal driver using lcec & lcec_ conf...currently i am facing issue of ethercat synch or dc ( distributed clocks) issue on my system...
details are posted at this ethercat synch & dc problem along with xml file and output waveform attached...
is anyone aware of such issue??
Thanks,
Regards.
- ChrisB
- Offline
- Junior Member
-
- Posts: 24
- Thank you received: 0
i have 5 Kollmorgen Servostar 300 and a ek1100 and 3 EL 2008 and 2 EL 1018.
My problem is, that the ethercat commandlinetool does not find the ek and the el moules.
When i just plug in the 5 servocontroller i find the 5 slaves.
The leds are flashing. When i plug in all in a row, no slave is found.
Could someone imagine what the problem is?
Thanks
- ChrisB
- Offline
- Junior Member
-
- Posts: 24
- Thank you received: 0
I changed the sequence. I connected the servocontroller first and ek1100.
Now i can find all slaves.
But i dont understand the problem
Servocontroller use coe
- chimeno
- Offline
- Elite Member
-
- Posts: 295
- Thank you received: 125
It may be that the secondary channel of the EK1100 is closed or for some reason or does not work well.
regards
Chimeno