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

📄 s12ect16b8cv3.h

📁 freescale 协处理器应用相关实例
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************
                                                   COPYRIGHT (c) FRESSCALE 2005  
                                                                          
File Name          :    $RCSfile: S12ECT16B8CV3.h,v $                     
                                                                          
Current Revision :      $Revision: 1.0 $                                  
                                                                          
PURPOSE: header file for S12X Enhanced Capture Timer (ECT) block                                 
                                                                                                                                                     
DESCRIPTION: Defines the timer block as a datastructure of type tECT.   
                                                                          
UPDATE HISTORY                                                            
REV  AUTHOR       DATE       DESCRIPTION OF CHANGE                        
---  ------      --------    ---------------------                        
1.0  r32151      02/09/05    - Initial coding based on S12ECT16B8CV2.h     
1.1  r32151      10/03/06    - fixed ptpsr location 
                             - added OCPD register
1.2  r32151      06/06/06    - fixed OCPD typo

     *******************************************************************
     * File created by: Freescale East Kilbride MCD Applications Group *
     *******************************************************************

                                                                          
******************************************************************************/
/*===========================================================================*/
/* Freescale reserves the right to make changes without further notice to any*/
/* product herein to improve reliability, function, or design. Freescale does*/
/* not assume any  liability arising  out  of the  application or use of any */
/* product,  circuit, or software described herein;  neither  does it convey */
/* any license under its patent rights  nor the  rights of others.  Freescale*/
/* products are not designed, intended,  or authorized for use as components */
/* in  systems  intended  for  surgical  implant  into  the  body, or  other */
/* applications intended to support life, or  for any  other application  in */
/* which the failure of the Freescale product  could create a situation where*/
/* personal injury or death may occur. Should Buyer purchase or use Freescale*/
/* products for any such intended  or unauthorized  application, Buyer shall */
/* indemnify and  hold  Freescale  and its officers, employees, subsidiaries,*/
/* affiliates,  and distributors harmless against all claims costs, damages, */
/* and expenses, and reasonable  attorney  fees arising  out of, directly or */
/* indirectly,  any claim of personal injury  or death  associated with such */
/* unintended or unauthorized use, even if such claim alleges that  Freescale*/
/* was negligent regarding the  design  or manufacture of the part. Freescale*/
/* and the Freescale logo* are registered trademarks of Freescale Ltd.       */
/*****************************************************************************/

#ifndef S12ECT16B8CV3_H       /*prevent duplicated includes */
#define S12ECT16B8CV3_H

#include "S12_COMMON.h"

typedef union uTIOS_E
  {
  tU08   byte; 
  struct
    {
    tU08 ios0  :1;      /*i/p capture(0) or o/p compare(1) select */
    tU08 ios1  :1;
    tU08 ios2  :1;
    tU08 ios3  :1;
    tU08 ios4  :1;
    tU08 ios5  :1;
    tU08 ios6  :1;
    tU08 ios7  :1;
    }bit;
  }tTIOS_E;

/* bit masks for TIOS */
#define IOS0   0x01  
#define IOS1   0x02
#define IOS2   0x04
#define IOS3   0x08
#define IOS4   0x10
#define IOS5   0x20
#define IOS6   0x40
#define IOS7   0x80

typedef union uCFORC_E
  {
  tU08   byte; 
  struct
    {
    tU08 foc0  :1;      /*force output compare, no interrupt flag */
    tU08 foc1  :1;
    tU08 foc2  :1;
    tU08 foc3  :1;
    tU08 foc4  :1;
    tU08 foc5  :1;
    tU08 foc6  :1;
    tU08 foc7  :1;
    }bit;
  }tCFORC_E;

/* bit masks for CFORC */
#define FOC0   0x01  
#define FOC1   0x02
#define FOC2   0x04
#define FOC3   0x08
#define FOC4   0x10
#define FOC5   0x20
#define FOC6   0x40
#define FOC7   0x80

typedef union uOC7M_E
  {
  tU08   byte; 
  struct
    {
    tU08 oc7m0 :1;      /*output compare 7 bit mask */
    tU08 oc7m1 :1;
    tU08 oc7m2 :1;
    tU08 oc7m3 :1;
    tU08 oc7m4 :1;
    tU08 oc7m5 :1;
    tU08 oc7m6 :1;
    tU08 oc7m7 :1;
    }bit;
  }tOC7M_E;

/* bit masks for OC7M */
#define OC7M0  0x01  
#define OC7M1  0x02
#define OC7M2  0x04
#define OC7M3  0x08
#define OC7M4  0x10
#define OC7M5  0x20
#define OC7M6  0x40
#define OC7M7  0x80

typedef union uOC7D_E
  {
  tU08   byte; 
  struct
    {
    tU08 oc7d0 :1;      /*output compare 7 data */
    tU08 oc7d1 :1;
    tU08 oc7d2 :1;
    tU08 oc7d3 :1;
    tU08 oc7d4 :1;
    tU08 oc7d5 :1;
    tU08 oc7d6 :1;
    tU08 oc7d7 :1;
    }bit;
  }tOC7D_E;

/* bit masks for OC7D */
#define OC7D0  0x01  
#define OC7D1  0x02
#define OC7D2  0x04
#define OC7D3  0x08
#define OC7D4  0x10
#define OC7D5  0x20
#define OC7D6  0x40
#define OC7D7  0x80

typedef union uTCNT_E
  {
  tU16   word;
  struct
    {
    tU08 tcnth;
    tU08 tcntl;
    }byte;
  }tTCNT_E;



typedef union uTSCR1_E
  {
  tU08   byte;
  struct
    {
    tU08       :3;      /*not used */
    tU08 prnt  :1;      /*precision prescaler enable */
    tU08 tffca :1;      /*timer fast flag clear all */
    tU08 tsfrz :1;      /*timer stops in background mode */
    tU08 tswai :1;      /*timer stops in wait mode */
    tU08 ten   :1;      /*timer enable */
    }bit;
  }tTSCR1_E;

/* bit masks for TSCR1 */
#define PRNT   0x08  
#define TFFCA  0x10  /
#define TSBCK  0x20
#define TSFRZ  0x20
#define TSWAI  0x40
#define TEN    0x80
#define tsbck tsfrz     /* bit name alternative in TSCR1 */

typedef union uTTOV_E     /*TOVx toggles output compare pin on overflow */
  {
  tU08   byte;
  struct
    {
    tU08 tov0  :1;      
    tU08 tov1  :1;      
    tU08 tov2  :1;      
    tU08 tov3  :1;       
    tU08 tov4  :1;       
    tU08 tov5  :1;       
    tU08 tov6  :1;       
    tU08 tov7  :1;
    }bit;
  }tTTOV_E;

#define TOV0   0x01  
#define TOV1   0x02
#define TOV2   0x04
#define TOV3   0x08
#define TOV4   0x10
#define TOV5   0x20
#define TOV6   0x40
#define TOV7   0x80

typedef union uTCTL1_E
  {
  tU08   byte;
  struct
    {
    tU08 ol4   :1;      /*output compare pin action */
    tU08 om4   :1;
    tU08 ol5   :1;      /*OMx:OLx -> action */
    tU08 om5   :1;      /* 0 : 0  -> disconnected from pin */
    tU08 ol6   :1;      /* 0 : 1  -> toggle OCx pin */
    tU08 om6   :1;      /* 1 : 0  -> clear OCx pin (0) */
    tU08 ol7   :1;      /* 1 : 1  -> set OCx pin (1) */
    tU08 om7   :1;
    }bit;
  }tTCTL1_E;

/* bit masks for TCTL1 */
#define OL4    0x01  
#define OM4    0x02
#define OL5    0x04
#define OM5    0x08
#define OL6    0x10
#define OM6    0x20
#define OL7    0x40
#define OM7    0x80

typedef union uTCTL2_E
  {
  tU08   byte;
  struct
    {
    tU08 ol0   :1;      /*output compare pin action */
    tU08 om0   :1;
    tU08 ol1   :1;      /*OMx:OLx -> action */
    tU08 om1   :1;      /* 0 : 0  -> disconnected from pin */
    tU08 ol2   :1;      /* 0 : 1  -> toggle OCx pin */
    tU08 om2   :1;      /* 1 : 0  -> clear OCx pin (0) */
    tU08 ol3   :1;      /* 1 : 1  -> set OCx pin (1) */
    tU08 om3   :1;
    }bit;
  }tTCTL2_E;

/* bit masks for TCTL2 */
#define OL0    0x01  
#define OM0    0x02
#define OL1    0x04
#define OM1    0x08
#define OL2    0x10
#define OM2    0x20
#define OL3    0x40
#define OM3    0x80

typedef union uTCTL3_E
  {
  tU08   byte;
  struct
    {
    tU08 edg4a :1;      /*input capture configuration */
    tU08 edg4b :1;
    tU08 edg5a :1;      /*EDGxB:EDGxA -> configuration */
    tU08 edg5b :1;      /*  0  :  0   -> capture disabled */
    tU08 edg6a :1;      /*  0  :  1   -> rising edge only */
    tU08 edg6b :1;      /*  1  :  0   -> falling edge only */
    tU08 edg7a :1;      /*  1  :  1   -> any edge */
    tU08 edg7b :1;
    }bit;
  }tTCTL3_E;

/* bit masks for TCTL3 */
#define EDG4A  0x01  
#define EDG4B  0x02
#define EDG5A  0x04
#define EDG5B  0x08
#define EDG6A  0x10
#define EDG6B  0x20
#define EDG7A  0x40
#define EDG7B  0x80

typedef union uTCTL4_E
  {
  tU08   byte;
  struct
    {
    tU08 edg0a :1;      /*input capture configuration */
    tU08 edg0b :1;
    tU08 edg1a :1;      /*EDGxB:EDGxA -> configuration */
    tU08 edg1b :1;      /*  0  :  0   -> capture disabled */
    tU08 edg2a :1;      /*  0  :  1   -> rising edge only */
    tU08 edg2b :1;      /*  1  :  0   -> falling edge only */
    tU08 edg3a :1;      /*  1  :  1   -> any edge */
    tU08 edg3b :1;
    }bit;
  }tTCTL4_E;

/* bit masks for TCTL4 */
#define EDG0A  0x01  
#define EDG0B  0x02
#define EDG1A  0x04
#define EDG1B  0x08
#define EDG2A  0x10
#define EDG2B  0x20
#define EDG3A  0x40
#define EDG3B  0x80

typedef union uTIE_E      /*On HC12 was TMSK1 */
  {
  tU08   byte;
  struct
    {
    tU08 c0i   :1;      /*capture/compare interrupt enable */
    tU08 c1i   :1;
    tU08 c2i   :1;
    tU08 c3i   :1;
    tU08 c4i   :1;
    tU08 c5i   :1;
    tU08 c6i   :1;
    tU08 c7i   :1;
    }bit;
  }tTIE_E;

/* bit masks for TIE */
#define C0I    0x01  
#define C1I    0x02
#define C2I    0x04
#define C3I    0x08
#define C4I    0x10
#define C5I    0x20
#define C6I    0x40
#define C7I    0x80

typedef union uTSCR2_E    /*On HC12 was TMSK2 */
  {
  tU08   byte;
  struct
    {
    tU08 pr    :3;      /*timer prescaler select */
                        /*prescale settings : 1,2,4,8,16,32 */ 
    tU08 tcre  :1;      /*timer counter reset enable (OC7) */ 
    tU08       :3;      /*not used */
    tU08 toi   :1;      /*timer overflow interrupt enable */ 
    }bit;

⌨️ 快捷键说明

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