This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Timer 3 code

My goal is to send out a CAN message every 3s. I am using Timer3 to check for the 3s expiry condition and then trigger the transmission of a CAN message. The problem with my code is that the CAN message does not go out at all (I am sure my CAN stuff is all ok). My Timer3 code is below:

void timer3(void)//initializing timer for 3s
{
 T3CON = 0x0007;//initializing timer3 control register while 'counting up'
 T3 = 0; //setting maximum value for Timer3 counter
 T3R = 1;

        switch(T3){
                                case 58593:
                                        CAN_tx_testerpresent();

                                case 65625:
                                        T3 = 0;

                                default:
                                        break;
                  }
  //CAN_tx_testerpresent();

}


If I uncomment the CAN_tx_testerpresent() function after the "switch" statement I am able to see 1 message go out after initialization. Commenting that step out amounts to no CAN message. Why do I have a switch case? So I can send out other messages with different periodicities. Can someone help me out please? Thanks.

0