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

69 lines
2.0 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/********************************** (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"
#include "../init/inc/init.h"
#include "../app/inc/app.h"
/* 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);
printf( "ChipID:%08x\r\n", DBGMCU_GetCHIPID());
all_hardWare_init(); //外设初始化
DCHG_Enable(1);
uint16_t t1=0,t2=0,t3=0;
// 需添加更多任务找TIM2添加
while(1)
{
//50Ms任务
if(g_timer50MsFlag == 1)
{
g_timer50MsFlag = 0;
}
//1S任务
if(g_timer1SFlag == 1)
{
g_timer1SFlag = 0;
convert_Temp(&t1,&t2,&t3);
GPIO_WriteBit(GPIOC, GPIO_Pin_13, !GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_13)); //翻转GPIOLED
GPIO_WriteBit(GPIOB, GPIO_Pin_9, !GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_9)); //翻转GPIOWDI
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]);
}
}
}