要如何可以同時傳送不同CAN ID and data,而且不用每次都要重新設定 CAN_setupMessageObject 。
每次重新設定 CAN_setupMessageObject 導致效率不太好,變成每個不同ID 傳送時間格都相差很大。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
要如何可以同時傳送不同CAN ID and data,而且不用每次都要重新設定 CAN_setupMessageObject 。
每次重新設定 CAN_setupMessageObject 導致效率不太好,變成每個不同ID 傳送時間格都相差很大。
您可以看一下CAN发送数据的函数。您可以设置一个循环让各个ID循环发送。
而发送数据的话您可以设置一个变量,而后将ADC的结果赋值给这个变量
//*****************************************************************************
//
//! Sends a Message Object
//!
//! \param base is the base address of the CAN controller.
//! \param objID is the object number to configure (1-32).
//! \param msgLen is the number of bytes of data in the message object (0-8)
//! \param msgData is a pointer to the message object's data
//!
//! This function is used to transmit a message object and the message data,
//! if applicable.
//!
//! \note The message object requested by the \e objID must first be setup
//! using the CAN_setupMessageObject() function.
//!
//! \return None.
//
//*****************************************************************************
extern void
CAN_sendMessage(uint32_t base, uint32_t objID, uint16_t msgLen,
const uint16_t *msgData);