📄 mod6_cnt.asm
字号:
;===========================================================================
; File Name: mod6_cnt.asm
;
; Module Name: MOD6_CNT
;
; Initialization Routine: MOD6_CNT_INIT
;
; Originator: Digital Control Systems Group
; Texas Instruments
;
; Description: This module implements a modulo 6 counter. It counts from
; state 0 through 5, then resets to 0 and repeats the process.
; The state of the output variable m6_cntr changes to the next
; state every time it receives a trigger input through the input
; variable m6_trig_in.
;
; |~~~~~~~~~~~~~~~|
; | |
; m6_trig_in o------>| MOD6_CNT |----->o m6_cntr
; | |
; |_______________|
;
;
;
;=====================================================================================
; History:
;-------------------------------------------------------------------------------------
; 9-15-2000 Release Rev 1.0
;===========================================================================
;(To use this Module, copy this section to main system file)
; .ref MOD6_CNT, MOD6_CNT_INIT ;function call
; .ref m6_trig_in, m6_cntr ;Inputs
;===========================================================================
;Module definitions for external reference.
.def MOD6_CNT, MOD6_CNT_INIT ;function call
.def m6_trig_in, m6_cntr ;Inputs
;===========================================================================
.include x24x_app.h
;===========================================================================
;Variable Definitions for mod6_cnt module
;---------------------------------------------------------------------------
;m6_cntr .usect "mod6_cnt",1 ;Mod 6 counter output
;m6_trig_in .usect "mod6_cnt",1 ;Mod 6 counter trigger input
m6_cntr_vars .usect "mod6_cnt",2,1
m6_cntr .set m6_cntr_vars+0 ;Mod 6 counter output
m6_trig_in .set m6_cntr_vars+1 ;Mod 6 counter trigger input
;======================================================================
MOD6_CNT_INIT:
;======================================================================
LDP #m6_cntr
SPLK #0h, m6_cntr
SPLK #0h, m6_trig_in
RET
;======================================================================
MOD6_CNT:
;======================================================================
LDP #m6_cntr
LACC m6_trig_in
BCND M6C_END, EQ ;If no trigger exit
CHK_STATE: LACC m6_cntr
SUB #05h ;Check if at last state
BCND M6_RST_ST0,EQ ;If yes, re-init ptr to 1st state
LACC m6_cntr ;If not, select next State (Sn->Sn+1)
ADD #01h
SACL m6_cntr ;i.e. inc commutation_ptr
B M6C_END
M6_RST_ST0:
SPLK #0h, m6_cntr ;Reset state pointer to 0
M6C_END:
RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -