We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, i am using the AT89C51CC01 controller with integrated can and the can driver supplied together with the Keil App Note 167 Problem: Sending and receiving messages with extended IDs works ok, in simulated and real, but i have to switch to standard identifiers with 11 bit message length and so I modified some parts of the can_drv.c The simulator shows me, that my device is sending standard messages, but i have a problem with incoming messages and would like to simulate them using the SendInfo command in the debugger.ini How do I tell the SendInfo command only to use standard identifiers? - because the Simulator shows me that SendInfo is using extended identifiers
/* * Send Information on any ID */ FUNC void SendInfo (unsigned long id, // message ID unsigned char len, // message length unsigned char val) { // 1. value byte CAN0ID = id; // Set VTREG that keeps next ID CAN0L = len; // Set VTREG with message length CAN0B0 = val; // Set the data registers // CAN0B1 = val+1; // CAN0B2 = val+2; // CAN0B3 = val+3; // CAN0B4 = val+4; // CAN0B5 = val+5; // CAN0B6 = val+6; // CAN0B7 = val+7; CAN0IN = 2; // Send message to simulated controller }
The trick is in what value you assign to the CAN-IN VTREG. The CAN0IN VTREG specifies the type of CAN message the simulated MCU will receive. The values 1-4 are used: 1: Message with 11-bit ID. 2: Message with 29-bit ID. 3: Message Request with 11-bit ID. 4: Message Request with 29-bit ID. So, CAN0IN = 1; should make the simulated MCU receive an 11-bit message ID. Jon