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

📄 timer_a.lst

📁 瑞萨单片机LCD控制
💻 LST
📖 第 1 页 / 共 5 页
字号:
    123                                      // ||||       valid only if ext. trigger signal is
    124                                      // ||||       selected by event/trigger select bit
    125                                      // |||+------ 0: counts up or down according to UDF
    126                                      // |||           UDF bit 0 : downcount activated
    127                                      // |||           UDF bit 1 : upcount activated
    128                                      // |||        1: counts up or down according to 
    129                                      // |||           TA0out input signal
    130                                      // |||           TA0out "L": downcount activated
    131                                      // |||           TA0out "H": upcount activated
    132                                      // |||           TA0out must configured as input
    133                                      // ||+------- must always be 0 in event counter mode
    134                                      // |+-------- 0: count operation reload type
    135                                      // |          1: count operation free-run type
    136                                      // +--------- invalid in event counter mode
    137          
    138              UDF     |= 0x01;        // ---- ---X
   \   00001E   9F018403             OR.B    #1,900
    139                                      //         +- 0: timer A0 down count
    140                                      //            1: timer A0 up count
    141          
    142              ONSF    |= 0xC0;        // XX-- ----
   \   000022   9FC08203             OR.B    #192,898
    143                                      // |+-------- timer A0 event/trigger select bits
    144                                      // +--------- timer A0 event/trigger select bits
    145                                      //            00: input on TA0in (TA0in must be input)
    146                                      //            01: overflow of timer B2
    147                                      //            10: overflow of timer A4
    148                                      //            11: overflow of timer A1
    149          
    150          }
   \   000026   F3                   RTS     
   \                     timer_a0_init_one_shot_timer_mode:
    151          
    152          /**************************************************************************/
    153          /*                                                                        */
    154          /*       Timer A0 - Initialization for one shot timer mode                */
    155          /*       The timer counts once                                            */
    156          /*       routine may be customized to the user's needs                    */
    157          /*                                                                        */
    158          /*       Name         :      timer_a0_init_one_shot_timer_mode            */
    159          /*       Date/Author  :      08.04.1997/ST                                */
    160          /*       Parameter    :                                                   */
    161          /*       Return       :                                                   */
    162          /*                                                                        */
    163          /**************************************************************************/
    164          void near timer_a0_init_one_shot_timer_mode (void)
    165          {       
   \   000027   EC80                 PUSHM   R0
    166              TA0MR    = 0xC2;        // XX0X XX10 
   \   000029   74CF9603             MOV.B   #194,918
   \            C2      
    167                                      // |||| |||+- must always be 0 in one-shot timer mode
    168                                      // |||| ||+-- must always be 1 in one-shot timer mode
    169                                      // |||| |+--- 0: pulse is not output at pin TA0out
    170                                      // |||| |     1: pulse is output at pin TA0out
    171                                      // |||| |        TA0out is automatically output
    172                                      // |||| +---- 0: ext. trigger falling edge of
    173                                      // ||||          TA0in input signal
    174                                      // ||||       1: ext. trigger rising edge of
    175                                      // ||||          TA0in input signal
    176                                      // ||||       TA0in must be configured as input
    177                                      // ||||       TA0in must be selected by 
    178                                      // ||||       event/trigger select bit
    179                                      // |||+------ 0: trigger is one-shot start flag (ONSF)
    180                                      // |||        1: trigger is selected by event/trigger
    181                                      // |||           select bits
    182                                      // ||+------- must always be 0 in one-shot timer mode
    183                                      // |+-------- count source select bits
    184                                      // +--------- count source select bits
    185                                      //            00:  f1
    186                                      //            01:  f8
    187                                      //            10:  f32
    188                                      //            11:  fc32
    189          
    190              ONSF    |= 0x80;        // XX-- ---0
   \   00002E   9F808203             OR.B    #128,898
    191              ONSF    &= ~(0x01);     // ||      +- timer A0 one-shot start flag
   \   000032   97FE8203             AND.B   #254,898
    192                                      // |+-------- timer A0 event/trigger select bits
    193                                      // +--------- timer A0 event/trigger select bits
    194                                      //            00:  input on TA0in (must be input)
    195                                      //            01:  overflow of timer B2
    196                                      //            10:  overflow of timer A4
    197                                      //            11:  overflow of timer A1
    198          
    199              // Clock prescaler reset flag
    200              // This function is only effective if fc32 is selected
    201              if ((TA0MR & 0xC0)==0xC0)
   \   000036   74C0C0               MOV.B   #192,R0L
   \   000039   139603               AND.B   918,R0L
   \   00003C   7680C0               CMP.B   #192,R0L
   \   00003F   6E06                 JNE     ?0003
   \                     ?0002:
    202              {
    203                  CPSRF = 0x80;       // 1--- ----                                   
   \   000041   74CF8103             MOV.B   #128,897
   \            80      
   \                     ?0003:
    204                                      // +---------- 1: clock prescaler is reset 
    205              }
    206          }
   \   000046   ED01                 POPM    R0
   \   000048   F3                   RTS     
   \                     timer_a0_init_pwm_mode:
    207          
    208          /**************************************************************************/
    209          /*                                                                        */
    210          /*       Timer A0 - Initialization for pwm mode                           */
    211          /*       The timer outputs pulses of a given width                        */
    212          /*       routine may be customized to the user's needs                    */
    213          /*                                                                        */
    214          /*       Name         :      timer_a0_init_pwm_mode                       */
    215          /*       Date/Author  :      08.04.1997/ST                                */
    216          /*       Parameter    :                                                   */
    217          /*       Return       :                                                   */
    218          /*                                                                        */
    219          /**************************************************************************/
    220          void near timer_a0_init_pwm_mode (void)
    221          {       
   \   000049   EC80                 PUSHM   R0
    222              TA0MR    = 0x01;        // XXXX X111 
   \   00004B   C7019603             MOV.B   #1,918
    223                                      // |||| |||+- must always be 1 in pwm mode
    224                                      // |||| ||+-- must always be 1 in pwm mode
    225                                      // |||| |+--- must always be 1 in pwm mode
    226                                      // |||| +---- 0: ext. trigger falling edge of
    227                                      // ||||          TA0in input signal
    228                                      // ||||       1: ext. trigger rising edge of
    229                                      // ||||          TA0in input signal
    230                                      // ||||       TA0in must be configured as input
    231                                      // ||||       TA0in must be selected by 
    232                                      // ||||       event/trigger select bits
    233                                      // |||+------ 0: trigger is count start flag (TABSR)
    234                                      // |||        1: trigger is selected by event/trigger
    235                                      // |||           select bits
    236                                      // ||+------- 0: 16-bit pwm
    237                                      // ||         1:  8-bit pwm
    238                                      // |+-------- count source select bits:
    239                                      // +--------- count source select bits:
    240                                      //            00:  f1
    241                                      //            01:  f8
    242                                      //            10:  f32
    243                                      //            11:  fc32
    244          
    245              ONSF    |= 0xC0;        // XX-- ----
   \   00004F   9FC08203             OR.B    #192,898
    246                                      // |+-------- timer A0 event/trigger select bits
    247                                      // +--------- timer A0 event/trigger select bits
    248                                      //            00:  input on TA0in (must be input)
    249                                      //            01:  overflow of timer B2
    250                                      //            10:  overflow of timer A4
    251                                      //            11:  overflow of timer A1
    252          
    253              // Clock prescaler reset flag
    254              // This function is only effective if fc32 is selected
    255              if ((TA0MR & 0xC0)==0xC0)
   \   000053   74C0C0               MOV.B   #192,R0L
   \   000056   139603               AND.B   918,R0L
   \   000059   7680C0               CMP.B   #192,R0L
   \   00005C   6E06                 JNE     ?0005
   \                     ?0004:
    256              {
    257                  CPSRF = 0x80;       // 1--- ----                                   
   \   00005E   74CF8103             MOV.B   #128,897
   \            80      
   \                     ?0005:
    258                                      // +---------- 1: clock prescaler is reset 
    259              }
    260          }
   \   000063   ED01                 POPM    R0
   \   000065   F3                   RTS     
   \                     timer_a0_start:
    261          
    262          /**************************************************************************/
    263          /*                                                                        */
    264          /*       Timer A0 - start                                                 */
    265          /*       In following cases this routine takes no effect:                 */
    266          /*       - in one-shot timer mode if ext. trigger or timer overflow is    */
    267          /*         selected as start condition                                    */
    268          /*       - in pwm mode if external trigger or timer overflow is selected  */

⌨️ 快捷键说明

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