Alright,so back to a problem that I have not visited for a while. You guys probably know me as the CAN guy by now but here is a synoposis of what I am attempting:
1. Implement a RTC application and transmit the time information using a CAN message. 2. Read an incoming CAN message that also has time information. 3. Extract time information from incoming message & reload RTC registers. 4. Load new information on outgoing CAN information. For people who do not know what CAN is imagine frames divided into slots (each CAN frame has 8 slots or bytes, ofcourse their values in HEX)
I have the RTC part working. But for some reason my interrupt on incoming message does not seem to work. I would be grateful for any help. Below is the code for my interrupt:
//************************************** //ISR to handle incoming can messages //************************************** void can_isr(void) interrupt XP0INT { unsigned int i; for(i=0; i<=7; ++i) { CAN_OBJ[0].Data[i] = CAN_OBJ[1].Data[i];//stores all the bytes of incoming message into outgoing message } CAN_OBJ[1].MCR = 0xF5FD; //reset MSGLST/CPUUPD,INTPND for(i=0; i<=7; ++i) { can_data[i] = CAN_OBJ[0].Data[i];//storing data from incoming into int array } //storing new time value received from user's adjustment in the timer registers RTC.a = (can_data[0]*3600) + (can_data[1]*60); RTCL = RTC.rtcreg[0];//storing time value in s into the RTC registers RTCH = RTC.rtcreg[1]; //storing time value in s into the RTC registers current_day = can_data[2]; current_month = can_data[3]; currentRT(); }