sorry for my poor deutsch!
die Kollision mit lib_922 immer bei mir. Heute hinzufüge ich eine neue Mehode wie folgend,
und die Ergebnis seht gut aus:
colli_flag ist von der state_machine
Edit by StefanT: set code to pre format to make it readablevoid SetAndTransmitObject(unsigned char objectNr) { unsigned char send_obj_count; unsigned int m; unsigned char n; EX1=0; send_obj_value(objectNr); while((fb_state>0) || TR1 || wait_for_ack); send_obj_count=1; while( colli_flag && send_obj_count<4 ) { if(colli_flag) colli_flag = 0; //CSMA/CD, after a random time-delay resend!~ switch(send_obj_count) { case 1: if(colli_timedelay<15000) colli_timedelay = 30000- colli_timedelay; break; case 2: if(colli_timedelay<10000) colli_timedelay = 20000-colli_timedelay; break; case 3: if(colli_timedelay>10000) colli_timedelay -= 10000; break; case 4: while(colli_timedelay>5000) colli_timedelay -= 5000; break; } srand(colli_timedelay);//seed colli_timedelay for(n=0;n<10;n++) for(m=0;m<rand();m++); EX1=0; send_obj_value(objectNr); while((fb_state>0) || TR1 || wait_for_ack); send_obj_count++; } EX1=1; }