This commit is contained in:
2026-03-20 21:19:04 +08:00
parent 90c3d919df
commit 9d3b4b836f
247 changed files with 22127 additions and 30305 deletions

0
library/inc/cmsis_armclang.h Executable file → Normal file
View File

0
library/inc/cmsis_compiler.h Executable file → Normal file
View File

0
library/inc/cmsis_version.h Executable file → Normal file
View File

0
library/inc/core_cm0plus.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_adc.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_btim.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_crc.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_dac.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_dma.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_dmamux.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_eeprom.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_exti.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_flash.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_gpio.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_i2c.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_iwdg.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_lhl_config.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_lptim.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_mcal.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_mio.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_owi.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_power.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_rcc.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_rtc.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_spi.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_timer.h Executable file → Normal file
View File

0
library/inc/lh32m0g3x_uart.h Executable file → Normal file
View File

30
library/inc/lh32m0g3x_xlink.h Executable file → Normal file
View File

@@ -28,16 +28,16 @@ typedef enum
XLINK0_INPUT_XB_IN1, XLINK0_INPUT_XB_IN1,
XLINK0_INPUT_XB_IN2, XLINK0_INPUT_XB_IN2,
XLINK0_INPUT_XB_IN3, XLINK0_INPUT_XB_IN3,
XLINK0_INPUT_TIM0_TRGO,
XLINK0_INPUT_TIM0_INT,
XLINK0_INPUT_TIM1_TRGO, XLINK0_INPUT_TIM1_TRGO,
XLINK0_INPUT_TIM1_INT, XLINK0_INPUT_TIM1_INT,
XLINK0_INPUT_TIM2_TRGO,
XLINK0_INPUT_TIM2_INT,
XLINK0_INPUT_ADC0_CNV_DONE, XLINK0_INPUT_ADC0_CNV_DONE,
XLINK0_INPUT_ADC1_CNV_DONE, XLINK0_INPUT_ADC1_CNV_DONE,
XLINK0_INPUT_LPTIM1_INT = 0x10u, XLINK0_INPUT_LPTIM0_INT = 0x10u,
XLINK0_INPUT_LPTIM2_INT, XLINK0_INPUT_LPTIM1_INT,
XLINK0_INPUT_BTIM0_TRIGGER,
XLINK0_INPUT_BTIM1_TRIGGER, XLINK0_INPUT_BTIM1_TRIGGER,
XLINK0_INPUT_BTIM2_TRIGGER,
XLINK0_INPUT_RTC_ALARM, XLINK0_INPUT_RTC_ALARM,
XLINK0_INPUT_FAULT, XLINK0_INPUT_FAULT,
XLINK0_INPUT_SOFT_SYNC, XLINK0_INPUT_SOFT_SYNC,
@@ -55,20 +55,20 @@ typedef enum
typedef enum typedef enum
{ {
XLINK1_INPUT_TIM1_TRGO = 0x00u, /*!< Cross Link 1 输入源 */ XLINK1_INPUT_TIM0_TRGO = 0x00u, /*!< Cross Link 1 输入源 */
XLINK1_INPUT_TIM0_INT,
XLINK1_INPUT_TIM1_TRGO,
XLINK1_INPUT_TIM1_INT, XLINK1_INPUT_TIM1_INT,
XLINK1_INPUT_TIM2_TRGO,
XLINK1_INPUT_TIM2_INT,
XLINK1_INPUT_ADC0_CNV_DONE, XLINK1_INPUT_ADC0_CNV_DONE,
XLINK1_INPUT_ADC1_CNV_DONE, XLINK1_INPUT_ADC1_CNV_DONE,
XLINK1_INPUT_XB_IN0, XLINK1_INPUT_XB_IN0,
XLINK1_INPUT_XB_IN1, XLINK1_INPUT_XB_IN1,
XLINK1_INPUT_XB_IN2, XLINK1_INPUT_XB_IN2,
XLINK1_INPUT_XB_IN3, XLINK1_INPUT_XB_IN3,
XLINK1_INPUT_LPTIM1_INT = 0x0Eu, XLINK1_INPUT_LPTIM0_INT = 0x0Eu,
XLINK1_INPUT_LPTIM2_INT, XLINK1_INPUT_LPTIM1_INT,
XLINK1_INPUT_BTIM0_TRIGGER,
XLINK1_INPUT_BTIM1_TRIGGER, XLINK1_INPUT_BTIM1_TRIGGER,
XLINK1_INPUT_BTIM2_TRIGGER,
XLINK1_INPUT_RTC_ALARM, XLINK1_INPUT_RTC_ALARM,
XLINK1_INPUT_FAULT, XLINK1_INPUT_FAULT,
XLINK1_INPUT_SOFT_SYNC, XLINK1_INPUT_SOFT_SYNC,
@@ -89,12 +89,12 @@ typedef enum
XLINK0_OUTPUT_ADC0_TRIG = 0x0008U, XLINK0_OUTPUT_ADC0_TRIG = 0x0008U,
XLINK0_OUTPUT_ADC1_TRIG = 0x0808U, XLINK0_OUTPUT_ADC1_TRIG = 0x0808U,
XLINK0_OUTPUT_DAC_SYNC = 0x1008U, XLINK0_OUTPUT_DAC_SYNC = 0x1008U,
XLINK0_OUTPUT_TIM1_ITR0 = 0x1808U, XLINK0_OUTPUT_TIM0_ITR0 = 0x1808U,
XLINK0_OUTPUT_TIM2_ITR0 = 0x000CU, XLINK0_OUTPUT_TIM1_ITR0 = 0x000CU,
XLINK0_OUTPUT_MIO_TRIGGER_IN0 = 0x080CU, XLINK0_OUTPUT_MIO_TRIGGER_IN0 = 0x080CU,
XLINK0_OUTPUT_MIO_TRIGGER_IN1 = 0x100CU, XLINK0_OUTPUT_MIO_TRIGGER_IN1 = 0x100CU,
XLINK0_OUTPUT_LPTIM1_CL = 0x180CU, XLINK0_OUTPUT_LPTIM0_CL = 0x180CU,
XLINK0_OUTPUT_LPTIM2_CL = 0x0010U, XLINK0_OUTPUT_LPTIM1_CL = 0x0010U,
} XLINK0_OUTPUT_PORT_t; } XLINK0_OUTPUT_PORT_t;
/** /**

0
library/inc/lh32m0xx_lhl.h Executable file → Normal file
View File

0
library/inc/qfplib-m0-full.h Executable file → Normal file
View File

0
library/inc/sdk_mio_common.h Executable file → Normal file
View File

0
library/src/lh32m0g3x_adc.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_btim.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_crc.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_dac.c Executable file → Normal file
View File

2
library/src/lh32m0g3x_dma.c Executable file → Normal file
View File

@@ -319,6 +319,8 @@ void LHL_DMA_ITConfig(DMA_HandleTypeDef* handle, uint32_t DMA_IT, FunctionalStat
} }
} }
void LHL_DMA_Start(DMA_HandleTypeDef* handle) void LHL_DMA_Start(DMA_HandleTypeDef* handle)
{ {
pDMA_CONTROL->DMA_SERQ = handle->Channel; pDMA_CONTROL->DMA_SERQ = handle->Channel;

0
library/src/lh32m0g3x_dmamux.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_eeprom.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_exti.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_flash.c Executable file → Normal file
View File

2
library/src/lh32m0g3x_gpio.c Executable file → Normal file
View File

@@ -118,7 +118,7 @@ void LHL_GPIO_Init(GPIO_TypeDef* pGPIOx, GPIO_InitTypeDef* GPIO_Init)
{ {
pGPIOx->PUE &= ~(1u << pinpos); pGPIOx->PUE &= ~(1u << pinpos);
pGPIOx->PDE &= ~(1u << pinpos); pGPIOx->PDE &= ~(1u << pinpos);
} }
/* AFIO设置应该被设置 */ /* AFIO设置应该被设置 */
pGPIOx->CON0 &= ~((uint32_t)0xf << (pinpos*4)); pGPIOx->CON0 &= ~((uint32_t)0xf << (pinpos*4));

248
library/src/lh32m0g3x_i2c.c Executable file → Normal file
View File

@@ -645,21 +645,6 @@ void LHL_I2C_SoftwareResetCmd( FunctionalState NewState)
} }
} }
/**
* @brief Selects the specified I2C NACK position in master receiver mode.
* This function is useful in I2C Master Receiver mode when the number
* of data to be received is equal to 2. In this case, this function
* should be called (with parameter I2C_NACKPosition_Next) before data
* reception starts,as described in the 2-byte reception procedure
* recommended in Reference Manual in Section: Master receiver.
* @param I2C_NACKPosition: specifies the NACK position.
* This parameter can be one of the following values:
* @arg I2C_NACKPosition_Next: indicates that the next byte will be the last
* received byte.
* @arg I2C_NACKPosition_Current: indicates that current byte is the last
* received byte.
* @retval None
*/
void LHL_I2C_NACKPositionConfig(uint16_t I2C_NACKPosition) void LHL_I2C_NACKPositionConfig(uint16_t I2C_NACKPosition)
{ {
/* Check the input parameter */ /* Check the input parameter */
@@ -745,14 +730,6 @@ void LHL_I2C_StretchClockCmd(FunctionalState NewState)
} }
} }
/**
* @brief Selects the specified I2C fast mode duty cycle.
* @param I2C_DutyCycle: specifies the fast mode duty cycle.
* This parameter can be one of the following values:
* @arg I2C_DutyCycle_2: I2C fast mode Tlow/Thigh = 2
* @arg I2C_DutyCycle_16_9: I2C fast mode Tlow/Thigh = 16/9
* @retval None
*/
void LHL_I2C_FastModeDutyCycleConfig(uint16_t I2C_DutyCycle) void LHL_I2C_FastModeDutyCycleConfig(uint16_t I2C_DutyCycle)
{ {
if (I2C_DutyCycle != I2C_DutyCycle_16_9) if (I2C_DutyCycle != I2C_DutyCycle_16_9)
@@ -767,116 +744,6 @@ void LHL_I2C_FastModeDutyCycleConfig(uint16_t I2C_DutyCycle)
} }
} }
/**
* @brief
****************************************************************************************
*
* I2C State Monitoring Functions
*
****************************************************************************************
* This I2C driver provides three different ways for I2C state monitoring
* depending on the application requirements and constraints:
*
* 1) Basic state monitoring:
* Using I2C_CheckEvent() function:
* It compares the status registers (SR1 and SR2) content to a given event
* (can be the combination of one or more flags).
* It returns SUCCESS if the current status includes the given flags
* and returns ERROR if one or more flags are missing in the current status.
* - When to use:
* - This function is suitable for most applications as well as for startup
* activity since the events are fully described in the product reference manual.
* - It is also suitable for users who need to define their own events.
* - Limitations:
* - If an error occurs (ie. error flags are set besides to the monitored flags),
* the I2C_CheckEvent() function may return SUCCESS despite the communication
* hold or corrupted real state.
* In this case, it is advised to use error interrupts to monitor the error
* events and handle them in the interrupt IRQ handler.
*
* @note
* For error management, it is advised to use the following functions:
* - I2C_ITConfig() to configure and enable the error interrupts (I2C_IT_ERR).
* - I2Cx_ER_IRQHandler() which is called when the error interrupt occurs.
* Where x is the peripheral instance (I2C1, I2C2 ...)
* - I2C_GetFlagStatus() or I2C_GetITStatus() to be called into I2Cx_ER_IRQHandler()
* in order to determine which error occured.
* - I2C_ClearFlag() or I2C_ClearITPendingBit() and/or I2C_SoftwareResetCmd()
* and/or I2C_GenerateStop() in order to clear the error flag and source,
* and return to correct communication status.
*
*
* 2) Advanced state monitoring:
* Using the function I2C_GetLastEvent() which returns the image of both status
* registers in a single word (uint32_t) (Status Register 2 value is shifted left
* by 16 bits and concatenated to Status Register 1).
* - When to use:
* - This function is suitable for the same applications above but it allows to
* overcome the mentioned limitation of I2C_GetFlagStatus() function.
* The returned value could be compared to events already defined in the
* library or to custom values defined by user.
* - This function is suitable when multiple flags are monitored at the same time.
* - At the opposite of I2C_CheckEvent() function, this function allows user to
* choose when an event is accepted (when all events flags are set and no
* other flags are set or just when the needed flags are set like
* I2C_CheckEvent() function).
* - Limitations:
* - User may need to define his own events.
* - Same remark concerning the error management is applicable for this
* function if user decides to check only regular communication flags (and
* ignores error flags).
*
* 3) Flag-based state monitoring:
* Using the function I2C_GetFlagStatus() which simply returns the status of
* one single flag (ie. I2C_FLAG_RXNE ...).
* - When to use:
* - This function could be used for specific applications or in debug phase.
* - It is suitable when only one flag checking is needed (most I2C events
* are monitored through multiple flags).
* - Limitations:
* - When calling this function, the Status register is accessed. Some flags are
* cleared when the status register is accessed. So checking the status
* of one Flag, may clear other ones.
* - Function may need to be called twice or more in order to monitor one
* single event.
*
*/
/**
*
* 1) Basic state monitoring
*******************************************************************************
*/
/**
* @brief Checks whether the last I2Cx Event is equal to the one passed
* as parameter.
* @param I2C_EVENT: specifies the event to be checked.
* This parameter can be one of the following values:
* @arg I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED : EV1
* @arg I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED : EV1
* @arg I2C_EVENT_SLAVE_TRANSMITTER_SECONDADDRESS_MATCHED : EV1
* @arg I2C_EVENT_SLAVE_RECEIVER_SECONDADDRESS_MATCHED : EV1
* @arg I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED : EV1
* @arg I2C_EVENT_SLAVE_BYTE_RECEIVED : EV2
* @arg (I2C_EVENT_SLAVE_BYTE_RECEIVED | I2C_FLAG_DUALF) : EV2
* @arg (I2C_EVENT_SLAVE_BYTE_RECEIVED | I2C_FLAG_GENCALL) : EV2
* @arg I2C_EVENT_SLAVE_BYTE_TRANSMITTED : EV3
* @arg (I2C_EVENT_SLAVE_BYTE_TRANSMITTED | I2C_FLAG_DUALF) : EV3
* @arg (I2C_EVENT_SLAVE_BYTE_TRANSMITTED | I2C_FLAG_GENCALL) : EV3
* @arg I2C_EVENT_SLAVE_ACK_FAILURE : EV3_2
* @arg I2C_EVENT_SLAVE_STOP_DETECTED : EV4
* @arg I2C_EVENT_MASTER_MODE_SELECT : EV5
* @arg I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED : EV6
* @arg I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED : EV6
* @arg I2C_EVENT_MASTER_BYTE_RECEIVED : EV7
* @arg I2C_EVENT_MASTER_BYTE_TRANSMITTING : EV8
* @arg I2C_EVENT_MASTER_BYTE_TRANSMITTED : EV8_2
* @arg I2C_EVENT_MASTER_MODE_ADDRESS10 : EV9
* @retval An ErrorStatus enumeration value:
* - LHL_OK: Last event is equal to the I2C_EVENT
* - LHL_ERROR: Last event is different from the I2C_EVENT
*/
LHL_StatusTypeDef LHL_I2C_CheckEvent(uint32_t I2C_EVENT) LHL_StatusTypeDef LHL_I2C_CheckEvent(uint32_t I2C_EVENT)
{ {
uint32_t lastevent = 0; uint32_t lastevent = 0;
@@ -931,40 +798,6 @@ uint32_t LHL_I2C_GetLastEvent(void)
return lastevent; return lastevent;
} }
/**
*
* 3) Flag-based state monitoring
*******************************************************************************
*/
/**
* @brief Checks whether the specified I2C flag is set or not.
* @param I2C_FLAG: specifies the flag to check.
* This parameter can be one of the following values:
* @arg I2C_FLAG_DUALF: Dual flag (Slave mode)
* @arg I2C_FLAG_SMBHOST: SMBus host header (Slave mode)
* @arg I2C_FLAG_SMBDEFAULT: SMBus default header (Slave mode)
* @arg I2C_FLAG_GENCALL: General call header flag (Slave mode)
* @arg I2C_FLAG_TRA: Transmitter/Receiver flag
* @arg I2C_FLAG_BUSY: Bus busy flag
* @arg I2C_FLAG_MSL: Master/Slave flag
* @arg I2C_FLAG_SMBALERT: SMBus Alert flag
* @arg I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
* @arg I2C_FLAG_PECERR: PEC error in reception flag
* @arg I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode)
* @arg I2C_FLAG_AF: Acknowledge failure flag
* @arg I2C_FLAG_ARLO: Arbitration lost flag (Master mode)
* @arg I2C_FLAG_BERR: Bus error flag
* @arg I2C_FLAG_TXE: Data register empty flag (Transmitter)
* @arg I2C_FLAG_RXNE: Data register not empty (Receiver) flag
* @arg I2C_FLAG_STOPF: Stop detection flag (Slave mode)
* @arg I2C_FLAG_ADD10: 10-bit header sent flag (Master mode)
* @arg I2C_FLAG_BTF: Byte transfer finished flag
* @arg I2C_FLAG_ADDR: Address sent flag (Master mode) "ADSL"
* Address matched flag (Slave mode)"ENDA"
* @arg I2C_FLAG_SB: Start bit flag (Master mode)
* @retval The new state of I2C_FLAG (SET or RESET).
*/
FlagStatus LHL_I2C_GetFlag(uint32_t I2C_FLAG) FlagStatus LHL_I2C_GetFlag(uint32_t I2C_FLAG)
{ {
FlagStatus bitstatus = RESET; FlagStatus bitstatus = RESET;
@@ -1007,36 +840,6 @@ FlagStatus LHL_I2C_GetFlag(uint32_t I2C_FLAG)
return bitstatus; return bitstatus;
} }
/**
* @brief Clears the I2Cx's pending flags.
* @param I2C_FLAG: specifies the flag to clear.
* This parameter can be any combination of the following values:
* @arg I2C_FLAG_SMBALERT: SMBus Alert flag
* @arg I2C_FLAG_TIMEOUT: Timeout or Tlow error flag
* @arg I2C_FLAG_PECERR: PEC error in reception flag
* @arg I2C_FLAG_OVR: Overrun/Underrun flag (Slave mode)
* @arg I2C_FLAG_AF: Acknowledge failure flag
* @arg I2C_FLAG_ARLO: Arbitration lost flag (Master mode)
* @arg I2C_FLAG_BERR: Bus error flag
*
* @note
* - STOPF (STOP detection) is cleared by software sequence: a read operation
* to I2C_SR1 register (I2C_GetFlagStatus()) followed by a write operation
* to I2C_CR1 register (I2C_Cmd() to re-enable the I2C peripheral).
* - ADD10 (10-bit header sent) is cleared by software sequence: a read
* operation to I2C_SR1 (I2C_GetFlagStatus()) followed by writing the
* second byte of the address in DR register.
* - BTF (Byte Transfer Finished) is cleared by software sequence: a read
* operation to I2C_SR1 register (I2C_GetFlagStatus()) followed by a
* read/write to I2C_DR register (I2C_SendData()).
* - ADDR (Address sent) is cleared by software sequence: a read operation to
* I2C_SR1 register (I2C_GetFlagStatus()) followed by a read operation to
* I2C_SR2 register ((void)(I2Cx->SR2)).
* - SB (Start Bit) is cleared software sequence: a read operation to I2C_SR1
* register (I2C_GetFlagStatus()) followed by a write operation to I2C_DR
* register (I2C_SendData()).
* @retval None
*/
void LHL_I2C_ClearFlag(uint32_t I2C_FLAG) void LHL_I2C_ClearFlag(uint32_t I2C_FLAG)
{ {
uint32_t flagpos = 0; uint32_t flagpos = 0;
@@ -1047,27 +850,6 @@ void LHL_I2C_ClearFlag(uint32_t I2C_FLAG)
pI2C->SR1 = (uint16_t)~flagpos; pI2C->SR1 = (uint16_t)~flagpos;
} }
/**
* @brief Checks whether the specified I2C interrupt has occurred or not.
* @param I2C_IT: specifies the interrupt source to check.
* This parameter can be one of the following values:
* @arg I2C_IT_SMBALERT: SMBus Alert flag
* @arg I2C_IT_TIMEOUT: Timeout or Tlow error flag
* @arg I2C_IT_PECERR: PEC error in reception flag
* @arg I2C_IT_OVR: Overrun/Underrun flag (Slave mode)
* @arg I2C_IT_AF: Acknowledge failure flag
* @arg I2C_IT_ARLO: Arbitration lost flag (Master mode)
* @arg I2C_IT_BERR: Bus error flag
* @arg I2C_IT_TXE: Data register empty flag (Transmitter)
* @arg I2C_IT_RXNE: Data register not empty (Receiver) flag
* @arg I2C_IT_STOPF: Stop detection flag (Slave mode)
* @arg I2C_IT_ADD10: 10-bit header sent flag (Master mode)
* @arg I2C_IT_BTF: Byte transfer finished flag
* @arg I2C_IT_ADDR: Address sent flag (Master mode) "ADSL"
* Address matched flag (Slave mode)"ENDAD"
* @arg I2C_IT_SB: Start bit flag (Master mode)
* @retval The new state of I2C_IT (SET or RESET).
*/
ITStatus LHL_I2C_GetPending(uint32_t I2C_IT) ITStatus LHL_I2C_GetPending(uint32_t I2C_IT)
{ {
ITStatus bitstatus = RESET; ITStatus bitstatus = RESET;
@@ -1094,36 +876,6 @@ ITStatus LHL_I2C_GetPending(uint32_t I2C_IT)
return bitstatus; return bitstatus;
} }
/**
* @brief Clears the I2C interrupt pending bits.
* @param I2C_IT: specifies the interrupt pending bit to clear.
* This parameter can be any combination of the following values:
* @arg I2C_IT_SMBALERT: SMBus Alert interrupt
* @arg I2C_IT_TIMEOUT: Timeout or Tlow error interrupt
* @arg I2C_IT_PECERR: PEC error in reception interrupt
* @arg I2C_IT_OVR: Overrun/Underrun interrupt (Slave mode)
* @arg I2C_IT_AF: Acknowledge failure interrupt
* @arg I2C_IT_ARLO: Arbitration lost interrupt (Master mode)
* @arg I2C_IT_BERR: Bus error interrupt
*
* @note
* - STOPF (STOP detection) is cleared by software sequence: a read operation
* to I2C_SR1 register (I2C_GetITStatus()) followed by a write operation to
* I2C_CR1 register (I2C_Cmd() to re-enable the I2C peripheral).
* - ADD10 (10-bit header sent) is cleared by software sequence: a read
* operation to I2C_SR1 (I2C_GetITStatus()) followed by writing the second
* byte of the address in I2C_DR register.
* - BTF (Byte Transfer Finished) is cleared by software sequence: a read
* operation to I2C_SR1 register (I2C_GetITStatus()) followed by a
* read/write to I2C_DR register (I2C_SendData()).
* - ADDR (Address sent) is cleared by software sequence: a read operation to
* I2C_SR1 register (I2C_GetITStatus()) followed by a read operation to
* I2C_SR2 register ((void)(I2Cx->SR2)).
* - SB (Start Bit) is cleared by software sequence: a read operation to
* I2C_SR1 register (I2C_GetITStatus()) followed by a write operation to
* I2C_DR register (I2C_SendData()).
* @retval None
*/
void LHL_I2C_ClearPending(uint32_t I2C_IT) void LHL_I2C_ClearPending(uint32_t I2C_IT)
{ {
uint32_t flagpos = 0; uint32_t flagpos = 0;

0
library/src/lh32m0g3x_iwdg.c Executable file → Normal file
View File

5
library/src/lh32m0g3x_lhl.c Executable file → Normal file
View File

@@ -74,6 +74,11 @@ LHL_TickFreqTypeDef LHL_GetTickFreq(void)
return uTickFreq; return uTickFreq;
} }
void SysTick_Handler(void)
{
LHL_IncTick(); // 调用 LHL 库提供的累加函数
}
/** /**
* @brief 暂停Systick中断 * @brief 暂停Systick中断
*/ */

0
library/src/lh32m0g3x_lptim.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_mcal.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_mio.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_power.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_rcc.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_rtc.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_spi.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_timer.c Executable file → Normal file
View File

0
library/src/lh32m0g3x_uart.c Executable file → Normal file
View File

2
library/src/lh32m0g3x_xlink.c Executable file → Normal file
View File

@@ -28,7 +28,7 @@ void LHL_XLINK_Init(XLINK_InitTypeDef* XLink_Init)
tmp = (uint32_t)CROSSLINK_BASE; tmp = (uint32_t)CROSSLINK_BASE;
tmp += (XLink_Init->XLink_0_Output & 0x0F); tmp += (XLink_Init->XLink_0_Output & 0x0F);
pos = ((XLink_Init->XLink_0_Output >> 8) & 0xFF); pos = ((XLink_Init->XLink_0_Output >> 8) & 0x0F);
*(__IO uint32_t *)tmp &= ~(0x1Fu << pos); *(__IO uint32_t *)tmp &= ~(0x1Fu << pos);
*(__IO uint32_t *)tmp |= ((uint32_t)XLink_Init->XLink_0_Input << pos); *(__IO uint32_t *)tmp |= ((uint32_t)XLink_Init->XLink_0_Input << pos);

0
library/src/qfplib-m0-full.a Executable file → Normal file
View File

0
library/src/system_lh32m0g3x.c Executable file → Normal file
View File

0
project/.vscode/c_cpp_properties.json vendored Executable file → Normal file
View File

0
project/.vscode/uv4.log vendored Executable file → Normal file
View File

0
project/EventRecorderStub.scvd Executable file → Normal file
View File

11268
project/JLinkLog.txt Executable file → Normal file

File diff suppressed because it is too large Load Diff

0
project/JLinkSettings.ini Executable file → Normal file
View File

File diff suppressed because one or more lines are too long

1202
project/LH32M0G3.uvguix.hyj Executable file → Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

397
project/LH32M0G3.uvguix.siarg Executable file → Normal file

File diff suppressed because one or more lines are too long

676
project/LH32M0G3.uvoptx Executable file → Normal file

File diff suppressed because it is too large Load Diff

186
project/LH32M0G3.uvprojx Executable file → Normal file
View File

@@ -10,7 +10,6 @@
<TargetName>Target 1</TargetName> <TargetName>Target 1</TargetName>
<ToolsetNumber>0x4</ToolsetNumber> <ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName> <ToolsetName>ARM-ADS</ToolsetName>
<pArmCC>6190000::V6.19::ARMCLANG</pArmCC>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed> <pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6> <uAC6>1</uAC6>
<TargetOption> <TargetOption>
@@ -81,7 +80,7 @@
<nStopB2X>0</nStopB2X> <nStopB2X>0</nStopB2X>
</BeforeMake> </BeforeMake>
<AfterMake> <AfterMake>
<RunUserProg1>1</RunUserProg1> <RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf.exe --bin -o "$L@L.bin" "#L"</UserProg1Name> <UserProg1Name>fromelf.exe --bin -o "$L@L.bin" "#L"</UserProg1Name>
<UserProg2Name></UserProg2Name> <UserProg2Name></UserProg2Name>
@@ -140,7 +139,7 @@
<bUseTDR>1</bUseTDR> <bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2> <Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3>"" ()</Flash3> <Flash3>"" ()</Flash3>
<Flash4></Flash4> <Flash4>.\LH_flash.ini</Flash4>
<pFcarmOut></pFcarmOut> <pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp> <pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot> <pFcArmRoot></pFcArmRoot>
@@ -278,7 +277,7 @@
<OCR_RVCT4> <OCR_RVCT4>
<Type>1</Type> <Type>1</Type>
<StartAddress>0x8000000</StartAddress> <StartAddress>0x8000000</StartAddress>
<Size>0x1c000</Size> <Size>0x20000</Size>
</OCR_RVCT4> </OCR_RVCT4>
<OCR_RVCT5> <OCR_RVCT5>
<Type>1</Type> <Type>1</Type>
@@ -324,7 +323,7 @@
<PlainCh>0</PlainCh> <PlainCh>0</PlainCh>
<Ropi>0</Ropi> <Ropi>0</Ropi>
<Rwpi>0</Rwpi> <Rwpi>0</Rwpi>
<wLevel>1</wLevel> <wLevel>3</wLevel>
<uThumb>0</uThumb> <uThumb>0</uThumb>
<uSurpInc>0</uSurpInc> <uSurpInc>0</uSurpInc>
<uC99>1</uC99> <uC99>1</uC99>
@@ -341,7 +340,7 @@
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>..\library\inc;..\user;..\user\Main;..\user\Protocol;..\user\Utility;..\user\MCU;..\user\Device;..\user\Compute;..\user\Interface;..\library\src;..\user\Core</IncludePath> <IncludePath>..\library\inc;..\user;..\user\Main;..\user\Protocol;..\user\Utility;..\user\MCU;..\user\Device;..\user\Compute;..\user\Interface;..\library\src;D:\Soft_DataBase\xwechat_files\wxid_uzdbjpfqp52922_31ad\msg\file\2025-12\LH32M0G3XX-FS5001-Sleep\LH32M0G3XX-FS5001-Sleep\user\MCU</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
<Aads> <Aads>
@@ -485,60 +484,60 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\library\src\lh32m0g3x_exti.c</FilePath> <FilePath>..\library\src\lh32m0g3x_exti.c</FilePath>
</File> </File>
<File>
<FileName>lh32m0g3x_mcal.c</FileName>
<FileType>1</FileType>
<FilePath>..\library\src\lh32m0g3x_mcal.c</FilePath>
</File>
<File>
<FileName>lh32m0g3x_mio.c</FileName>
<FileType>1</FileType>
<FilePath>..\library\src\lh32m0g3x_mio.c</FilePath>
</File>
<File>
<FileName>lh32m0g3x_xlink.c</FileName>
<FileType>1</FileType>
<FilePath>..\library\src\lh32m0g3x_xlink.c</FilePath>
</File>
<File>
<FileName>lh32m0g3x_spi.c</FileName>
<FileType>1</FileType>
<FilePath>..\library\src\lh32m0g3x_spi.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
<GroupName>LHLMCU</GroupName> <GroupName>LHLMCU</GroupName>
<Files> <Files>
<File> <File>
<FileName>lhl_adc.c</FileName> <FileName>lhl_systemclock.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\MCU\lhl_adc.c</FilePath> <FilePath>..\user\MCU\lhl_systemclock.c</FilePath>
</File> </File>
<File> <File>
<FileName>lhl_adc_dma.c</FileName> <FileName>lhl_gpio.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\MCU\lhl_adc_dma.c</FilePath> <FilePath>..\user\MCU\lhl_gpio.c</FilePath>
</File>
<File>
<FileName>lhl_rtc.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_rtc.c</FilePath>
</File>
<File>
<FileName>lhl_lptimer.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_lptimer.c</FilePath>
</File>
<File>
<FileName>lhl_timer.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_timer.c</FilePath>
</File> </File>
<File> <File>
<FileName>lhl_btim.c</FileName> <FileName>lhl_btim.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\MCU\lhl_btim.c</FilePath> <FilePath>..\user\MCU\lhl_btim.c</FilePath>
</File> </File>
<File>
<FileName>lhl_uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_uart.c</FilePath>
</File>
<File> <File>
<FileName>lhl_dma.c</FileName> <FileName>lhl_dma.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\MCU\lhl_dma.c</FilePath> <FilePath>..\user\MCU\lhl_dma.c</FilePath>
</File> </File>
<File> <File>
<FileName>lhl_exti.c</FileName> <FileName>lhl_adc.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\MCU\lhl_exti.c</FilePath> <FilePath>..\user\MCU\lhl_adc.c</FilePath>
</File> </File>
<File> <File>
<FileName>lhl_gpio.c</FileName> <FileName>lhl_watchdog.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\MCU\lhl_gpio.c</FilePath> <FilePath>..\user\MCU\lhl_watchdog.c</FilePath>
</File> </File>
<File> <File>
<FileName>lhl_i2c_slave.c</FileName> <FileName>lhl_i2c_slave.c</FileName>
@@ -551,55 +550,20 @@
<FilePath>..\user\MCU\lhl_i2c_soft.c</FilePath> <FilePath>..\user\MCU\lhl_i2c_soft.c</FilePath>
</File> </File>
<File> <File>
<FileName>lhl_lowpower.c</FileName> <FileName>lhl_exti.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\MCU\lhl_lowpower.c</FilePath> <FilePath>..\user\MCU\lhl_exti.c</FilePath>
</File>
<File>
<FileName>lhl_lptimer.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_lptimer.c</FilePath>
</File>
<File>
<FileName>lhl_rtc.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_rtc.c</FilePath>
</File>
<File>
<FileName>lhl_systemclock.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_systemclock.c</FilePath>
</File>
<File>
<FileName>lhl_timer.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_timer.c</FilePath>
</File>
<File>
<FileName>lhl_uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_uart.c</FilePath>
</File>
<File>
<FileName>lhl_watchdog.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_watchdog.c</FilePath>
</File>
<File>
<FileName>lhl_systick.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_systick.c</FilePath>
</File>
<File>
<FileName>lhl_xlink.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_xlink.c</FilePath>
</File> </File>
<File> <File>
<FileName>lhl_flash.c</FileName> <FileName>lhl_flash.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\MCU\lhl_flash.c</FilePath> <FilePath>..\user\MCU\lhl_flash.c</FilePath>
</File> </File>
<File>
<FileName>lhl_lowpower.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\MCU\lhl_lowpower.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@@ -660,11 +624,6 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\Protocol\SampProcess.c</FilePath> <FilePath>..\user\Protocol\SampProcess.c</FilePath>
</File> </File>
<File>
<FileName>AvantGardeProtocol.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Protocol\AvantGardeProtocol.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
@@ -700,11 +659,6 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\Device\CAT24C512.c</FilePath> <FilePath>..\user\Device\CAT24C512.c</FilePath>
</File> </File>
<File>
<FileName>StorageDefine.h</FileName>
<FileType>5</FileType>
<FilePath>..\user\Main\StorageDefine.h</FilePath>
</File>
<File> <File>
<FileName>MCP9808.c</FileName> <FileName>MCP9808.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
@@ -730,11 +684,6 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\Device\HAFBLF0750C4AX5.c</FilePath> <FilePath>..\user\Device\HAFBLF0750C4AX5.c</FilePath>
</File> </File>
<File>
<FileName>BLE.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Device\BLE.c</FilePath>
</File>
<File> <File>
<FileName>key_power.c</FileName> <FileName>key_power.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
@@ -745,30 +694,40 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\Device\oled.c</FilePath> <FilePath>..\user\Device\oled.c</FilePath>
</File> </File>
<File>
<FileName>BLE.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Device\BLE.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
<GroupName>Core</GroupName> <GroupName>Core</GroupName>
<Files> <Files>
<File> <File>
<FileName>DP2006_VM1000.c</FileName> <FileName>FS5001_H2.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\Core\DP2006_VM1000.c</FilePath> <FilePath>..\user\Core\FS5001_H2.c</FilePath>
</File> </File>
<File> <File>
<FileName>DP2006_VM1000.h</FileName> <FileName>DP2201V01.c</FileName>
<FileType>5</FileType> <FileType>1</FileType>
<FilePath>..\user\Core\DP2006_VM1000.h</FilePath> <FilePath>..\user\Core\DP2201V01.c</FilePath>
</File> </File>
<File> <File>
<FileName>DP2006_VM1000_Parameter.h</FileName> <FileName>D9V2VHH_DP1703V10.c</FileName>
<FileType>5</FileType> <FileType>1</FileType>
<FilePath>..\user\Core\DP2006_VM1000_Parameter.h</FilePath> <FilePath>..\user\Core\D9V2VHH_DP1703V10.c</FilePath>
</File> </File>
<File> <File>
<FileName>DP2006_VM1000_Header.h</FileName> <FileName>Macro_Flange.h</FileName>
<FileType>5</FileType> <FileType>5</FileType>
<FilePath>..\user\Core\DP2006_VM1000_Header.h</FilePath> <FilePath>..\user\Main\Macro_Flange.h</FilePath>
</File>
<File>
<FileName>D9V2FR_DP2006V1000 .c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Core\D9V2FR_DP2006V1000 .c</FilePath>
</File> </File>
</Files> </Files>
</Group> </Group>
@@ -800,26 +759,41 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\Compute\TemperatureCorrect.c</FilePath> <FilePath>..\user\Compute\TemperatureCorrect.c</FilePath>
</File> </File>
<File>
<FileName>SavingData.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Compute\SavingData.c</FilePath>
</File>
<File> <File>
<FileName>UnitConverter.c</FileName> <FileName>UnitConverter.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\Compute\UnitConverter.c</FilePath> <FilePath>..\user\Compute\UnitConverter.c</FilePath>
</File> </File>
<File>
<FileName>SavingData.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Compute\SavingData.c</FilePath>
</File>
<File> <File>
<FileName>StaticTemperature.c</FileName> <FileName>StaticTemperature.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\user\Compute\StaticTemperature.c</FilePath> <FilePath>..\user\Compute\StaticTemperature.c</FilePath>
</File> </File>
<File>
<FileName>CheckSystemVoltage.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Compute\CheckSystemVoltage.c</FilePath>
</File>
<File>
<FileName>AdjustOffset.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Compute\AdjustOffset.c</FilePath>
</File>
</Files> </Files>
</Group> </Group>
<Group> <Group>
<GroupName>Interface</GroupName> <GroupName>Interface</GroupName>
<Files> <Files>
<File>
<FileName>Pulse.c</FileName>
<FileType>1</FileType>
<FilePath>..\user\Interface\Pulse.c</FilePath>
</File>
<File> <File>
<FileName>Display.c</FileName> <FileName>Display.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>

0
project/Listings/startup_lh32m0g3x.lst Executable file → Normal file
View File

BIN
project/OBJ/DP2317_MF6600_LH32M0S3_APP.axf Executable file → Normal file

Binary file not shown.

9
project/OBJ/DP2317_MF6600_LH32M0S3_APP.build_log.htm Executable file → Normal file
View File

@@ -21,17 +21,12 @@ Target DLL: Segger\JL2CM3.dll V2.99.42.0
Dialog DLL: TARMCM1.DLL V1.14.6.0 Dialog DLL: TARMCM1.DLL V1.14.6.0
<h2>Project:</h2> <h2>Project:</h2>
C:\Users\hyj\Desktop\vm1000zuizhong\chenxuzuixing\LH32M0G314 Core V0307-1.8\project\LH32M0G3.uvprojx C:\Users\hyj\Desktop\vm1000zuizhong\chenxuzuixing\LH32M0G3XX(V3_6) - 1.7- ble\LH32M0G3XX(replace_V3_6)\project\LH32M0G3.uvprojx
Project File Date: 03/20/2026 Project File Date: 03/03/2026
<h2>Output:</h2> <h2>Output:</h2>
*** Using Compiler 'V6.19', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin' *** Using Compiler 'V6.19', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'
Build target 'Target 1' Build target 'Target 1'
compiling DP2006_VM1000.c...
linking...
Program Size: Code=29034 RO-data=8146 RW-data=24 ZI-data=7632
FromELF: creating hex file...
After Build - User command #1: fromelf.exe --bin -o "C:\Users\hyj\Desktop\vm1000zuizhong\chenxuzuixing\LH32M0G314 Core V0307-1.8\project\OBJ\DP2317_MF6600_LH32M0S3_APP.bin" "C:\Users\hyj\Desktop\vm1000zuizhong\chenxuzuixing\LH32M0G314 Core V0307-1.8\project\OBJ\DP2317_MF6600_LH32M0S3_APP.axf"
".\OBJ\DP2317_MF6600_LH32M0S3_APP.axf" - 0 Error(s), 0 Warning(s). ".\OBJ\DP2317_MF6600_LH32M0S3_APP.axf" - 0 Error(s), 0 Warning(s).
<h2>Software Packages used:</h2> <h2>Software Packages used:</h2>

4748
project/OBJ/DP2317_MF6600_LH32M0S3_APP.hex Executable file → Normal file

File diff suppressed because it is too large Load Diff

2508
project/OBJ/DP2317_MF6600_LH32M0S3_APP.htm Executable file → Normal file

File diff suppressed because it is too large Load Diff

42
project/OBJ/DP2317_MF6600_LH32M0S3_APP.lnp Executable file → Normal file
View File

@@ -18,28 +18,21 @@
".\obj\lh32m0g3x_flash.o" ".\obj\lh32m0g3x_flash.o"
".\obj\lh32m0g3x_rtc.o" ".\obj\lh32m0g3x_rtc.o"
".\obj\lh32m0g3x_exti.o" ".\obj\lh32m0g3x_exti.o"
".\obj\lh32m0g3x_mcal.o" ".\obj\lhl_systemclock.o"
".\obj\lh32m0g3x_mio.o"
".\obj\lh32m0g3x_xlink.o"
".\obj\lh32m0g3x_spi.o"
".\obj\lhl_adc.o"
".\obj\lhl_adc_dma.o"
".\obj\lhl_btim.o"
".\obj\lhl_dma.o"
".\obj\lhl_exti.o"
".\obj\lhl_gpio.o" ".\obj\lhl_gpio.o"
".\obj\lhl_rtc.o"
".\obj\lhl_lptimer.o"
".\obj\lhl_timer.o"
".\obj\lhl_btim.o"
".\obj\lhl_uart.o"
".\obj\lhl_dma.o"
".\obj\lhl_adc.o"
".\obj\lhl_watchdog.o"
".\obj\lhl_i2c_slave.o" ".\obj\lhl_i2c_slave.o"
".\obj\lhl_i2c_soft.o" ".\obj\lhl_i2c_soft.o"
".\obj\lhl_lowpower.o" ".\obj\lhl_exti.o"
".\obj\lhl_lptimer.o"
".\obj\lhl_rtc.o"
".\obj\lhl_systemclock.o"
".\obj\lhl_timer.o"
".\obj\lhl_uart.o"
".\obj\lhl_watchdog.o"
".\obj\lhl_systick.o"
".\obj\lhl_xlink.o"
".\obj\lhl_flash.o" ".\obj\lhl_flash.o"
".\obj\lhl_lowpower.o"
".\obj\main.o" ".\obj\main.o"
".\obj\maincore.o" ".\obj\maincore.o"
".\obj\modbus.o" ".\obj\modbus.o"
@@ -49,7 +42,6 @@
".\obj\usermodbus.o" ".\obj\usermodbus.o"
".\obj\readwritedatabycom.o" ".\obj\readwritedatabycom.o"
".\obj\sampprocess.o" ".\obj\sampprocess.o"
".\obj\avantgardeprotocol.o"
".\obj\crc.o" ".\obj\crc.o"
".\obj\user_math.o" ".\obj\user_math.o"
".\obj\filter.o" ".\obj\filter.o"
@@ -60,18 +52,24 @@
".\obj\cat5171.o" ".\obj\cat5171.o"
".\obj\mb85rs16.o" ".\obj\mb85rs16.o"
".\obj\hafblf0750c4ax5.o" ".\obj\hafblf0750c4ax5.o"
".\obj\ble.o"
".\obj\key_power.o" ".\obj\key_power.o"
".\obj\oled.o" ".\obj\oled.o"
".\obj\dp2006_vm1000.o" ".\obj\ble.o"
".\obj\fs5001_h2.o"
".\obj\dp2201v01.o"
".\obj\d9v2vhh_dp1703v10.o"
".\obj\d9v2fr_dp2006v1000 .o"
".\obj\flowratecompute.o" ".\obj\flowratecompute.o"
".\obj\acccompute.o" ".\obj\acccompute.o"
".\obj\correct.o" ".\obj\correct.o"
".\obj\gasanalysis.o" ".\obj\gasanalysis.o"
".\obj\temperaturecorrect.o" ".\obj\temperaturecorrect.o"
".\obj\savingdata.o"
".\obj\unitconverter.o" ".\obj\unitconverter.o"
".\obj\savingdata.o"
".\obj\statictemperature.o" ".\obj\statictemperature.o"
".\obj\checksystemvoltage.o"
".\obj\adjustoffset.o"
".\obj\pulse.o"
".\obj\display.o" ".\obj\display.o"
--library_type=microlib --strict --scatter ".\OBJ\DP2317_MF6600_LH32M0S3_APP.sct" --library_type=microlib --strict --scatter ".\OBJ\DP2317_MF6600_LH32M0S3_APP.sct"
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols --summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols

4
project/OBJ/DP2317_MF6600_LH32M0S3_APP.sct Executable file → Normal file
View File

@@ -2,8 +2,8 @@
; *** Scatter-Loading Description File generated by uVision *** ; *** Scatter-Loading Description File generated by uVision ***
; ************************************************************* ; *************************************************************
LR_IROM1 0x08000000 0x0001C000 { ; load region size_region LR_IROM1 0x08000000 0x00020000 { ; load region size_region
ER_IROM1 0x08000000 0x0001C000 { ; load address = execution address ER_IROM1 0x08000000 0x00020000 { ; load address = execution address
*.o (RESET, +First) *.o (RESET, +First)
*(InRoot$$Sections) *(InRoot$$Sections)
.ANY (+RO) .ANY (+RO)

0
project/OBJ/ExtDll.iex Executable file → Normal file
View File

7012
project/OBJ/LH32M0G3_Target 1.dep Executable file → Normal file

File diff suppressed because it is too large Load Diff

0
startup/IAR/startup_lh32m0S3x.s Executable file → Normal file
View File

0
startup/KEIL/startup_lh32m0g3x.s Executable file → Normal file
View File

0
user/Compute/ATypeFlowRate.c Executable file → Normal file
View File

0
user/Compute/ATypeFlowRate.h Executable file → Normal file
View File

64
user/Compute/AccCompute.c Executable file → Normal file
View File

@@ -7,9 +7,6 @@ u16 totalPulse;
u8 MemoryPointer; u8 MemoryPointer;
u16 flowAccCumulationRemaining, samplingIntervalForTotal; u16 flowAccCumulationRemaining, samplingIntervalForTotal;
//#define REC_PULSE_REMAINING
//#define PULSE_COUNTER
/******************************************************************************/ /******************************************************************************/
void ReleaseTotalToDisArray(void) void ReleaseTotalToDisArray(void)
{ {
@@ -158,36 +155,36 @@ u16 FRAMWriteTotal(void)
// write to first bank and second bank and update EPROMPointer // write to first bank and second bank and update EPROMPointer
// input: voltAcc, voltAcc0, EPROMPointer // input: voltAcc, voltAcc0, EPROMPointer
// output: EPROMPointer // output: EPROMPointer
u16 blockAddr, I; unsigned int blockAddr, I;
u8 temp[7], WriteCounter=0; u8 temp[7], WriteCounter=0;
FRAMWriteRepeat: FRAMWriteRepeat:
MemoryPointer++; MemoryPointer++;
WriteCounter++; WriteCounter++;
if (MemoryPointer > REC_ACC_DEPTH) MemoryPointer = 0; if (MemoryPointer > REC_DEPTH) MemoryPointer = 0;
if (WriteCounter > REC_ACC_DEPTH) return 1; if (WriteCounter > REC_DEPTH) return 1;
blockAddr = REC_ACC_BASE + MemoryPointer * REC_ACC_WIDTH; blockAddr = REC_BASE + MemoryPointer * REC_WIDTH;
WriteMultiByteToFRAM(blockAddr,Total,7); WriteMultiByteToFRAM(blockAddr,Total,7);
ReadMultiByteFromFRAM(blockAddr,temp,7); ReadMultiByteFromFRAM(blockAddr,temp,7);
for(I=0; I < (u16)ACC_BLOCK_WIDTH; I++) for(I=0; I < (u16)BLOCK_WIDTH; I++)
{ {
if(temp[I] != Total[I]) goto FRAMWriteRepeat; if(temp[I] != Total[I]) goto FRAMWriteRepeat;
} }
blockAddr += ACC_BLOCK2_START; blockAddr += BLOCK2_START;
WriteMultiByteToFRAM(blockAddr,Total,7); WriteMultiByteToFRAM(blockAddr,Total,7);
ReadMultiByteFromFRAM(blockAddr,temp,7); ReadMultiByteFromFRAM(blockAddr,temp,7);
for(I=0; I<ACC_BLOCK_WIDTH; I++) for(I=0; I<BLOCK_WIDTH; I++)
{ {
if(temp[I] != Total[I]) goto FRAMWriteRepeat; if(temp[I] != Total[I]) goto FRAMWriteRepeat;
} }
// blockAddr = REC_PULSE_REMAINING + MemoryPointer * PULSE_REMAINING_WIDTH; blockAddr = REC_PULSE_REMAINING + MemoryPointer * PULSE_REMAINING_WIDTH;
// tempDev.DWord[0] = lastRemaining; tempDev.DWord[0] = lastRemaining;
// tempDev.Byte[PULSE_REMAINING_CRC] = CRC8(tempDev.Byte, PULSE_REMAINING_CRC); tempDev.Byte[PULSE_REMAINING_CRC] = CRC8(tempDev.Byte, PULSE_REMAINING_CRC);
// WriteMultiByteToFRAM(blockAddr,tempDev.Byte,PULSE_REMAINING_WIDTH); WriteMultiByteToFRAM(blockAddr,tempDev.Byte,PULSE_REMAINING_WIDTH);
//tempDev.DWord[0] = pulseCounter; //tempDev.DWord[0] = pulseCounter;
//tempDev.Byte[PULSE_COUNTER_CRC] = CRC8(tempDev.Byte, PULSE_COUNTER_CRC); //tempDev.Byte[PULSE_COUNTER_CRC] = CRC8(tempDev.Byte, PULSE_COUNTER_CRC);
@@ -203,9 +200,9 @@ u16 FRAMCheckSaveTotalFlow(u8 Pointer)
u8 block1[7], block2[7]; u8 block1[7], block2[7];
u16 blockAddr, I; u16 blockAddr, I;
blockAddr = REC_ACC_BASE + Pointer * REC_ACC_WIDTH; blockAddr = REC_BASE + Pointer * REC_WIDTH;
ReadMultiByteFromFRAM(blockAddr, block1, 7); ReadMultiByteFromFRAM(blockAddr, block1, 7);
blockAddr += ACC_BLOCK2_START; blockAddr += BLOCK2_START;
ReadMultiByteFromFRAM(blockAddr, block2, 7); ReadMultiByteFromFRAM(blockAddr, block2, 7);
if(block1[CRC_CHK] != CRC8(block1, 6)) return false; if(block1[CRC_CHK] != CRC8(block1, 6)) return false;
@@ -229,14 +226,15 @@ u16 RetrieveLastAccumulationFromFRAM(void)
{ {
u32 voltPartA, tempPartA; u32 voltPartA, tempPartA;
u16 voltPartB, tempPartB; u16 voltPartB, tempPartB;
u8 I, max_g; unsigned char I, max_g;
u8 good_ind[REC_ACC_DEPTH+1]; unsigned char good_ind[REC_DEPTH+1];
// if(ReadFRAMDeviceID()) return 0; if(ReadFRAMDeviceID()) return 0;
//find EPROMPointer with good data //find EPROMPointer with good data
max_g = 0; max_g = 0;
for(I = 0; I <= REC_ACC_DEPTH; I++) { for(I = 0; I <= REC_DEPTH; I++)
{
if(FRAMCheckSaveTotalFlow(I)) { good_ind[max_g] = I; max_g++; } if(FRAMCheckSaveTotalFlow(I)) { good_ind[max_g] = I; max_g++; }
} }
if(max_g == 0) return 0; if(max_g == 0) return 0;
@@ -245,8 +243,11 @@ u16 RetrieveLastAccumulationFromFRAM(void)
voltPartA = 0; voltPartA = 0;
voltPartB = 0; voltPartB = 0;
MemoryPointer = 0; MemoryPointer = 0;
for(I = 0; I < max_g; I++) { for(I = 0; I < max_g; I++)
ReadMultiByteFromFRAM(REC_ACC_BASE + (u16)good_ind[I]* REC_ACC_WIDTH, Total, 7); {
ReadMultiByteFromFRAM(REC_BASE + (u16)good_ind[I]* REC_WIDTH, Total, 7);
//tempPartA = make32(Total[0],Total[1],Total[2],Total[3]);
//tempPartB = make16(Total[4],Total[5]);
tempL.Byte[3] = Total[0]; tempL.Byte[3] = Total[0];
tempL.Byte[2] = Total[1]; tempL.Byte[2] = Total[1];
tempL.Byte[1] = Total[2]; tempL.Byte[1] = Total[2];
@@ -268,12 +269,12 @@ u16 RetrieveLastAccumulationFromFRAM(void)
MemoryPointer = good_ind[I]; MemoryPointer = good_ind[I];
} }
ReadMultiByteFromFRAM(REC_ACC_BASE + (u16)MemoryPointer* REC_ACC_WIDTH, Total, 7); ReadMultiByteFromFRAM(REC_BASE + (u16)MemoryPointer* REC_WIDTH, Total, 7);
ReleaseTotalToDisArray(); ReleaseTotalToDisArray();
// ReadMultiByteFromFRAM(REC_PULSE_REMAINING+ MemoryPointer * PULSE_REMAINING_WIDTH, tempDev.Byte, PULSE_REMAINING_WIDTH); ReadMultiByteFromFRAM(REC_PULSE_REMAINING+ MemoryPointer * PULSE_REMAINING_WIDTH, tempDev.Byte, PULSE_REMAINING_WIDTH);
// if(tempDev.Byte[PULSE_REMAINING_CRC] != CRC8(tempDev.Byte, PULSE_REMAINING_CRC)) lastRemaining = 0; if(tempDev.Byte[PULSE_REMAINING_CRC] != CRC8(tempDev.Byte, PULSE_REMAINING_CRC)) lastRemaining = 0;
// else lastRemaining = tempDev.DWord[0]; else lastRemaining = tempDev.DWord[0];
//ReadMultiByteFromFRAM(PULSE_COUNTER, tempDev.Byte, PULSE_COUNTER_WIDTH); //ReadMultiByteFromFRAM(PULSE_COUNTER, tempDev.Byte, PULSE_COUNTER_WIDTH);
//if(tempDev.Byte[PULSE_COUNTER_CRC] != CRC8(tempDev.Byte, PULSE_COUNTER_CRC)) pulseCounter = 0; //if(tempDev.Byte[PULSE_COUNTER_CRC] != CRC8(tempDev.Byte, PULSE_COUNTER_CRC)) pulseCounter = 0;
@@ -462,12 +463,11 @@ void ComputeFlowRateToTotal(void)
#ifndef ENABLE_ACCPULSE #ifndef ENABLE_ACCPULSE
#pragma message("[undefined] ENABLE_ACCPULSE") #pragma message("[undefined] ENABLE_ACCPULSE")
#elif(ENABLE_ACCPULSE) #elif(ENABLE_ACCPULSE)
// lastRemaining += (u32)tempInt; lastRemaining += (u32)tempInt;
// totalPulse = (u16)(lastRemaining / unitPerPulse); totalPulse = (u16)(lastRemaining / unitPerPulse);
// lastRemaining -= (u32)totalPulse * (u32)unitPerPulse; lastRemaining -= (u32)totalPulse * (u32)unitPerPulse;
// if(totalPulse > MaxPulseOutput[samplingIntervalForTotal]) totalPulse = MaxPulseOutput[samplingIntervalForTotal]; if(totalPulse > MaxPulseOutput[samplingIntervalForTotal]) totalPulse = MaxPulseOutput[samplingIntervalForTotal];
#endif #endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef REC_ACC_PER #ifndef REC_ACC_PER
#pragma message("[undefined] REC_ACC_PER") #pragma message("[undefined] REC_ACC_PER")
@@ -501,7 +501,7 @@ void SetupACCArray(void)
#ifndef REC_ACC_PER #ifndef REC_ACC_PER
#pragma message("[undefined] REC_ACC_PER") #pragma message("[undefined] REC_ACC_PER")
#elif(REC_ACC_PER) #elif(REC_ACC_PER)
for(I=0; I <= REC_ACC_DEPTH; I++) FRAMWriteTotal(); for(I=0; I <= REC_DEPTH; I++) FRAMWriteTotal();
#endif #endif
} }

22
user/Compute/AccCompute.h Executable file → Normal file
View File

@@ -54,19 +54,19 @@
// ACC Data save // ACC Data save
// For FRAM(< 0x0800) // For FRAM(< 0x0800)
// For EEPROM(< 0x0200) // For EEPROM(< 0x0200)
//#define REC_BASE 0x0100 // the start EEPROM address of acc data #define REC_BASE 0x0100 // the start EEPROM address of acc data
//#define REC_WIDTH 14 #define REC_WIDTH 14
//#define BLOCK_WIDTH 7 // 0x100(256) + 14*4 = 0x138(312) #define BLOCK_WIDTH 7 // 0x100(256) + 14*4 = 0x138(312)
//#define BLOCK2_START 0x140 // 0x180(256) + 14*4 = 0x1B8 #define BLOCK2_START 0x140 // 0x180(256) + 14*4 = 0x1B8
//#define REC_DEPTH 4 #define REC_DEPTH 4
//#define REC_PULSE_REMAINING 0x01D0 // 0x1D0(256) + 20 = 0x1E4 #define REC_PULSE_REMAINING 0x01D0 // 0x1D0(256) + 20 = 0x1E4
//#define PULSE_REMAINING_WIDTH 5 #define PULSE_REMAINING_WIDTH 5
//#define PULSE_REMAINING_CRC (PULSE_REMAINING_WIDTH-1) #define PULSE_REMAINING_CRC (PULSE_REMAINING_WIDTH-1)
//#define PULSE_COUNTER 0x01F0 // 0x1D0(256) + 20 = 0x1E4 #define PULSE_COUNTER 0x01F0 // 0x1D0(256) + 20 = 0x1E4
//#define PULSE_COUNTER_WIDTH 5 #define PULSE_COUNTER_WIDTH 5
//#define PULSE_COUNTER_CRC (PULSE_COUNTER_WIDTH-1) #define PULSE_COUNTER_CRC (PULSE_COUNTER_WIDTH-1)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
//#define REC_BASE_WIDTH () //#define REC_BASE_WIDTH ()

0
user/Compute/AdjustOffset.c Executable file → Normal file
View File

0
user/Compute/AdjustOffset.h Executable file → Normal file
View File

0
user/Compute/CheckSystemVoltage.c Executable file → Normal file
View File

0
user/Compute/CheckSystemVoltage.h Executable file → Normal file
View File

15
user/Compute/Correct.c Executable file → Normal file
View File

@@ -3,7 +3,7 @@
u32 dcoefNode[DCOEF_MAX]; u32 dcoefNode[DCOEF_MAX];
u16 dcoef, dcoefVal[DCOEF_MAX]; u16 dcoef, dcoefVal[DCOEF_MAX];
float GCFParaA, GCFParaB, GCFParaC; float GCFParaA, GCFParaB, GCFParaC;
u16 GCFCoefB; u16 MeterFactor,GCFCoefB;
s32 GCFCoefA, GCFCoefC; s32 GCFCoefA, GCFCoefC;
float GCFParaA, GCFParaB, GCFParaC; float GCFParaA, GCFParaB, GCFParaC;
//u16 dcoefNum; //u16 dcoefNum;
@@ -17,14 +17,14 @@ void StoreDevCoefNodeAndValue(unsigned char I)
tempDev.Word[1] = tempL.Word[0]; tempDev.Word[1] = tempL.Word[0];
tempDev.Word[0] = dcoefVal[I]; tempDev.Word[0] = dcoefVal[I];
WriteMultiByteToMemory(DCOEF_BASE+I*DCOEF_WIDTH, tempDev.Byte, DCOEF_WIDTH); WriteParameterToEEPROM(DCOEF_BASE+I*DCOEF_WIDTH, DCOEF_WIDTH);
} }
//****************************************************************************** //******************************************************************************
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽ڵ<DFBD><DAB5><EFBFBD><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߽ڵ<DFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
bool ReadDevCoefNodeAndValue(unsigned char I) bool ReadDevCoefNodeAndValue(unsigned char I)
{ {
ReadMultiByteFromMemory(DCOEF_BASE + I * DCOEF_WIDTH, tempDev.Byte, DCOEF_WIDTH); ReadMultiByteFromEEPROM(DCOEF_BASE + I * DCOEF_WIDTH, tempDev.Byte, DCOEF_WIDTH, PARA_EEPROM);
if(tempDev.Byte[DCOEF_CRC] == CRC8(tempDev.Byte, DCOEF_CRC)) if(tempDev.Byte[DCOEF_CRC] == CRC8(tempDev.Byte, DCOEF_CRC))
{ {
tempDev.Byte[DCOEF_CRC] = 0; tempDev.Byte[DCOEF_CRC] = 0;
@@ -64,8 +64,7 @@ void DefaultDevCoef(void)
dcoefNum = 5; dcoefNum = 5;
tempL.Byte[0] = dcoefNum; tempL.Byte[0] = dcoefNum;
// WriteShortParameterToEEPROM(DCOEF_NUM, DCOEF_NUM_WIDTH); WriteShortParameterToEEPROM(DCOEF_NUM, DCOEF_NUM_WIDTH);
WriteShortParameterToEEPROM(DCOEF_NUM);
for (I = 0; I < dcoefNum; I++) for (I = 0; I < dcoefNum; I++)
{ {
@@ -80,11 +79,11 @@ void DefaultDevCoef(void)
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD><DFB2><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD><DFB2><EFBFBD>
void RetriveDevCoef(void) void RetriveDevCoef(void)
{ {
u32 I; unsigned char I;
// u32 flowRateMax; // u32 flowRateMax;
ReadShortParameterFromMemory(DCOEF_NUM, PARA_EEPROM); ReadMultiByteFromEEPROM(DCOEF_NUM, tempL.Byte, DCOEF_NUM_WIDTH, PARA_EEPROM);
// if(tempL.Byte[1] != CRC8(tempL.Byte, 1)) goto RetResetDevCoef; if(tempL.Byte[1] != CRC8(tempL.Byte, 1)) goto RetResetDevCoef;
dcoefNum = tempL.Byte[0]; dcoefNum = tempL.Byte[0];
if((dcoefNum > DCOEF_MAX)||(dcoefNum < 3)) goto RetResetDevCoef; if((dcoefNum > DCOEF_MAX)||(dcoefNum < 3)) goto RetResetDevCoef;

2
user/Compute/Correct.h Executable file → Normal file
View File

@@ -12,7 +12,7 @@
//****************************************************************************** //******************************************************************************
extern u32 dcoefNode[]; extern u32 dcoefNode[];
extern u16 dcoef, dcoefVal[]; extern u16 dcoef, dcoefVal[];
extern u16 GCFCoefB; extern u16 MeterFactor, GCFCoefB;
extern s32 GCFCoefA, GCFCoefC; extern s32 GCFCoefA, GCFCoefC;
//extern u16 dcoefNum ; //extern u16 dcoefNum ;

109
user/Compute/FlowRateCompute.c Executable file → Normal file
View File

@@ -15,19 +15,29 @@ u32 maxAlarmFlowRate;
u16 leakDetectLowCounter, leakDetectHighCounter, leakDetectCounter; u16 leakDetectLowCounter, leakDetectHighCounter, leakDetectCounter;
#endif #endif
/******************************************************************************/ /******************************************************************************/
u32 GetFlowRate(u16 flowIndex, u16 curveType) u32 GetFlowRate(u16 flowIndex, u16 curveType)
{ {
u16 indexL, dataCompFac; u16 indexL, dataCompFac;
u8 temp[12]; u8 temp[12];
switch(curveType) switch(curveType)
{ {
case CURVE_1ST: case CURVE_1ST:
// if(flowIndex > 32767) return 0;
// else if(flowIndex < zeroSuppression) return 0;
// else if(flowIndex >= CALIB_MAX_INDEX) flowIndex = CALIB_MAX_INDEX;
// dataCompFac = DATA_COMP_FAC;
// indexL = CALI_DATA_ADDR;
if(flowIndex > 32767) return 0; if(flowIndex > 32767) return 0;
else if(flowIndex < zeroSuppression) return 0; // else if(flowIndex < zeroSuppression) return 0;
else if(flowIndex >= CALIB_MAX_INDEX) flowIndex = CALIB_MAX_INDEX; else if(flowIndex >= CALIB_MAX_INDEX) flowIndex = CALIB_MAX_INDEX; //MAX_INDEX
dataCompFac = CALIB_COMP_FAC; dataCompFac = CALIB_COMP_FAC;
indexL = CALI_DATA_ADDR; //indexL = (CORRECT_DATA_ADDR&0xFFFF);
indexL = 0 ;//<2F><>CORRECT_DATA[0]<5D><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ڴ<EFBFBD>0<EFBFBD><30>ַ<EFBFBD><D6B7>ʼȡ
break; break;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@@ -35,8 +45,7 @@ u32 GetFlowRate(u16 flowIndex, u16 curveType)
#pragma message("[undefined] ENABLE_2ND_CURVE") #pragma message("[undefined] ENABLE_2ND_CURVE")
#elif(ENABLE_2ND_CURVE) #elif(ENABLE_2ND_CURVE)
case CURVE_2ND: case CURVE_2ND:
dataCompFac = CALIB_COMP_FAC2;
indexL = CALI_DATA2_ADDR;
break; break;
#endif #endif
@@ -47,19 +56,20 @@ u32 GetFlowRate(u16 flowIndex, u16 curveType)
case CURVE_3RD: case CURVE_3RD:
if(flowIndex > 32767) return 0; if(flowIndex > 32767) return 0;
else if(flowIndex < zeroSuppression) return 0; else if(flowIndex < zeroSuppression) return 0;
else if(flowIndex >= CALIB_MAX_INDEX3) flowIndex = CALIB_MAX_INDEX; else if(flowIndex >= MAX_INDEX3) flowIndex = CALIB_MAX_INDEX;
dataCompFac = CALIB_COMP_FAC3; dataCompFac = DATA_COMP_FAC3;
indexL = CALI_DATA3_ADDR; indexL = CALI_DATA3_ADDR;
break; break;
#endif #endif
default: return 0; default: return 0;
} }
//240000-3*4 2*4096*6=48828-6*4 if(flowIndex > (CALIB_MAX_INDEX - dataCompFac*4))//240000-3*4 2*4096*6=48828-6*4
if(flowIndex > (CALIB_MAX_INDEX - dataCompFac*4)) { {
indexL += (CALIB_MAX_INDEX / dataCompFac - 1)*3; indexL += (CALIB_MAX_INDEX / dataCompFac - 1)*3;
ReadCalbrationDataFromMemory(indexL, &tempDev.Byte[0], 3); //ReadMultiByteFromEEPROM(indexL, &tempDev.Byte[0], 3, PARA_EEPROM);
ReadDataFromFlash(indexL, &tempDev.Byte[0], 3);
tempDev.Byte[3] = 0; tempDev.Byte[3] = 0;
return tempDev.DWord[0]; return tempDev.DWord[0];
@@ -72,29 +82,34 @@ u32 GetFlowRate(u16 flowIndex, u16 curveType)
index0 = flowIndex / dataCompFac; index0 = flowIndex / dataCompFac;
indexL += index0*3; indexL += index0*3;
ReadCalbrationDataFromMemory(indexL-3, temp, 12); //ReadMultiByteFromEEPROM(indexL-3, temp, 12, PARA_EEPROM);
ReadDataFromFlash(indexL-3, temp, 12);
tmpLA = 0; tmpLA = 0;
tmpLB = 0xffffffff; tmpLB = 0xffffffff;
for(K=0, J=0; K<4; K++) { for(K=0, J=0; K<4; K++)
{
tempL.Byte[0] = temp[J++]; tempL.Byte[0] = temp[J++];
tempL.Byte[1] = temp[J++]; tempL.Byte[1] = temp[J++];
tempL.Byte[2] = temp[J++]; tempL.Byte[2] = temp[J++];
tempL.Byte[3] = 0; tempL.Byte[3] = 0;
tempFR[K] = tempL.DWord; tempFR[K] = tempL.DWord;
if(tempL.DWord > tmpLA) { if(tempL.DWord > tmpLA)
{
tmpLA = tempL.DWord; tmpLA = tempL.DWord;
IndexA = K; IndexA = K;
} }
if(tempL.DWord < tmpLB) { if(tempL.DWord < tmpLB)
{
tmpLB = tempL.DWord; tmpLB = tempL.DWord;
IndexB = K; IndexB = K;
} }
} }
for(K=0, J=0; K<4; K++) { for(K=0, J=0; K<4; K++)
{
if(K == IndexA) continue; if(K == IndexA) continue;
if(K == IndexB) continue; if(K == IndexB) continue;
temp[J] = K; temp[J] = K;
@@ -114,12 +129,14 @@ u32 GetFlowRate(u16 flowIndex, u16 curveType)
indexD += dataCompFac; indexD += dataCompFac;
tmpSLB -= tmpSLA; tmpSLB -= tmpSLA;
if(indexD > IndexA) { if(indexD > IndexA)
{
tmpSLB *= (u32)(indexD-IndexA); tmpSLB *= (u32)(indexD-IndexA);
tmpSLB /= (u32)IndexB; tmpSLB /= (u32)IndexB;
tmpSLA += tmpSLB; tmpSLA += tmpSLB;
} }
else { else
{
tmpSLB *= (u32)(IndexA-indexD); tmpSLB *= (u32)(IndexA-indexD);
tmpSLB /= (u32)IndexB; tmpSLB /= (u32)IndexB;
tmpSLA -= tmpSLB; tmpSLA -= tmpSLB;
@@ -311,13 +328,13 @@ void FlowRateLeakDetect(void)
return; return;
} }
// if((leakDetectTime == 0) || (sampleState.EnableRoughTest)) if((leakDetectTime == 0) || (sampleState.EnableRoughTest))
// { {
// leakDetectCounter = 0; leakDetectCounter = 0;
// leakDetectHighCounter = 0; leakDetectHighCounter = 0;
// leakDetectLowCounter = 0; leakDetectLowCounter = 0;
// return; return;
// } }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
if(flowRate < minLeakFlowRate) if(flowRate < minLeakFlowRate)
@@ -361,3 +378,39 @@ void FlowRateLeakDetect(void)
} }
#endif #endif
//******************************************************************************
#ifndef ENABLE_USER_UART
#pragma message("[undefined] ENABLE_USER_UART")
#elif(ENABLE_FLOW_GAIN)
u16 JudgeFlowRateGain(u16 flowGain)
{
switch(flowGain)
{
case 1: return 0;
//--------------------------------------------------------------------------
#ifndef FLOW_GAIN_MAX
#pragma message("[undefined] FLOW_GAIN_MAX")
#elif(FLOW_GAIN_MAX >= 10)
case 10: return 0;
#endif
//--------------------------------------------------------------------------
#ifndef FLOW_GAIN_MAX
#pragma message("[undefined] FLOW_GAIN_MAX")
#elif(FLOW_GAIN_MAX >= 100)
case 100: return 0;
#endif
//--------------------------------------------------------------------------
#ifndef FLOW_GAIN_MAX
#pragma message("[undefined] FLOW_GAIN_MAX")
#elif(FLOW_GAIN_MAX >= 1000)
case 1000: return 0;
#endif
default: return 1;
}
}
#endif

0
user/Compute/FlowRateCompute.h Executable file → Normal file
View File

50
user/Compute/GasAnalysis.c Executable file → Normal file
View File

@@ -1,5 +1,6 @@
#include "../main/SystemInclude.h" #include "../main/SystemInclude.h"
static s16 GasAnalysisCNT; static s16 GasAnalysisCNT;
u16 ATypeNode[CURVE_DATA_MAX], ATypeVal[CURVE_DATA_MAX], curveATypeNum; u16 ATypeNode[CURVE_DATA_MAX], ATypeVal[CURVE_DATA_MAX], curveATypeNum;
bool isCurrentGas; bool isCurrentGas;
@@ -7,8 +8,8 @@ bool isCurrentGas;
/******************************************************************************/ /******************************************************************************/
void GasAnalysisParameterInit(void) void GasAnalysisParameterInit(void)
{ {
airFactor = (u16)ReadShortParameterFromMemory(AIR_FACTOR, AIR_FACTOR_DEFAULT); VHHParameterAir = (u16)ReadParameterFromMemory(VHH_AIR_PARA, VHH_AIR_PARA_WIDTH, RH_PARA_DEFAULT);
factorVth = (u16)ReadShortParameterFromMemory(FACTOR_VTH, 1000); VHHParameterScale = (u16)ReadParameterFromMemory(VHH_PARA_SCALE, VHH_PARA_SCALE_WIDTH, 1000);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef ENABLE_GAS_RECOGNITION_TABLE #ifndef ENABLE_GAS_RECOGNITION_TABLE
@@ -21,37 +22,37 @@ void GasAnalysisParameterInit(void)
#ifndef ENABLE_DENSITY_DETECT #ifndef ENABLE_DENSITY_DETECT
#pragma message("[undefined] ENABLE_DENSITY_DETECT") #pragma message("[undefined] ENABLE_DENSITY_DETECT")
#elif(ENABLE_DENSITY_DETECT) #elif(ENABLE_DENSITY_DETECT)
// densityFSParameter = (u16)ReadParameterFromMemory(DENSITY_FS_PARA, DENSITY_FS_PARA_WIDTH, DENSITY_FS_PARA_DEFAULT); densityFSParameter = (u16)ReadParameterFromMemory(DENSITY_FS_PARA, DENSITY_FS_PARA_WIDTH, DENSITY_FS_PARA_DEFAULT);
#endif #endif
} }
/******************************************************************************/ /******************************************************************************/
u16 ComputeZeroVHH(void) unsigned int ComputeZeroVHH(void)
{ {
tmpSLA = (u32)voltageDetected[RRRES]; tmpSLA = (unsigned long int)voltageDetected[RRRES];
tmpSLA -= (u32)RRRoom; tmpSLA -= (unsigned long int)NRHRoom;
tmpSLB = (u32)VHHHigh; tmpSLB = (unsigned long int)VHHHigh;
tmpSLB -= (u32)VHHLow; tmpSLB -= (unsigned long int)VHHLow;
tmpSLA *= tmpSLB; tmpSLA *= tmpSLB;
tmpSLB = (u32)RRHigh; tmpSLB = (unsigned long int)NRHHigh;
tmpSLB -= (u32)RRLow; tmpSLB -= (unsigned long int)NRHLow;
tmpSLA /= tmpSLB; tmpSLA /= tmpSLB;
tmpSLA += (u32)VHHRoom; tmpSLA += (unsigned long int)VHHRoom;
return (u16)tmpSLA; return (unsigned int)tmpSLA;
} }
/******************************************************************************/ /******************************************************************************/
bool GasAnasisOneTime(void) bool GasAnasisOneTime(void)
{ {
s16 valueTemp; signed int valueTemp;
valueTemp = (s16)(voltageDetected[VHPA] - airFactor); valueTemp = (signed int)(voltageDetected[VHPA] - VHHParameterAir);
if(abs(valueTemp) < factorVth) return 1; if(abs(valueTemp) < VHHParameterScale) return 1;
else return 0; else return 0;
} }
/******************************************************************************/ /******************************************************************************/
@@ -67,7 +68,7 @@ void GasAnasisCompute(void)//
#elif(ENABLE_GAS_RECOGNITION_TABLE) #elif(ENABLE_GAS_RECOGNITION_TABLE)
voltageDetected[VHPA] = FindVHHInCalibCurve(voltageDetected[RGIDX]); voltageDetected[VHPA] = FindVHHInCalibCurve(voltageDetected[RGIDX]);
#else #else
voltageDetected[VHPA] = (u16)GetFlowRate(voltageDetected[REG_INDEX], ATYPE_VH); voltageDetected[VHPA] = (unsigned int)GetFlowRate(voltageDetected[REG_INDEX], ATYPE_VH);
#endif #endif
voltageDetected[VHPA] = WordSubFunction(voltageDetected[DVHHX], voltageDetected[VHPA]); voltageDetected[VHPA] = WordSubFunction(voltageDetected[DVHHX], voltageDetected[VHPA]);
@@ -99,9 +100,9 @@ void GasAnasisCompute(void)//
/******************************************************************************/ /******************************************************************************/
void ReadVHHCurveFromMemory(void) void ReadVHHCurveFromMemory(void)
{ {
u16 I; unsigned int I;
curveATypeNum = ReadShortParameterFromMemory(ATYPECURVE_NUM, ATYPECURVE_NUM_DEFAULT); curveATypeNum = (unsigned int)ReadParameterFromMemory(ATYPECURVE_NUM, ATYPECURVE_NUM_WIDTH, ATYPECURVE_NUM_DEFAULT);
for(I=0; I<curveATypeNum; I++) for(I=0; I<curveATypeNum; I++)
{ {
ReadMultiByteFromEEPROM(ATYPECURVE_DATA_BASE + I * ATYPECURVE_DATA_WIDTH, tempDev.Byte, ATYPECURVE_DATA_WIDTH, PARA_EEPROM); ReadMultiByteFromEEPROM(ATYPECURVE_DATA_BASE + I * ATYPECURVE_DATA_WIDTH, tempDev.Byte, ATYPECURVE_DATA_WIDTH, PARA_EEPROM);
@@ -120,9 +121,9 @@ void ReadVHHCurveFromMemory(void)
} }
/******************************************************************************/ /******************************************************************************/
u16 FindVHHInCalibCurve(u16 calibIndex) unsigned int FindVHHInCalibCurve(unsigned int calibIndex)
{ {
u16 I; unsigned int I;
if((curveATypeNum < 3) || (curveATypeNum > CURVE_DATA_MAX)) if((curveATypeNum < 3) || (curveATypeNum > CURVE_DATA_MAX))
{ {
@@ -135,7 +136,7 @@ u16 FindVHHInCalibCurve(u16 calibIndex)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
for(I = 0; I < curveATypeNum - 1; I++) for(I = 0; I < curveATypeNum - 1; I++)
{ {
if(ATypeNode[I] > 32767) continue; if(ATypeNode[I] > 32767) continue;
if(ATypeNode[I] > calibIndex) break; if(ATypeNode[I] > calibIndex) break;
} }
@@ -144,9 +145,8 @@ u16 FindVHHInCalibCurve(u16 calibIndex)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Secondary.NodeX = calibIndex; Secondary.NodeX = calibIndex;
if(ATypeNode[I] > 32767) Secondary.NodeH = 0; if(ATypeNode[I] > 32767) Secondary.NodeH = 0;
else Secondary.NodeH = ATypeNode[I]; else Secondary.NodeH = ATypeNode[I];
if(ATypeNode[I-1] > 32767) Secondary.NodeL = 0; if(ATypeNode[I-1] > 32767) Secondary.NodeL = 0;
else Secondary.NodeL = ATypeNode[I-1]; else Secondary.NodeL = ATypeNode[I-1];

6
user/Compute/GasAnalysis.h Executable file → Normal file
View File

@@ -14,12 +14,12 @@
extern u16 ATypeNode[CURVE_DATA_MAX], ATypeVal[CURVE_DATA_MAX], curveATypeNum; extern u16 ATypeNode[CURVE_DATA_MAX], ATypeVal[CURVE_DATA_MAX], curveATypeNum;
//****************************************************************************** //******************************************************************************
void GasAnalysisParameterInit(void); void GasAnalysisParameterInit(void);
u16 ComputeZeroVHH(void); unsigned int ComputeZeroVHH(void);
u32 GetVHHFactor(u16 flowIndex); unsigned long int GetVHHFactor(unsigned int flowIndex);
void GasAnasisCompute(void); void GasAnasisCompute(void);
bool GasAnasisOneTime(void); bool GasAnasisOneTime(void);
void ReadVHHCurveFromMemory(void); void ReadVHHCurveFromMemory(void);
u16 FindVHHInCalibCurve(u16 calibIndex); unsigned int FindVHHInCalibCurve(unsigned int calibIndex);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef ENABLE_DENSITY_DETECT #ifndef ENABLE_DENSITY_DETECT

0
user/Compute/PipeFlowRate.c Executable file → Normal file
View File

0
user/Compute/PipeFlowRate.h Executable file → Normal file
View File

35
user/Compute/SavingData.c Executable file → Normal file
View File

@@ -1,17 +1,18 @@
#include "../main/SystemInclude.h" #include "../main/SystemInclude.h"
/****************************************************************************** //******************************************************************************
recordTime must be define
*******************************************************************************/
// for save data // for save data
u16 historyPeriodSet; u16 historyPeriodSet;
static u16 lastState; static u16 lastState;
u16 saveTimeCounter; u16 saveTimeCounter;
/******************************************************************************/ /******************************************************************************/
void SaveParameterInit(void) void SaveParameterInit(void)
{ {
// history record period // history record period
recordTime = (u16)ReadShortParameterFromMemory(RECORD_TIME, RECORD_TIME_DEFAULT); // ReadMultiByteFromEEPROM(HISTORY_PERIOD, tempL.Byte, HISTORY_PERIOD_WIDTH, PARA_EEPROM);
// if(tempL.Byte[HISTORY_PERIOD_CRC] != CRC8(tempL.Byte, HISTORY_PERIOD_CRC)) historyPeriod = HISTORY_PERIOD_DEFAULT;
// else historyPeriod = tempL.Word[0];
historyPeriod = (u16)ReadParameterFromMemory(HISTORY_PERIOD, HISTORY_PERIOD_WIDTH, HISTORY_PERIOD_DEFAULT);
} }
/******************************************************************************/ /******************************************************************************/
@@ -98,6 +99,12 @@ u16 AlarmWrite(void)
#pragma message("[undefined] REC_ALARM_DATA") #pragma message("[undefined] REC_ALARM_DATA")
#elif(REC_ALARM_DATA) #elif(REC_ALARM_DATA)
#ifndef ENABLE_EXT_RTC
#pragma message("[undefined] ENABLE_EXT_RTC")
#elif(ENABLE_EXT_RTC)
ExtRTCTimeRead();
#endif
// The Zero record: Factory initial state // The Zero record: Factory initial state
ReadMultiByteFromEEPROM(ALARM_POINTER, tempL.Byte, ALARM_POINTER_WIDTH, DATA_EEPROM); ReadMultiByteFromEEPROM(ALARM_POINTER, tempL.Byte, ALARM_POINTER_WIDTH, DATA_EEPROM);
if(tempL.Byte[ALARM_POINTER_CRC] != CRC8(tempL.Byte, ALARM_POINTER_CRC)) tempL.Word[0] = 1; if(tempL.Byte[ALARM_POINTER_CRC] != CRC8(tempL.Byte, ALARM_POINTER_CRC)) tempL.Word[0] = 1;
@@ -119,7 +126,7 @@ u16 AlarmWrite(void)
void SetHistoryRecordTime(void) void SetHistoryRecordTime(void)
{ {
/* /*
u16 wrt_base, pointer; unsigned int wrt_base, pointer;
ReadMultiByteFromEEPROM(HISTORY_POINTER_H, temp, 2, DATA_EEPROM); ReadMultiByteFromEEPROM(HISTORY_POINTER_H, temp, 2, DATA_EEPROM);
pointer = make16(temp[0], temp[1]); pointer = make16(temp[0], temp[1]);
@@ -181,6 +188,12 @@ u16 HistoryRecordWrite(void)
#pragma message("[undefined] REC_HISTORY_DATA") #pragma message("[undefined] REC_HISTORY_DATA")
#elif(REC_HISTORY_DATA) #elif(REC_HISTORY_DATA)
#ifndef ENABLE_EXT_RTC
#pragma message("[undefined] ENABLE_EXT_RTC")
#elif(ENABLE_EXT_RTC)
ExtRTCTimeRead();
#endif
ReadMultiByteFromEEPROM(HISTORY_POINTER, tempL.Byte, HISTORY_POINTER_WIDTH, DATA_EEPROM); ReadMultiByteFromEEPROM(HISTORY_POINTER, tempL.Byte, HISTORY_POINTER_WIDTH, DATA_EEPROM);
if(tempL.Byte[HISTORY_POINTER_CRC] != CRC8(tempL.Byte, HISTORY_POINTER_CRC)) tempL.Word[0] = 1; if(tempL.Byte[HISTORY_POINTER_CRC] != CRC8(tempL.Byte, HISTORY_POINTER_CRC)) tempL.Word[0] = 1;
else if(tempL.Word[0] >= HISTORY_DEPTH) tempL.Word[0] = 1; else if(tempL.Word[0] >= HISTORY_DEPTH) tempL.Word[0] = 1;
@@ -254,8 +267,14 @@ u16 DateAccWrite(void)
#ifndef REC_DATE_DATA #ifndef REC_DATE_DATA
#pragma message("[undefined] REC_DATE_DATA") #pragma message("[undefined] REC_DATE_DATA")
#elif(REC_DATE_DATA) #elif(REC_DATE_DATA)
u16 wrt_base; unsigned int wrt_base;
unsigned char buffer[DATE_WIDTH]; unsigned char buffer[DATE_WIDTH];
#ifndef ENABLE_EXT_RTC
#pragma message("[undefined] ENABLE_EXT_RTC")
#elif(ENABLE_EXT_RTC)
ExtRTCTimeRead();
#endif
ReadMultiByteFromEEPROM(DATE_POINTER, tempL.Byte, DATE_POINTER_WIDTH, DATA_EEPROM); ReadMultiByteFromEEPROM(DATE_POINTER, tempL.Byte, DATE_POINTER_WIDTH, DATA_EEPROM);
if(tempL.Byte[DATE_POINTER_CRC] != CRC8(tempL.Byte, DATE_POINTER_CRC)) tempL.Word[0] = 1; if(tempL.Byte[DATE_POINTER_CRC] != CRC8(tempL.Byte, DATE_POINTER_CRC)) tempL.Word[0] = 1;
@@ -371,7 +390,7 @@ void ClearDateRecord(void)
/******************************************************************************/ /******************************************************************************/
void DataStorageManagement(void) void DataStorageManagement(void)
{ {
systemProcessing.Bit.SaveHandle = 0; systemProcess.Bit.SaveHandle = 0;
if(alarmState != lastState) if(alarmState != lastState)
{ {

0
user/Compute/SavingData.h Executable file → Normal file
View File

48
user/Compute/StaticTemperature.c Executable file → Normal file
View File

@@ -1,9 +1,53 @@
#include "../main/SystemInclude.h" #include "../main/SystemInclude.h"
// for flowrate compute // for flowrate compute
u16 staticHighTemperature, staticLowTemperature, RHHighTa, RHLowTa;
s32 RHCalibDeltaVaule, TACalibDeltaVaule, RHTemperature; s32 RHCalibDeltaVaule, TACalibDeltaVaule, RHTemperature;
static u16 zeroCalibType; static u16 zeroCalibType;
//******************************************************************************
void StaticTemperatureInit(void)
{
zeroCalibType = 0;
staticLowTemperature = (u16)ReadParameterFromMemory(STATIC_LOW_TA, STATIC_LOW_TA_WIDTH, STATIC_LOW_TA_DEFAULT);
if((isReadParameterOK) && (staticLowTemperature < ENABLE_WRITE_TA_LOW)) zeroCalibType |= 'L';
staticHighTemperature = (u16)ReadParameterFromMemory(STATIC_HIGH_TA, STATIC_HIGH_TA_WIDTH, STATIC_HIGH_TA_DEFAULT);
if((isReadParameterOK) && (staticHighTemperature > ENABLE_WRITE_TA_HIGH)) zeroCalibType |= 'H'<<8;
}
//******************************************************************************
void StaticLowTemperatureWrite(void)
{
tempL.Word[0] = voltageDetected[TPCB];
staticLowTemperature = WriteShortParameterToEEPROM(STATIC_LOW_TA, STATIC_LOW_TA_WIDTH);
zeroCalibType &= 0xff00;
zeroCalibType |= 'L';
currentMode.Bit.LowCalibEnd = 1;
if(zeroCalibType == (('H'<<8)+'L'))
{
tempL.Word[0] = 0;
tempL.Word[0] = WriteShortParameterToEEPROM(SYS_COMMAND, SYS_COMMAND_WIDTH);
EnterUserMode();
}
}
//******************************************************************************
void StaticHighTemperatureWrite(void)
{
tempL.Word[0] = voltageDetected[TPCB];
staticHighTemperature = WriteShortParameterToEEPROM(STATIC_HIGH_TA, STATIC_HIGH_TA_WIDTH);
zeroCalibType &= 0x00ff;
zeroCalibType |= 'H'<<8;
currentMode.Bit.HighCalibEnd = 1;
if(zeroCalibType == (('H'<<8)+'L'))
{
tempL.Word[0] = 0;
tempL.Word[0] = WriteShortParameterToEEPROM(SYS_COMMAND, SYS_COMMAND_WIDTH);
EnterUserMode();
}
}
//****************************************************************************** //******************************************************************************
u16 ComputeRHTemperature(u16 RHRes) u16 ComputeRHTemperature(u16 RHRes)
{ {
@@ -30,10 +74,10 @@ void StaticTGasCompute(void)
#pragma message("[undefined] ENABLE_RR_CALIBRATION") #pragma message("[undefined] ENABLE_RR_CALIBRATION")
#elif(ENABLE_RR_CALIBRATION) #elif(ENABLE_RR_CALIBRATION)
// ͨ<><CDA8><EFBFBD>ߵ<EFBFBD><DFB5>±궨<C2B1><EAB6A8><EFBFBD><EFBFBD>RR<52><52><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // ͨ<><CDA8><EFBFBD>ߵ<EFBFBD><DFB5>±궨<C2B1><EAB6A8><EFBFBD><EFBFBD>RR<52><52><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RHCalibDeltaVaule = (u32)RRHigh-(u32)RRLow; RHCalibDeltaVaule = (u32)NRHHigh-(u32)NRHLow;
TACalibDeltaVaule = (u32)staticHighTemperature-(u32)staticLowTemperature; TACalibDeltaVaule = (u32)staticHighTemperature-(u32)staticLowTemperature;
tmpSLA = (u32)voltageDetected[RRRES]-(u32)RRLow; tmpSLA = (u32)voltageDetected[RRRES]-(u32)NRHLow;
tmpSLA *= TACalibDeltaVaule; tmpSLA *= TACalibDeltaVaule;
tmpSLA /= RHCalibDeltaVaule; tmpSLA /= RHCalibDeltaVaule;
tmpSLA += (u32)staticLowTemperature; tmpSLA += (u32)staticLowTemperature;

3
user/Compute/StaticTemperature.h Executable file → Normal file
View File

@@ -21,9 +21,12 @@
#define RES_FACTOR_MAX 35 #define RES_FACTOR_MAX 35
// for flowrate compute // for flowrate compute
extern u16 staticHighTemperature, staticLowTemperature, RHHighTa, RHLowTa;
extern s32 RHCalibDeltaVaule, TACalibDeltaVaule, RHTemperature; extern s32 RHCalibDeltaVaule, TACalibDeltaVaule, RHTemperature;
//****************************************************************************** //******************************************************************************
void StaticTemperatureInit(void); void StaticTemperatureInit(void);
void StaticLowTemperatureWrite(void);
void StaticHighTemperatureWrite(void);
void StaticTGasCompute(void); void StaticTGasCompute(void);
u16 ComputeRHTemperature(u16 RHRes); u16 ComputeRHTemperature(u16 RHRes);

Some files were not shown because too many files have changed in this diff Show More