ZD-BMS-CH/ZDBMS/BMS_MC/User/main.c

69 lines
2.0 KiB
C
Raw Normal View History

2025-02-19 06:18:30 +00:00
/********************************** (C) COPYRIGHT *******************************
* File Name : main.c
* Author : WCH
* Version : V1.0.0
* Date : 2023/12/26
* Description : Main program body.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
/*
*@Note
*USART Print debugging routine:
*USART1_Tx(PA9).
*This example demonstrates using USART1(PA9) as a print debug port output.
*
*/
#include "debug.h"
2025-03-15 01:41:28 +00:00
#include "../init/inc/init.h"
#include "../app/inc/app.h"
2025-02-19 06:18:30 +00:00
/* Global typedef */
/* Global define */
/* Global Variable */
/*********************************************************************
* @fn main
*
* @brief Main program.
*
* @return none
*/
int main(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
SystemCoreClockUpdate();
Delay_Init();
USART_Printf_Init(115200);
printf("SystemClk:%d\r\n", SystemCoreClock);
2025-03-15 01:41:28 +00:00
printf( "ChipID:%08x\r\n", DBGMCU_GetCHIPID());
2025-02-19 06:18:30 +00:00
2025-03-15 01:41:28 +00:00
all_hardWare_init(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
DCHG_Enable(1);
uint16_t t1=0,t2=0,t3=0;
// <20><><EFBFBD><EFBFBD><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TIM2<4D><32><EFBFBD><EFBFBD>
2025-02-19 06:18:30 +00:00
while(1)
{
2025-03-15 01:41:28 +00:00
//50Ms<4D><73><EFBFBD><EFBFBD>
if(g_timer50MsFlag == 1)
{
g_timer50MsFlag = 0;
}
//1S<31><53><EFBFBD><EFBFBD>
if(g_timer1SFlag == 1)
{
g_timer1SFlag = 0;
convert_Temp(&t1,&t2,&t3);
GPIO_WriteBit(GPIOC, GPIO_Pin_13, !GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_13)); //<2F><>תGPIO<49><4F>LED
GPIO_WriteBit(GPIOB, GPIO_Pin_9, !GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_9)); //<2F><>תGPIO<49><4F>WDI
printf("\r\nTemp1:%d\r\nTemp2:%d\r\nTemp3:%d\r\nDSG:%d\r\nCHG:%d\r\n", t1, t2, t3, gADCBuf[3], gADCBuf[4]);
}
2025-02-19 06:18:30 +00:00
}
}