CAN's 29ID

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN's 29ID

586 Views
vnv
Contributor II

This code comes from NXP's official example.But I do not know how to change to 29ID.Who knows to give me a reminder?

int main(void)
{
uint32_t CanApiClkInitTable[2];
/* Publish CAN Callback Functions */
CCAN_CALLBACKS_T callbacks = {
CAN_rx,
CAN_tx,
CAN_error,
NULL,
NULL,
NULL,
NULL,
NULL,
};
SystemCoreClockUpdate();
//Board_Init();
baudrateCalculate(TEST_CCAN_BAUD_RATE, CanApiClkInitTable);

LPC_CCAN_API->init_can(&CanApiClkInitTable[0], TRUE);
/* Configure the CAN callback functions */
LPC_CCAN_API->config_calb(&callbacks);
/* Enable the CAN Interrupt */
NVIC_EnableIRQ(CAN_IRQn);

/* Send a simple one time CAN message */
msg_obj.msgobj = 0;
msg_obj.mode_id = 0x345;
msg_obj.mask = 0x0;
msg_obj.dlc = 4;
msg_obj.data[0] = 'T'; // 0x54
msg_obj.data[1] = 'E'; // 0x45
msg_obj.data[2] = 'S'; // 0x53
msg_obj.data[3] = 'T'; // 0x54
LPC_CCAN_API->can_transmit(&msg_obj);

/* Configure message object 1 to receive all 11-bit messages 0x400-0x4FF */
msg_obj.msgobj = 1;
msg_obj.mode_id = 0x400;
msg_obj.mask = 0x700;
LPC_CCAN_API->config_rxmsgobj(&msg_obj);
#if 0
while (1) {
//__WFI(); /* Go to Sleep */
}
#endif
}

Labels (1)
0 Kudos
1 Reply

382 Views
vnv
Contributor II

Thank you very much for your tips.

0 Kudos