⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bldczc.h

📁 MC56F802BLDC 可以使用的算法 就是电机启动有点慢
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************************************
*
* Motorola Inc.
* (c) Copyright 2000 Motorola, Inc.
* ALL RIGHTS RESERVED.
*
*****************************************************************************************************
*
* FILE NAME: BldcZC.h
*
* DESCRIPTION: Motorola Bldc Zero Crossing Algorithms
*
* MODULES INCLUDED: stdlib.h
*
*****************************************************************************************************/

/****************************************************************************************************
 *!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 *   READ ME CAREFULLY:                                                
 *!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * The general of BldcZC algorithms interconnectivity is, they are     
 * devided into groups according to their functionalities:             
 * - COMPUTATION:                                                      
 *            - BldcZCComput(),BldcZCComputInit()                      
 * - ZERO CROSSING                                                     
 *           - BldcZCCmtServ(),BldcZCZCrosIntAlg(),BldcZCZCrosInit()                                           
 * - COMMUTATION:                                                      
 *           - BldcZCCmtServ(),BldcZCCmtServInit()                     
 * - DATA EXCHANGE:                                                    
 *           - BldcZCHndlr(),BldcZCTimeoutIntAlg(),BldcZCHndlrInit()   
 *             BldcZCHndlrStop()                                       
 * !Each of the above group has its dedicated BldcZC_sState_xxx API    
 *    typedef data structure                                           
 * !Each of BldcZC_sState_xxx structure has BldcZC_fCmd_xxx            
 *    Commands and Requests status flags register where the flags has  
 *    following meaning:                                               
 *    yy_zz_CmdFlag - is an output Command Flag from algorithm meaning:
 *                   action yy happened in algorithm zz!!!             
 *    yy_zz_RqFlag - is an input Request Flag to the algorithm meaning:
 *                  action yy happened(somewhere),                     
 *                  service in algorithm zz requested!!!                 
 *  !The data interchange between these groups is via:                 
 *  - BldcZCHndlr() algorithm !!! and                                  
 *  - BldcZCTimeoutIntAlg () algorithm !!!                             
 *       which input is bldczc_sStates data structure containing all   
 *       BldcZC_sState_xxx substructures                               
 *                                                                     
 *  The algorithms can also be splitted according to their             
 *  suggested calls:                                                   
 *  - from Main SW (or Arbiter called)                                 
 *  - from Interrupt subroutines called: xxxIntAlg                     
 *!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ****************************************************************************************************/


/* DEFINITION_START */

#ifndef _BLDCZC_H_
#define _BLDCZC_H_


/* variables definitions */
typedef struct 
{
    UWord16             T_Cmt0;
    UWord16             T_Next; 
    UWord16             T_ZCros;
    UWord16             T_ZCros0;
    UWord16             Per_Toff;
    UWord16             Per_CmtPreset;
    UWord16             Per_ZCros;
    UWord16             Per_ZCros0;
    /* Possibly UWord16             Per_ZCros_m1; */
    UWord16             Per_ZCrosFlt;
    UWord16             Per_HlfCmt;
} bldczc_sTimes;                             /* Bldc control Time dedicated variables */

typedef union
{
 struct  
   {
    unsigned int CmtDone_Comput_RqFlag : 1;  /* Commutation Done Comput Request Flag */
    unsigned int ZCOKGet_Comput_RqFlag : 1;  /* Zero Cross OK Get Comput Request Flag */
    unsigned int ZCMiss_Comput_RqFlag : 1;   /* Zero Cross Missed Comput Request Flag */
    
    unsigned int CmtPreComp_CmdFlag : 1;     /* Commutation PreComputed Command Flag */
    unsigned int ToffComp_CmdFlag : 1;       /* Period Toff Computed Command Flag */
    unsigned int CmtComp_CmdFlag : 1;        /* Commutation Computed Command Flag */
    
    unsigned int ZC_ComputFlag : 1;          /* Zero Crossing Computed Flag */
    unsigned int Bit7 : 1;                   /* RESERVED */
    unsigned int Bit8 : 1;                   /* RESERVED */
    unsigned int Bit9 : 1;                   /* RESERVED */
    unsigned int Bit10 : 1;                  /* RESERVED */
    unsigned int Bit11 : 1;                  /* RESERVED */
    unsigned int Bit12 : 1;                  /* RESERVED */
    unsigned int Bit13 : 1;                  /* RESERVED */
    unsigned int Bit14 : 1;                  /* RESERVED */
    unsigned int Bit15 : 1;                  /* RESERVED */
   } B;
 UWord16 W16;
} bldczc_uCmdComput;                        /* BldcZC Comput functions Commands, 
                                                Requests, Status Flags variable */
typedef struct 
{
    bldczc_uCmdComput   Cmd_Comput;          /* Comput Command variable */
    Word16              Coef_CmtPrecompLShft; /* Commutation time precomputation 
                                                  Coeficient Range */
    Frac16              Coef_CmtPrecompFrac;  /* Commutation time precomputation 
                                                  Coeficient */
    Frac16              Coef_HlfCmt;         /* Half commutation Coeficient */
    Frac16              Coef_Toff;           /* Toff Zero Crossing Coeficient */
    UWord16             Const_PerProcCmt;    /* Maximal Period of Commutation Proceeding */
                                             /* time of motor coil reverse current */
    UWord16             Max_PerCmt;          /* Maximal Commutation Period */
} bldczc_sStateComput;                      /* Bldc Timeout state Variables */


typedef union
{
 struct  
   {
    unsigned int CmtDone_CmtServ_RqFlag;     /* Commutation done CmtServ Request*/
    unsigned int Cmt_DrvRqFlag : 1;          /* Commutation Driver Request Flag */
    unsigned int CmtPreset_DrvRqFlag : 1;    /* Preset new Commutation Driver Request Flag
                                                (not necessary for some commutation technique) */
    unsigned int DIRFlag : 1;                /* motor direction Flag */
    unsigned int CmtServ_CmdFlag : 1;        /* Commutation served Command Flag */
    unsigned int CmtDone_CmdFlag : 1;        /* Commutation Done Command Flag */           
    unsigned int Bit6 : 1;                   /* RESERVED */
    unsigned int Bit7 : 1;                   /* RESERVED */
    unsigned int Bit8 : 1;                   /* RESERVED */
    unsigned int Bit9 : 1;                   /* RESERVED */
    unsigned int Bit10 : 1;                  /* RESERVED */
    unsigned int Bit11 : 1;                  /* RESERVED */
    unsigned int Bit12 : 1;                  /* RESERVED */
    unsigned int Bit13 : 1;                  /* RESERVED */
    unsigned int Bit14 : 1;                  /* RESERVED */
    unsigned int Bit15 : 1;                  /* RESERVED */
   } B;
 UWord16 W16;
} bldczc_uCmdCmt;                           /* BldcZC Cmt functions Commands,
                                               Requests, Status Flags variable */

typedef struct 
{
    bldczc_uCmdCmt      Cmd_Cmt;             /* Commutation Command variable */
    UWord16             Step_Cmt;            /* Motor Commutation Step */
    UWord16             Step_Cmt_Next;       /* Mext Motor Commutation Step */
} bldczc_sStateCmt;                         /* Bldc Commutation state Variables */

typedef union
{
 struct  
   {
    unsigned int ZCrosInt_EnblFlag : 1;      /* Zero Crossing Enable Flag */    
    unsigned int ZCInpMaskPreset_DrvRqFlag : 1;  
                                             /* Preset Input Mask Driver Request Flag */
    unsigned int CmtDone_ZCrosServ_RqFlag : 1;
                                             /* Commutation Done Zero Cros Service Request Flag */
    unsigned int CmtProcEnd_ZCrosServ_RqFlag : 1;
                                             /* Commutation Proceeding End
                                                 Zero Cros Service Request Flag */
    unsigned int CmtServ_ZCrosServ_RqFlag : 1;
                                             /* Commutation served
                                                 Zero Cros Service Request Flag */
    unsigned int ZC_GetFlag : 1;             /* Zero Crossing Get Flag */
    unsigned int ZC_SoonFlag : 1;            /* Zero Crossing Soon (before Toff time) */

    unsigned int Cmt_ProcFlag : 1;           /* Commutation proceeding Flag */
                                             /* motor coil reverse current when switching */
    unsigned int ZC_ToffFlag : 1;            /* Zero Crossing off Time Flag */

    unsigned int ZCOKGet_CmdFlag : 1;        /* Zero Crossing OK Get Command Flag */
    unsigned int ZCMiss_CmdFlag : 1;         /* Zero Crossing missed Command Flag */
                                             /* (flag set when Zero Crossing before Toff) */
    unsigned int noZCErr_CmdFlag : 1;        /* no Zero Crossing get between commutations */
    unsigned int ZCMissErr_CmdFlag : 1;      /* Zero Crossing missed Error Command Flag */
    unsigned int CmtDone_ZCrosServ_CmdFlag : 1; /* Commutation Done Zero Cros Serv 
                                                Command Flag */
    unsigned int CmtServ_ZCrosServ_CmdFlag : 1; /* after Commutation served Zero Cros Serviced 
                                                  Command Flag */
    unsigned int EndStart_ZCrosServ_CmdFlag : 1; /* End Start Up ZCros Serv Command Flag */
    
    unsigned int MaxZCrosErr_ZCrosServ_CmdFlag : 1; /* Zero Crossing Errors >= Max_ZCrosErr
                                                       ZCros Serv Command Flag */
    unsigned int ZCInpSet_DrvRqFlag : 1;
                                             /* Set ZC Input Driver Request Flag */
    unsigned int ZCToffEnd_ZCrosServ_RqFlag : 1;  
                                             /* Zero Crossing Time off End
                                                Zero Cros Service Request Flag   */
    unsigned int Expect_ZCInp_PositivFlag : 1;  /* Expected Zero Crossing Input Positive Flag */
    unsigned int Expect_ZCInp_PositivNextFlag : 1; /* Next Expected Zero Crossing Input 
                                                      Positive Flag */
    unsigned int Bit21 : 1;                  /* RESERVED */
    unsigned int Bit22 : 1;                  /* RESERVED */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -