Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I have an EtherCat Wago 750-354 and I would like to do simple test for the output module (turn the leds on and off). I read the tutorial and I wrote short code for testing but I am not able to write the output module.
The tutorial link is: https://openethercatsociety.github.io/doc/soem/tutorial_8txt.html
and here is my code:
#define SLAVE_NR 1 void set_output_int8 (uint16 slave_no, uint8 module_index, int8 value) { uint8 *data_ptr; data_ptr = ec_slave[slave_no].outputs; /* Move pointer to correct module index*/ //data_ptr += module_index * 8; /* Read value byte by byte since all targets can't handle misaligned addresses */ *data_ptr++ = value; } void set_output_bit (uint16 slave_no, uint8 module_index, uint8 value) { /* Get the the startbit position in slaves IO byte */ uint8 startbit = ec_slave[slave_no].Ostartbit; /* Set or Clear bit */ if (value == 0) *ec_slave[slave_no].outputs &= ~(1 << (module_index - 1 + startbit)); else *ec_slave[slave_no].outputs |= (1 << (module_index - 1 + startbit)); } char IOmap[4096]; volatile int wkc; int main(int argc, char **argv) { int chk; //initialise SOEM if (ec_init("enp4s0f1")) { if ( ec_config_init(FALSE) > 0 ) { std::cout<<"slave found and configured"<<ec_slavecount<<std::endl; ec_config_map(&IOmap); ec_configdc(); std::cout<<"Slave mapped, state to SAFE_OP"<<std::endl; /* wait for all slaves to reach SAFE_OP state */ ec_statecheck(1, EC_STATE_SAFE_OP, EC_TIMEOUTSTATE * 4); std::cout<<"Request operational state for the slave"<<std::endl; ec_slave[1].state = EC_STATE_OPERATIONAL; /* send one valid process data to make outputs in slaves happy*/ ec_send_processdata(); ec_receive_processdata(EC_TIMEOUTRET); /* request OP state for all slaves */ ec_writestate(1); chk = 40; /* wait for all slaves to reach OP state */ do { ec_send_processdata(); ec_receive_processdata(EC_TIMEOUTRET REPLY 0 views 0 likes 0 shares Facebook Twitter Linked In WhatsApp
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.