timera.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_TIMERA_H__
00002 #define __MSP430WARE_TIMERA_H__
00003 
00004 #define __MSP430_HAS_TxA7__
00005 //*****************************************************************************
00006 //
00007 //The following are values that can be passed to the
00008 //TimerA_startContinuousMode();, TimerA_startUpMode();, TimerA_startUpDownMode();,
00009 //TimerA_generatePWM(); APIs as the clockSource parameter.
00010 //
00011 //*****************************************************************************
00012 #define TIMERA_CLOCKSOURCE_EXTERNAL_TXCLK            TASSEL__TACLK
00013 #define TIMERA_CLOCKSOURCE_ACLK                      TASSEL__ACLK
00014 #define TIMERA_CLOCKSOURCE_SMCLK                     TASSEL__SMCLK
00015 #define TIMERA_CLOCKSOURCE_INVERTED_EXTERNAL_TXCLK   TASSEL__INCLK
00016 
00017 //*****************************************************************************
00018 //
00019 //The following are values that can be passed to the
00020 //TimerA_startContinuousMode();, TimerA_startUpMode();, TimerA_startUpDownMode();,
00021 //TimerA_generatePWM(); APIs as the clockSourceDivider parameter.
00022 //
00023 //*****************************************************************************
00024 #define TIMERA_CLOCKSOURCE_DIVIDER_1     0x01
00025 #define TIMERA_CLOCKSOURCE_DIVIDER_2     0x02
00026 #define TIMERA_CLOCKSOURCE_DIVIDER_4     0x04
00027 #define TIMERA_CLOCKSOURCE_DIVIDER_8     0x08
00028 #define TIMERA_CLOCKSOURCE_DIVIDER_3     0x03
00029 #define TIMERA_CLOCKSOURCE_DIVIDER_5     0x05
00030 #define TIMERA_CLOCKSOURCE_DIVIDER_6     0x06
00031 #define TIMERA_CLOCKSOURCE_DIVIDER_7     0x07
00032 #define TIMERA_CLOCKSOURCE_DIVIDER_10    0x0A
00033 #define TIMERA_CLOCKSOURCE_DIVIDER_12    0x0C
00034 #define TIMERA_CLOCKSOURCE_DIVIDER_14    0x0E
00035 #define TIMERA_CLOCKSOURCE_DIVIDER_16    0x10
00036 #define TIMERA_CLOCKSOURCE_DIVIDER_20    0x14
00037 #define TIMERA_CLOCKSOURCE_DIVIDER_24    0x18
00038 #define TIMERA_CLOCKSOURCE_DIVIDER_28    0x1C
00039 #define TIMERA_CLOCKSOURCE_DIVIDER_32    0x20
00040 #define TIMERA_CLOCKSOURCE_DIVIDER_40    0x28
00041 #define TIMERA_CLOCKSOURCE_DIVIDER_48    0x30
00042 #define TIMERA_CLOCKSOURCE_DIVIDER_56    0x38
00043 #define TIMERA_CLOCKSOURCE_DIVIDER_64    0x40
00044 
00045 //*****************************************************************************
00046 //
00047 //The following are values that can be passed to TimerA_startContinuousMode();
00048 //TimerA_startUpMode();,  TimerA_startUpDownMode(); as the timerClear parameter.
00049 //
00050 //*****************************************************************************
00051 #define TIMERA_DO_CLEAR      TACLR
00052 #define TIMERA_SKIP_CLEAR    0x00
00053 
00054 //*****************************************************************************
00055 //
00056 //The following are values that can be passed to the
00057 //TimerA_getSynchronizedCaptureCompareInput(); API as the synchronized
00058 //parameter.
00059 //
00060 //*****************************************************************************
00061 #define TIMERA_CAPTURECOMPARE_INPUT                  SCCI
00062 #define TIMERA_SYNCHRONIZED_CAPTURECOMPARE_INPUT     CCI
00063 
00064 //*****************************************************************************
00065 //
00066 //The following are values that is returned by the
00067 //TimerA_getSynchronizedCaptureCompareInput(); API
00068 //
00069 //*****************************************************************************
00070 #define TIMERA_CAPTURECOMPARE_INPUT_HIGH    0x01
00071 #define TIMERA_CAPTURECOMPARE_INPUT_LOW     0x00
00072 
00073 
00074 //*****************************************************************************
00075 //
00076 //The following are values that is returned by the
00077 //TimerA_getOutputForOutputModeOutBitValue(); and passed to
00078 //TimerA_setOutputForOutputModeOutBitValue(); as
00079 //outputModeOutBitValue parameter
00080 //
00081 //*****************************************************************************
00082 #define TIMERA_OUTPUTMODE_OUTBITVALUE_HIGH    OUT
00083 #define TIMERA_OUTPUTMODE_OUTBITVALUE_LOW     0x00
00084 
00085 //*****************************************************************************
00086 //
00087 //The following are values can be passed to the mask parameter of
00088 //TimerA_captureCompareInterruptStatus(); API
00089 //
00090 //*****************************************************************************
00091 #define TIMERA_CAPTURE_OVERFLOW                  COV
00092 #define TIMERA_CAPTURECOMPARE_INTERRUPT_FLAG     CCIFG
00093 
00094 //*****************************************************************************
00095 //
00096 //The following are values can be passed to the timerInterruptEnable_TAIE
00097 //parameter of TimerA_startContinuousMode();, TimerA_startUpMode();,
00098 //TimerA_startUpDownMode();
00099 //
00100 //*****************************************************************************
00101 #define TIMERA_TAIE_INTERRUPT_ENABLE            TAIE
00102 #define TIMERA_TAIE_INTERRUPT_DISABLE           0x00
00103 
00104 //*****************************************************************************
00105 //
00106 //The following are values can be passed to the
00107 //captureCompareInterruptEnable_CCR0_CCIE parameter of TimerA_startUpMode();,
00108 //TimerA_startUpDownMode API
00109 //
00110 //*****************************************************************************
00111 #define TIMERA_CCIE_CCR0_INTERRUPT_ENABLE   CCIE
00112 #define TIMERA_CCIE_CCR0_INTERRUPT_DISABLE  0x00
00113 
00114 //*****************************************************************************
00115 //
00116 //The following are timer modes possible.
00117 //
00118 //*****************************************************************************
00119 #define TIMERA_STOP_MODE         MC_0
00120 #define TIMERA_UP_MODE           MC_1
00121 #define TIMERA_CONTINUOUS_MODE   MC_2
00122 #define TIMERA_UPDOWN_MODE       MC_3
00123 
00124 //*****************************************************************************
00125 //
00126 //The following are values can be passed to the
00127 //compareRegister, captureCompareRegister or captureRegister parameter
00128 //of TimerA_initCapture();, TimerA_enableCaptureCompareInterrupt();,
00129 //TimerA_disableCaptureCompareInterrupt();,TimerA_captureCompareInterruptStatus();,
00130 //TimerA_getSynchronizedCaptureCompareInput();,TimerA_initCompare();
00131 //
00132 //*****************************************************************************
00133 #define TIMERA_CAPTURECOMPARE_REGISTER_0     0x02
00134 #define TIMERA_CAPTURECOMPARE_REGISTER_1     0x04
00135 #define TIMERA_CAPTURECOMPARE_REGISTER_2     0x06
00136 #define TIMERA_CAPTURECOMPARE_REGISTER_3     0x08
00137 #define TIMERA_CAPTURECOMPARE_REGISTER_4     0x0A
00138 #define TIMERA_CAPTURECOMPARE_REGISTER_5     0x0C
00139 #define TIMERA_CAPTURECOMPARE_REGISTER_6     0x0E
00140 
00141 //*****************************************************************************
00142 //
00143 //The following are values can be passed to the
00144 //captureMode parameter of TimerA_initCompare();, TimerA_initCapture();,
00145 //TimerA_generatePWM();,
00146 //
00147 //*****************************************************************************
00148 #define TIMERA_OUTPUTMODE_OUTBITVALUE        OUTMOD_0
00149 #define TIMERA_OUTPUTMODE_SET                OUTMOD_1
00150 #define TIMERA_OUTPUTMODE_TOGGLE_RESET       OUTMOD_2
00151 #define TIMERA_OUTPUTMODE_SET_RESET          OUTMOD_3
00152 #define TIMERA_OUTPUTMODE_TOGGLE             OUTMOD_4
00153 #define TIMERA_OUTPUTMODE_RESET              OUTMOD_5
00154 #define TIMERA_OUTPUTMODE_TOGGLE_SET         OUTMOD_6
00155 #define TIMERA_OUTPUTMODE_RESET_SET          OUTMOD_7
00156 
00157 //*****************************************************************************
00158 //
00159 //The following are values can be passed to the
00160 //captureMode parameter of TimerA_initCapture(); API
00161 //
00162 //*****************************************************************************
00163 #define TIMERA_CAPTUREMODE_NO_CAPTURE                CM_0
00164 #define TIMERA_CAPTUREMODE_RISING_EDGE               CM_1
00165 #define TIMERA_CAPTUREMODE_FALLING_EDGE              CM_2
00166 #define TIMERA_CAPTUREMODE_RISING_AND_FALLING_EDGE   CM_3
00167 
00168 //*****************************************************************************
00169 //
00170 //The following are values can be passed to the
00171 //synchronizeCaptureSource parameter of TimerA_initCapture(); API
00172 //
00173 //*****************************************************************************
00174 #define TIMERA_CAPTURE_ASYNCHRONOUS                  0x00
00175 #define TIMERA_CAPTURE_SYNCHRONOUS                   SCS
00176 
00177 //*****************************************************************************
00178 //
00179 //The following are values can be passed to the
00180 //captureInterruptEnable, compareInterruptEnable parameter of
00181 //TimerA_initCapture(); API
00182 //
00183 //*****************************************************************************
00184 #define TIMERA_CAPTURECOMPARE_INTERRUPT_ENABLE       CCIE
00185 #define TIMERA_CAPTURECOMPARE_INTERRUPT_DISABLE      0x00
00186 
00187 //*****************************************************************************
00188 //
00189 //The following are values can be passed to the
00190 //captureInputSelect parameter of TimerA_initCapture(); API
00191 //
00192 //*****************************************************************************
00193 #define TIMERA_CAPTURE_INPUTSELECT_CCIxA             CCIS_0
00194 #define TIMERA_CAPTURE_INPUTSELECT_CCIxB             CCIS_1
00195 #define TIMERA_CAPTURE_INPUTSELECT_GND               CCIS_2
00196 #define TIMERA_CAPTURE_INPUTSELECT_Vcc               CCIS_3
00197 
00198 //*****************************************************************************
00199 //
00200 //The following are values that may be returned by
00201 //TimerA_getInterruptStatus(); API
00202 //
00203 //*****************************************************************************
00204 #define TIMERA_INTERRUPT_NOT_PENDING     0x00
00205 #define TIMERA_INTERRUPT_PENDING         0x01
00206 
00207 //*****************************************************************************
00208 //
00209 //The following are values can be passed to the
00210 //synchronized parameter of TimerA_getSynchronizedCaptureCompareInput(); API
00211 //
00212 //*****************************************************************************
00213 #define TIMERA_READ_SYNCHRONIZED_CAPTURECOMPAREINPUT SCCI
00214 #define TIMERA_READ_CAPTURE_COMPARE_INPUT            CCI
00215 
00216 //*****************************************************************************
00217 //
00218 //Prototypes for the APIs.
00219 //
00220 //*****************************************************************************
00221 extern void TimerA_startCounter ( unsigned int baseAddress,
00222     unsigned int timerMode
00223     );
00224 extern void TimerA_configureContinuousMode ( unsigned int baseAddress,
00225     unsigned int clockSource,
00226     unsigned int clockSourceDivider,
00227     unsigned int timerInterruptEnable_TAIE,
00228     unsigned int timerClear
00229     );
00230 extern void TimerA_configureUpMode (   unsigned int baseAddress,
00231     unsigned int clockSource,
00232     unsigned int clockSourceDivider,
00233     unsigned int timerPeriod,
00234     unsigned int timerInterruptEnable_TAIE,
00235     unsigned int captureCompareInterruptEnable_CCR0_CCIE,
00236     unsigned int timerClear
00237     );
00238 extern void TimerA_configureUpDownMode (
00239     unsigned int baseAddress,
00240     unsigned int clockSource,
00241     unsigned int clockSourceDivider,
00242     unsigned int timerPeriod,
00243     unsigned int timerInterruptEnable_TAIE,
00244     unsigned int captureCompareInterruptEnable_CCR0_CCIE,
00245     unsigned int timerClear
00246     );
00247 extern void TimerA_startContinuousMode ( unsigned int baseAddress,
00248     unsigned int clockSource,
00249     unsigned int clockSourceDivider,
00250     unsigned int timerInterruptEnable_TAIE,
00251     unsigned int timerClear
00252     );
00253 extern void TimerA_startContinousMode ( unsigned int baseAddress,
00254     unsigned int clockSource,
00255     unsigned int clockSourceDivider,
00256     unsigned int timerInterruptEnable_TAIE,
00257     unsigned int timerClear
00258     );
00259 extern void TimerA_startUpMode (   unsigned int baseAddress,
00260     unsigned int clockSource,
00261     unsigned int clockSourceDivider,
00262     unsigned int timerPeriod,
00263     unsigned int timerInterruptEnable_TAIE,
00264     unsigned int captureCompareInterruptEnable_CCR0_CCIE,
00265     unsigned int timerClear
00266     );
00267 extern void TimerA_startUpDownMode (
00268     unsigned int baseAddress,
00269     unsigned int clockSource,
00270     unsigned int clockSourceDivider,
00271     unsigned int timerPeriod,
00272     unsigned int timerInterruptEnable_TAIE,
00273     unsigned int captureCompareInterruptEnable_CCR0_CCIE,
00274     unsigned int timerClear
00275     );
00276 extern void TimerA_initCapture (unsigned int baseAddress,
00277     unsigned int captureRegister,
00278     unsigned int captureMode,
00279     unsigned int captureInputSelect,
00280     unsigned short synchronizeCaptureSource,
00281     unsigned short captureInterruptEnable,
00282     unsigned int captureOutputMode
00283     );
00284 extern void TimerA_initCompare (  unsigned int baseAddress,
00285     unsigned int compareRegister,
00286     unsigned short compareInterruptEnable,
00287     unsigned int compareOutputMode,
00288     unsigned int compareValue
00289     );
00290 extern void TimerA_enableInterrupt (unsigned int baseAddress);
00291 extern void TimerA_disableInterrupt (unsigned int baseAddress);
00292 extern unsigned long TimerA_getInterruptStatus (unsigned int baseAddress);
00293 extern void TimerA_enableCaptureCompareInterrupt (unsigned int baseAddress,
00294     unsigned int captureCompareRegister
00295     );
00296 extern void TimerA_disableCaptureCompareInterrupt (unsigned int baseAddress,
00297     unsigned int captureCompareRegister
00298     );
00299 extern unsigned long TimerA_getCaptureCompareInterruptStatus (unsigned int baseAddress,
00300                  unsigned int captureCompareRegister,
00301                  unsigned int mask
00302                  );
00303 extern void TimerA_clear (unsigned int baseAddress);
00304 extern unsigned short TimerA_getSynchronizedCaptureCompareInput
00305     (unsigned int baseAddress,
00306     unsigned int captureCompareRegister,
00307     unsigned short synchronized
00308     );
00309 extern unsigned char TimerA_getOutputForOutputModeOutBitValue
00310     (unsigned int baseAddress,
00311     unsigned int captureCompareRegister
00312     );
00313 extern unsigned int TimerA_getCaptureCompareCount
00314     (unsigned int baseAddress,
00315     unsigned int captureCompareRegister
00316     );
00317 extern void TimerA_setOutputForOutputModeOutBitValue
00318     (unsigned int baseAddress,
00319     unsigned int captureCompareRegister,
00320     unsigned char outputModeOutBitValue
00321     );
00322 extern void TimerA_generatePWM (  unsigned int baseAddress,
00323     unsigned int clockSource,
00324     unsigned int clockSourceDivider,
00325     unsigned int timerPeriod,
00326     unsigned int compareRegister,
00327     unsigned int compareOutputMode,
00328     unsigned int dutyCycle
00329     );
00330 extern void TimerA_stop ( unsigned int baseAddress );
00331 extern void TimerA_setCompareValue (  unsigned int baseAddress,
00332     unsigned int compareRegister,
00333     unsigned int compareValue
00334     );
00335 extern void TimerA_clearTimerInterruptFlag (unsigned int baseAddress);
00336 extern void TimerA_clearCaptureCompareInterruptFlag (unsigned int baseAddress,
00337     unsigned int captureCompareRegister
00338     );
00339 #endif

Copyright 2012, Texas Instruments Incorporated