📄 timer8_1.lis
字号:
0000 ;
0000 ; where INT_MSKN is INT_MSK0 or INT_MSK1 and
0000 ; MASK is the bit set to enable or disable
0000 ;-------------------------------------------------
0000 ; Disable Interrupt Bit Mask(s)
0000 macro M8C_DisableIntMask
0000 if DISABLE_INT_FIX
0000 mov A, reg[CPU_SCR] ; save the current Global interrupt state
0000 M8C_DisableGInt ; disable global interrupts
0000 endif
0000 and reg[@0], ~@1 ; disable specified interrupt enable bit
0000 if DISABLE_INT_FIX
0000 and A, CPUSCR_GIEMask ; determine if global interrupt was set
0000 jz . + 4 ; jump if global interrupt disabled
0000 M8C_EnableGInt ; set global interrupt
0000 endif
0000 macro M8C_EnableIntMask
0000 or reg[@0], @1
0000 macro M8C_EnableWatchDog
0000 ; Clearing the Power-On Reset bit starts up the Watchdog timer
0000 ; See the 25xxx/26xxx Family Datasheet, Section 9.3.4.
0000 and reg[CPU_SCR], ~CPUSCR_PORSMask & ~CPUSCR_WDRSMask
0000 macro M8C_ClearWDT
0000 mov reg[RES_WDT], 00h
0000 macro M8C_ClearWDTAndSleep
0000 mov reg[RES_WDT], 38h
0000 macro M8C_Stall
0000 or reg[ASY_CR], ASY_CR_SYNCEN
0000 macro M8C_Unstall
0000 and reg[ASY_CR], ~ASY_CR_SYNCEN
0000 macro M8C_Sleep
0000 or reg[CPU_SCR], CPUSCR_SleepMask
0000 ; The next instruction to be executed depends on the state of the
0000 ; various interrupt enable bits. If some interrupts are enabled
0000 ; and the global interrupts are disabled, the next instruction will
0000 ; be the one that follows the invocation of this macro. If global
0000 ; interrupts are also enabled then the next instruction will be
0000 ; from the interrupt vector table. If no interrupts are enabled
0000 ; then RIP.
0000 macro M8C_Stop
0000 ; In general, you probably don't want to do this, but here's how:
0000 or reg[CPU_SCR], CPUSCR_StopMask
0000 ; Next instruction to be executed is located in the interrupt
0000 ; vector table entry for Power-On Reset.
0000 macro M8C_Reset
0000 ; Restore everything to the power-on reset state.
0000 mov A, 0
0000 SSC
0000 ; Next non-supervisor instruction will be at interrupt vector 0.
0000 macro SSC
0000 db 0
0001 bTimer8_1_INT_MASK: equ 01h
0000 ;timer8 interrupt address
00E1 Timer8_1_INT_REG: equ 0e1h
0000
0000 ;---------------------------------
0000 ; Registers used by timer8
0000 ;---------------------------------
0023 Timer8_1_CONTROL_REG: equ 23h ;Control register
0020 Timer8_1_COUNTER_REG: equ 20h ;Counter register
0021 Timer8_1_PERIOD_REG: equ 21h ;Period value register
0022 Timer8_1_COMPARE_REG: equ 22h ;CompareValue register
0020 Timer8_1_FUNC_REG: equ 20h ;Function register
0021 Timer8_1_INPUT_REG: equ 21h ;Input register
0022 Timer8_1_OUTPUT_REG: equ 22h ;Output register
0000
0000 ; end of file
0000
0000
area text (ROM, REL)
;-------------------------------------------------------------------
; Declare the functions global for both assembler and C compiler.
;
; Note that there are two names for each API. First name is
; assembler reference. Name with underscore is name refence for
; C compiler. Calling function in C source code does not require
; the underscore.
;-------------------------------------------------------------------
export Timer8_1_EnableInt
export _Timer8_1_EnableInt
export Timer8_1_DisableInt
export _Timer8_1_DisableInt
export Timer8_1_Start
export _Timer8_1_Start
export Timer8_1_Stop
export _Timer8_1_Stop
export Timer8_1_WritePeriod
export _Timer8_1_WritePeriod
export Timer8_1_WriteCompareValue
export _Timer8_1_WriteCompareValue
export bTimer8_1_ReadCompareValue
export _bTimer8_1_ReadCompareValue
export bTimer8_1_ReadTimer
export _bTimer8_1_ReadTimer
export bTimer8_1_ReadTimerSaveCV
export _bTimer8_1_ReadTimerSaveCV
export bTimer8_1_ReadCounter ; obsolete
export _bTimer8_1_ReadCounter ; obsolete
export bTimer8_1_CaptureCounter ; obsolete
export _bTimer8_1_CaptureCounter ; obsolete
;-----------
; EQUATES
;-----------
0001 bfCONTROL_REG_START_BIT: equ 1 ; Control register start bit
0000
0000 ;-----------------------------------------------------------------------------
0000 ; FUNCTION NAME: Timer8_1_EnableInt
0000 ;
0000 ; DESCRIPTION:
0000 ; Enables this Timer's interrupt by setting the interrupt enable mask bit
0000 ; associated with this User Module. Remember to call the global interrupt
0000 ; enable function by using the macro: M8C_EnableGInt.
0000 ;
0000 ; ARGUMENTS:
0000 ; none.
0000 ;
0000 ; RETURNS:
0000 ; none.
0000 ;
0000 ; SIDE EFFECTS:
0000 ; none.
0000 ;
0000 ; THEORY of OPERATION:
0000 ; Sets the specific user module interrupt enable mask bit.
0000 ;
0000 ;-----------------------------------------------------------------------------
0000 Timer8_1_EnableInt:
0000 _Timer8_1_EnableInt:
0000 43E101 or reg[Timer8_1_INT_REG], bTimer8_1_INT_MASK
0003 7F ret
0004
0004
0004 ;-----------------------------------------------------------------------------
0004 ; FUNCTION NAME: Timer8_1_DisableInt
0004 ;
0004 ; DESCRIPTION:
0004 ; Disables this timer's interrupt by clearing the interrupt enable mask bit
0004 ; associated with this User Module.
0004 ;
0004 ; ARGUMENTS:
0004 ; none.
0004 ;
0004 ; RETURNS:
0004 ; none.
0004 ;
0004 ; SIDE EFFECTS:
0004 ; none.
0004 ;
0004 ; THEORY of OPERATION:
0004 ; Clears the specific user module interrupt enable mask bit.
0004 ;
0004 ;-----------------------------------------------------------------------------
0004 Timer8_1_DisableInt:
0004 _Timer8_1_DisableInt:
if DISABLE_INT_FIX
0004 5DFF mov A, reg[CPU_SCR] ; save the current Global interrupt state
0006 70FE and F, ~FlagGlobalIE
endif
0008 41E1FE and reg[Timer8_1_INT_REG], ~bTimer8_1_INT_MASK ; disable specified interrupt enable bit
if DISABLE_INT_FIX
000B 2180 and A, CPUSCR_GIEMask ; determine if global interrupt was set
000D A003 jz . + 4 ; jump if global interrupt disabled
000F 7101 or F, FlagGlobalIE
endif
0011 7F ret
0012
0012
0012 ;-----------------------------------------------------------------------------
0012 ; FUNCTION NAME: Timer8_1_Start
0012 ;
0012 ; DESCRIPTION:
0012 ; Sets the start bit in the Control register of this user module. The
0012 ; timer will begin counting on the next input clock.
0012 ;
0012 ; ARGUMENTS:
0012 ; none.
0012 ;
0012 ; RETURNS:
0012 ; none.
0012 ;
0012 ; SIDE EFFECTS:
0012 ; none.
0012 ;
0012 ; THEORY of OPERATION:
0012 ; Set the start bit in the Control register.
0012 ;
0012 ;-----------------------------------------------------------------------------
0012 Timer8_1_Start:
0012 _Timer8_1_Start:
0012 432301 or REG[Timer8_1_CONTROL_REG], bfCONTROL_REG_START_BIT
0015 7F ret
0016
0016
0016 ;-----------------------------------------------------------------------------
0016 ; FUNCTION NAME: Timer8_1_Stop
0016 ;
0016 ; DESCRIPTION:
0016 ; Disables Timer operation.
0016 ;
0016 ; ARGUMENTS:
0016 ; none.
0016 ;
0016 ; RETURNS:
0016 ; none.
0016 ;
0016 ; SIDE EFFECTS:
0016 ; After this function completes, the Counter register will latch any data
0016 ; written to the Period register. Writing to the Period register is
0016 ; performed using the Timer8_1_WritePeriod function.
0016 ;
0016 ; THEORY of OPERATION:
0016 ; Clear the start bit in the Control register.
0016 ;
0016 ;-----------------------------------------------------------------------------
0016 Timer8_1_Stop:
0016 _Timer8_1_Stop:
0016 4123FE and REG[Timer8_1_CONTROL_REG], ~bfCONTROL_REG_START_BIT
0019 7F ret
001A
001A
001A ;-----------------------------------------------------------------------------
001A ; FUNCTION NAME: Timer8_1_WritePeriod
001A ;
001A ; DESCRIPTION:
001A ; Write the period value into the Period register.
001A ;
001A ; ARGUMENTS:
001A ; BYTE bPeriodValue - period count - passed in the Accumulator.
001A ;
001A ; RETURNS:
001A ; none.
001A ;
001A ; SIDE EFFECTS:
001A ; If the Timer user module is stopped, then this value will also be
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -