tpgf 发表于 2025-3-5 08:50

SH367309中颖单片机专用动力电池保护板开发资料 原理图PCB代码

1、简介      
中颖BMS5-16 串 前端芯片,用于充电管理+电池保护+电量计量,有规格书,原理图,PCB, DEMO CODE全套开发资料 。

2、原理图和PCB










3、程序

#include "system.h"
#include "Uart.h"
#include "Main.h"


void main(void)
{
      Initial();                                        //Initialize the system

      while(1)
      {
                RSTSTAT = RSTSTAT;

                  if(bAFE**)
                {
                         bAFE** = 0;
                        AFERdFlag();
                }

                if((ucResetFlag==0x12) && bUartSndAck**)      //Software reset occurs, and ended UART communication
                {
                        if(!bWrFlash**)
            {
                              EA = 0;
                              ResetAFE();                                                //Reset IC
                              ResetInit();                                        //Reset MCU
                        }
                }

                if(bWakeup**)                                                //The charger / load, keys can wake up the system
                {
                        bWakeup** = 0;
                        WakeUpProcess();                              //System to be awakened
                }

                if(bBleOnOff**)                                        //按键长按5秒开启/关闭蓝牙
                {
                        bBleOnOff** = 0;
                        BleOnorOff();
                }
                BleDisplay();

                if(bCADC**)
                {
                        bCADC** = 0;
                        CurProcess();                                        //Calculate the current value and determines the state of charge and discharge
                }

                if(bCalibration**)
                {
                        bCalibration** = 0;
                        CaliProcess();                                        //PC calibration
                }

                if((bWrFlash**)&&(ucUpDataLimitTime == 0))
                {
                        bWrFlash** = 0;
                        if(FlashProcess())
                        {
                              if(bUartNeedAck**)
                              {
                                        UART_SEND_ACK;
                              }
                        }
                        else
                        {
                              if(bUartNeedAck**)
                              {
                                        UART_SEND_NACK;
                              }
                        }
                        bUartNeedAck** = 0;
                }

                if(bLEDOpen)
                {
                        bLEDOpen = 0;
                        bLED** = 1;
                        ucLEDTimeCnt = 0;
                        LEDPowerOn();                                        //By LED displays battery capacity
                }

                if(bEnEEPRomBK && bE2PProcess**)
                {
                        bE2PProcess** = 0;
                        E2PRomBKProcess();
                }

                if(bISP** && bUartSndAck**)
                {
                        bISP** = 0;
                        ISPProcess();
                }

                if(bTimer**)                                                //timer is 1s
                {
                        bTimer** = 0;

                        AFECheck();                            //Check AFE Register               

                        LEDPowerOff();                                        //When the LED display 4s, turn off the LED

                        BatteryInfoManage();                        //Get battery voltage and temperature information

                        RamCheckProcess();                  //Detect the xdata block data

                        GaugeManage();                                        //Calculate the battery charge and discharge capacity

                        VolProcess();                                        //Detection of battery charge and discharge cut-off voltage

                        BalProcess();                                        //Process external voltage balance

                        ProtectProcess();                              //Process battery abnormal state

            if(bEnEEPRomBK)
            {
                            E2PRomBKCheck();                        //Detecting whether to backup EEPRom
            }

                        ShutDownProcess();                              //Detecting whether to enter a low-power
                }

                IntoShutDown();
      }
}

————————————————

                            版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/qq_35654286/article/details/145109727

jf101 发表于 2025-3-24 08:14

非常不错的开源案例

中国龙芯CDX 发表于 2025-3-24 23:11

很赞的开源资料

星辰大海不退缩 发表于 2025-3-27 12:57

非常不错的资源学习一下
页: [1]
查看完整版本: SH367309中颖单片机专用动力电池保护板开发资料 原理图PCB代码