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

📄 timer_a.lst

📁 瑞萨单片机LCD控制
💻 LST
📖 第 1 页 / 共 5 页
字号:
##############################################################################
#                                                                            #
# IAR M16C/60 C-Compiler V1.31B/WIN                                          #
#                                                                            #
#       Compile time  =  10/Apr/2000  22:46:16                               #
#       Memory model  =  near                                                #
#       Source file   =  d:\tolentino\sw_lcd_m16c\mini_emul\timer_a.c        #
#       List file     =  d:\tolentino\sw_lcd_m16c\mini_emul\ice\list\timer_a.lst#
#       Object file   =  d:\tolentino\sw_lcd_m16c\mini_emul\ice\obj\timer_a.r34#
#       Command line  =  -md -OD:\tolentino\Sw_lcd_M16c\Mini_emul\ice\Obj\   #
#                        -e -K -C -W16 -gA -RCODE -r0                        #
#                        -LD:\tolentino\Sw_lcd_M16c\Mini_emul\ice\List\ -q   #
#                        -t8 -ID:\SW\EW23\M16C\inc\                          #
#                        D:\tolentino\Sw_lcd_M16c\Mini_emul\TIMER_A.C        #
#                                                                            #
#                           Copyright 1999 IAR Systems. All rights reserved. #
##############################################################################

   \                     	NAME	timer_a(16)
   \                     	RSEG	CODE(1)
   \                     	PUBLIC	timer_a0_get
   \                     	PUBLIC	timer_a0_init_event_counter_mode
   \                     	PUBLIC	timer_a0_init_one_shot_timer_mode
   \                     	PUBLIC	timer_a0_init_pwm_mode
   \                     	PUBLIC	timer_a0_init_timer_mode
   \                     	PUBLIC	timer_a0_interrupt_clr
   \                     	PUBLIC	timer_a0_interrupt_set
   \                     	PUBLIC	timer_a0_set
   \                     	PUBLIC	timer_a0_start
   \                     	PUBLIC	timer_a0_stop
   \                     	PUBLIC	timer_a1_get
   \                     	PUBLIC	timer_a1_init_event_counter_mode
   \                     	PUBLIC	timer_a1_init_one_shot_timer_mode
   \                     	PUBLIC	timer_a1_init_pwm_mode
   \                     	PUBLIC	timer_a1_init_timer_mode
   \                     	PUBLIC	timer_a1_interrupt_clr
   \                     	PUBLIC	timer_a1_interrupt_set
   \                     	PUBLIC	timer_a1_set
   \                     	PUBLIC	timer_a1_start
   \                     	PUBLIC	timer_a1_stop
   \                     	EXTERN	?CLM16C_1_31_L00
   \                     	RSEG	CODE
   \                     timer_a0_init_timer_mode:
      1          /**************************************************************************/
      2          /**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**MITSUBISHI**/
      3          /**************************************************************************/
      4          /**************************************************************************/
      5          /*  DISCLAIMER:                                                           */
      6          /*  We (MITSUBISHI ELECTRIC B.V.) do not warrant that the Software is     */
      7          /*  free from claims by a third party of copyright, patent, trademark,    */
      8          /*  trade secret or any other intellectual property infringement.         */
      9          /*                                                                        */
     10          /*  Under no circumstances are we liable for any of the following:        */
     11          /*                                                                        */
     12          /*  1. third-party claims against you for losses or damages;              */
     13          /*  2. loss of, or damage to, your records or data; or                    */
     14          /*  3. economic consequential damages (including lost profits or          */
     15          /*     savings) or incidental damages, even if we are informed of         */
     16          /*     their possibility.                                                 */
     17          /*                                                                        */
     18          /*  We do not warrant uninterrupted or error free operation of the        */
     19          /*  Software. We have no obligation to provide service, defect            */
     20          /*  correction, or any maintenance for the Software. We have no           */
     21          /*  obligation to supply any Software updates or enhancements to you      */
     22          /*  even if such are or later become available.                           */
     23          /*                                                                        */
     24          /*  IF YOU DOWNLOAD OR USE THIS SOFTWARE YOU AGREE TO THESE TERMS.        */
     25          /*                                                                        */
     26          /*  THERE ARE NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING THE            */
     27          /*  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A               */
     28          /*  PARTICULAR PURPOSE.                                                   */
     29          /**************************************************************************/
     30          /**************************************************************************/
     31          /*                                                                        */
     32          /*       Timer A Initialization and Service-Routines for the M3060        */
     33          /*       Remarks: timer_value = (Xin*time_solution/clock_select)-1        */
     34          /*                For example: time_solution = 1ms                        */
     35          /*                             Xin = 10MHz                                */
     36          /*                             clock_select = 8 (source=f8)               */
     37          /*                                                                        */
     38          /*                         =>  timer_value = 1249d                        */
     39          /*                                                                        */
     40          /*       Name         :      TIMER_A.C                                    */
     41          /*       Date/Author  :      08.04.1997/ST                                */
     42          /*       Change       :                                                   */
     43          /*               (Date)  (Author)  (Description)                          */
     44          /*                                                                        */
     45          /**************************************************************************/
     46          
     47          #define public extern
     48          #include    "sfr_3061.h"
     49          #undef public
     50          
     51          #define public
     52          #include    "timer_a.h"
     53          #undef public
     54          
     55          
     56          /**************************************************************************/
     57          /*                                                                        */
     58          /*       Timer A0 - Initialization for Timer Mode                         */
     59          /*       The timer counts an internal count source                        */
     60          /*       routine may be customized to the user's needs                    */
     61          /*                                                                        */
     62          /*       Name         :      timer_a0_init_timer_mode                     */
     63          /*       Date/Author  :      08.04.1997/ST                                */
     64          /*       Parameter    :                                                   */
     65          /*       Return       :                                                   */
     66          /*                                                                        */
     67          /**************************************************************************/
     68          void near timer_a0_init_timer_mode (void)
     69          {       
   \   000000   EC80                 PUSHM   R0
     70              TA0MR    = 0x80;        // XX0X XX00 
   \   000002   74CF9603             MOV.B   #128,918
   \            80      
     71                                      // |||| |||+- must always be 0 in timer mode
     72                                      // |||| ||+-- must always be 0 in timer mode
     73                                      // |||| |+--- 0: pulse is not output at pin TA0out
     74                                      // |||| |     1: pulse is output at pin TA0out
     75                                      // |||| |        TA0out is automatically  output
     76                                      // |||| +---- 0: gate function: timer counts only 
     77                                      // ||||          when TA0in is held "L"
     78                                      // ||||       1: gate function: timer counts only
     79                                      // ||||          when TA0in is held "H"
     80                                      // |||+------ 0: gate function not available
     81                                      // |||        1: gate function available
     82                                      // ||+------- must always be 0 in timer mode
     83                                      // |+-------- count source select bits:
     84                                      // +--------- count source select bits:
     85                                      //            00:  f1
     86                                      //            01:  f8
     87                                      //            10:  f32
     88                                      //            11:  fc32
     89          
     90              // Clock prescaler reset flag
     91              // This function is only effective if fc32 is selected
     92              if ((TA0MR & 0xC0)==0xC0)
   \   000007   74C0C0               MOV.B   #192,R0L
   \   00000A   139603               AND.B   918,R0L
   \   00000D   7680C0               CMP.B   #192,R0L
   \   000010   6E06                 JNE     ?0001
   \                     ?0000:
     93              {
     94                  CPSRF = 0x80;       // 1--- ----                                   
   \   000012   74CF8103             MOV.B   #128,897
   \            80      
   \                     ?0001:
     95                                      // +---------- 1: clock prescaler is reset 
     96              }
     97          }
   \   000017   ED01                 POPM    R0
   \   000019   F3                   RTS     
   \                     timer_a0_init_event_counter_mode:
     98          
     99          /**************************************************************************/
    100          /*                                                                        */
    101          /*       Timer A0 - Initialization for event counter mode                 */
    102          /*       The timer counts pulses from an external source or another       */
    103          /*       timer's overflow.                                                */
    104          /*       routine may be customized to the user's needs                    */
    105          /*                                                                        */
    106          /*       Name         :      timer_a0_init_event_counter_mode             */
    107          /*       Date/Author  :      08.04.1997/ST                                */
    108          /*       Parameter    :                                                   */
    109          /*       Return       :                                                   */
    110          /*                                                                        */
    111          /**************************************************************************/
    112          void near timer_a0_init_event_counter_mode (void)
    113          {       
    114              TA0MR    = 0x01;        // -X0X XX01 
   \   00001A   C7019603             MOV.B   #1,918
    115                                      // |||| |||+- must always be 1 in event counter mode
    116                                      // |||| ||+-- must always be 0 in event counter mode
    117                                      // |||| |+--- 0: pulse is not output at pin TA0out
    118                                      // |||| |     1: pulse is output at pin TA0out at
    119                                      // |||| |        overflow/underflow
    120                                      // |||| |        TA0out is automatically output
    121                                      // |||| +---- 0: counts ext. signal's falling edge
    122                                      // ||||       1: counts ext. signal's rising edge

⌨️ 快捷键说明

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