解决温度采集延时问题

This commit is contained in:
2025-11-18 15:40:38 +08:00
parent 4f4a1635ab
commit daa4fd6bd3
12 changed files with 581 additions and 156 deletions

76
CAN.C
View File

@@ -283,6 +283,7 @@ void CAN_vInit(void)
CAN_vSetListCommand(0x010B0002); // MO11 for list 1
CAN_vSetListCommand(0x010C0002); // MO12 for list 1
CAN_vSetListCommand(0x010D0002); // MO13 for list 1
CAN_vSetListCommand(0x010E0002); // MO14 for list 1
/// -----------------------------------------------------------------------
/// Configuration of the CAN Message Objects 0 - 31:
@@ -1004,7 +1005,80 @@ void CAN_vInit(void)
/// -----------------------------------------------------------------------
/// Configuration of Message Object 14:
/// -----------------------------------------------------------------------
/// - message object 14 is not valid
/// - message object 14 is valid
/// - message object is used as receive object
/// - this message object is assigned to list 1 (node 0)
//--------------MOCTR14 = 0x00A00000---------------------------------------
CAN_vWriteCANAddress(CAN_MOCTR14); // Addressing MO14 control register
CAN_vWriteAMData(0x00A00000); // load MO14 control register
// CAN Address pointing to the CAN_MOAR14
CAN_ADCON = ADR_DEC; // Auto Decrement the current address(-1)
/// - priority class 3; transmit acceptance filtering is based on the list
/// order (like class 1)
/// - extended 29-bit identifier
/// - identifier 29-bit: 0x11000003
//--------------MOAR14 = 0xF1000003---------------------------------------
CAN_vWriteAMData(0xF1000003); // load MO14 arbitration register
// CAN Address pointing to the CAN_MODATAH14
CAN_ADCON = ADR_DEC; // Auto Decrement the current address(-1)
//--------------MODATAH14 = 0x00000000---------------------------------------
CAN_vWriteAMData(0x00000000); // load MO14 data register high
// CAN Address pointing to the CAN_MODATAL14
CAN_ADCON = ADR_DEC; // Auto Decrement the current address(-1)
//--------------MODATAL14 = 0x00000000---------------------------------------
CAN_vWriteAMData(0x00000000); // load MO14 data register low
// CAN Address pointing to the CAN_MOAMR14
CAN_ADCON = ADR_DEC; // Auto Decrement the current address(-1)
/// - only accept receive frames with matching IDE bit
/// - acceptance mask 29-bit: 0x1FFFFFFF
//--------------CAN_MOAMR14 = 0x3FFFFFFF------------------------------------
CAN_vWriteAMData(0x3FFFFFFF); // load MO14 acceptance mask register
// CAN Address pointing to the CAN_MOIPR14
CAN_ADCON = ADR_DEC; // Auto Decrement the current address(-1)
/// - use message pending register 0 bit position 14
//--------------MOIPR14 = 0x00000E00---------------------------------------
CAN_vWriteAMData(0x00000E00); // load MO14 interrupt pointer register
// CAN Address pointing to the CAN_MOFGPR14
CAN_ADCON = ADR_DEC; // Auto Decrement the current address(-1)
//--------------MOFGPR14 = 0x00000000---------------------------------------
CAN_vWriteAMData(0x00000000); // load MO14 FIFO/gateway pointer register
// CAN Address pointing to the CAN_MOFCR14
CAN_ADCON = ADR_DEC; // Auto Decrement the current address(-1)
/// - this object is a STANDARD MESSAGE OBJECT
/// - 8 valid data bytes
//--------------MOFCR14 = 0x08000000---------------------------------------
CAN_vWriteAMData(0x08000000); // load MO14 function control register
/// -----------------------------------------------------------------------
/// Configuration of Message Object 15:
/// -----------------------------------------------------------------------