variables { /*Timer which send iBR message at different interval */ msTimer timer_msg_iBR_2; /** Different iBR messages used for simulation. */ message iBR_2 msg_iBR_2; double speed; int counter = 0; } /** * CALLBACK : on start * When the CANoe simulation start, the timers are initialized. */ on start { setTimer(timer_msg_iBR_2, 20); speed = 10; } on timer timer_msg_iBR_2 { transmit_msg_iBR_2(); output(msg_iBR_2); setTimer(timer_msg_iBR_2, 20); } void transmit_msg_iBR_2() { msg_iBR_2.BCK_UP_SPEED = speed; msg_iBR_2.CRC_iBR_2 = CalculateCRC(msg_iBR_2); // output(msg_iBR_2); } on key 'a' { if ((speed < 250)|| speed > 0) speed++; else if(speed > 0) speed--; output(msg_iBR_2); } on key 'b' { if(speed < 0) speed = 0; output(msg_iBR_2); } byte CalculateCRC(message* msg) { int i; byte Chksum; Chksum = 0; for(i=0;i<7;i++){ Chksum ^= msg.BYTE(i); } return Chksum; }