Hi I've been trying to simulate receiving an incomming message from the CAN bus. I have followed the application notes AP147 and 167, and I have viewed discussion topics on this subject. I have included an ini file (project options > debug) with the following code to simulate a CAN signal:
CAN0ID = 0x196; //CANID CAN0L = 1; //Data length CAN0B0 = 0x01; //Data CAN0IN = 1; //11bit Identifier
*** error 34, line 9 : undefined identifier
Your simulation script looks good to me. What device are you using? Try DIR VTREG in the debugger and make sure all of the CAN registers are listed. Which of the lines you listed is line 9? Jon
Hi Jon, I tried the DIR VTREG and all the CAN registers appeared, although they were all set to 0. I'm using the Infineon C515C, one of the characteristics of the Infineon chips is that you need to include the following script in an ini to stop the watchdog timer reseting:
PE_SWD = 0 /* Disable Watchdog with pin PE_SWD */ reset /* perform CPU reset: uses value at PE_SWD */ g,main
CAN0ID = 0x196;
The Infineon C515C has just one CAN channel. The debug command DIR VTREG shows the available registers:
: CANID: ulong, value = 0x00000000 CANL: uchar, value = 0x00 CANB0: uchar, value = 0x00 CANB1: uchar, value = 0x00 CANB2: uchar, value = 0x00 CANB3: uchar, value = 0x00 CANB4: uchar, value = 0x00 CANB5: uchar, value = 0x00 CANB6: uchar, value = 0x00 CANB7: uchar, value = 0x00 CANIN: uchar, value = 0x00 CANOUT: uchar, value = 0x00
I just figured it out, thanks to using DIR VTREG command. I noted that the registers that were displayed using the DIR VTREG were:
CANID = CANL = CANIN = etc...
CAN0ID = CAN0L = CAN0IN = etc...