I am learning to control things now. :) I am using SOEM, ethercat stack for the same. PC is my master and servo motor would be my slave. I have learnt couple of things there but stuck at moving the servo motor. I made sure that the data is sent from the master but for some reason, it is not reaching at the slave, i.e. servo motor. That is the reason to reaching out to you guys.
My concise is that it has to do something with the Sync Manager but as a learner, I am not sure.
// Code for reaching the slaves to operational state
// And then I try to control the servo motor by writing to its control word(6040).
// send_data & receive_data is called as usual for master/slave.
if(ec_slave[0].state == EC_STATE_OPERATIONAL) {
uint16 status[1];
int pointer_2=sizeof(status);
uint16 uint16val;
printf("Operational state reached for all slaves.\n");
for(i = 1; i <= 10; i++) {
ec_send_processdata();
wkc = ec_receive_processdata(EC_TIMEOUTRET);
ec_SDOread(1,0x6041,0,FALSE,&pointer_2,&status, EC_TIMEOUTRXM);
printf("status=%d\n", status[0]);
uint16val=0xf;
ec_SDOwrite(1, 0x6040, 0, FALSE, sizeof(uint16val), &uint16val, EC_TIMEOUTRXM);
osal_usleep(5000);
}
}
The status this code prints is '608'.
Are there any experts out there who can direct me next steps? Cheers to them.
P.S. Please change/add the tags if they do not fit right.