📄 pwm8_1.lis
字号:
0012 ; enable input is asserted high.
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 PWM8_1_Start:
0012 _PWM8_1_Start:
0012 433301 or REG[PWM8_1_CONTROL_REG], bfCONTROL_REG_START_BIT
0015 7F ret
0016
0016
0016 ;-----------------------------------------------------------------------------
0016 ; FUNCTION NAME: PWM8_1_Stop
0016 ;
0016 ; DESCRIPTION:
0016 ; Disables PWM 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 PWM8_1_WritePeriod function.
0016 ;
0016 ; THEORY of OPERATION:
0016 ; Clear the start bit in the Control register.
0016 ;
0016 ;-----------------------------------------------------------------------------
0016 PWM8_1_Stop:
0016 _PWM8_1_Stop:
0016 4133FE and REG[PWM8_1_CONTROL_REG], ~bfCONTROL_REG_START_BIT
0019 7F ret
001A
001A
001A ;-----------------------------------------------------------------------------
001A ; FUNCTION NAME: PWM8_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 PWM user module is stopped, then this value will also be
001A ; latched into the Counter register.
001A ;
001A ; THEORY of OPERATION:
001A ; Write data into the Period register.
001A ;
001A ;-----------------------------------------------------------------------------
001A PWM8_1_WritePeriod:
001A _PWM8_1_WritePeriod:
001A 493301 tst REG[PWM8_1_CONTROL_REG], bfCONTROL_REG_START_BIT
001D B019 jnz .CounterRunning
001F
001F ; Counter is stopped. Due to chip errata, we have to set the clock low for
001F ; the write to the period register to cause the data to be immediately transferred
001F ; into the Counter.
001F .CounterStopped:
001F 10 push X
0020 5C mov X, A ; save the period argument
0021 7110 or F, FlagXIOMask
0023 5D31 mov A, REG[PWM8_1_INPUT_REG] ; save the context of the clock - input register
0025 08 push A
0026 4131F0 and REG[PWM8_1_INPUT_REG], F0h ; set the clock signal low
0029 70EF and F, ~FlagXIOMask
002B 5B mov A, X
002C 6031 mov REG[PWM8_1_PERIOD_REG], A ; set the period register with the new period
002E 18 pop A
002F 7110 or F, FlagXIOMask
0031 6031 mov REG[PWM8_1_INPUT_REG], A ; restore the clock
0033 70EF and F, ~FlagXIOMask
0035 20 pop X
0036 7F ret
0037
0037 ; Counter is running - write the period into the period register.
0037 ; Upon Terminal Count this value will get loaded into the counter.
0037 .CounterRunning:
0037 6031 mov REG[PWM8_1_PERIOD_REG], A
0039 7F ret
003A
003A
003A ;-----------------------------------------------------------------------------
003A ; FUNCTION NAME: PWM8_1_WritePulseWidth
003A ;
003A ; DESCRIPTION:
003A ; Writes compare value into the PulseWidth register.
003A ;
003A ; ARGUMENTS:
003A ; BYTE bPWidthValue - Pulse Width value count - passed in Accumulator.
003A ;
003A ; RETURNS:
003A ; none.
003A ;
003A ; SIDE EFFECTS:
003A ; none.
003A ;
003A ; THEORY of OPERATION:
003A ; Write data into the PulseWidth register.
003A ;
003A ;-----------------------------------------------------------------------------
003A PWM8_1_WritePulseWidth:
003A _PWM8_1_WritePulseWidth:
003A 6032 mov REG[PWM8_1_PWIDTH_REG], A
003C 7F ret
003D
003D
003D ;-----------------------------------------------------------------------------
003D ; FUNCTION NAME: bPWM8_1_ReadPulseWidth
003D ;
003D ; DESCRIPTION:
003D ; Reads the PulseWidth register.
003D ;
003D ; ARGUMENTS:
003D ; none.
003D ;
003D ; RETURNS:
003D ; BYTE bPulseWidth - value read from PulseWidth register - returned
003D ; in the Accumulator.
003D ;
003D ; SIDE EFFECTS:
003D ; none.
003D ;
003D ; THEORY of OPERATION:
003D ; Read the PulseWidth register and return value in A.
003D ;
003D ;-----------------------------------------------------------------------------
003D bPWM8_1_ReadPulseWidth:
003D _bPWM8_1_ReadPulseWidth:
003D 5D32 mov A, REG[PWM8_1_PWIDTH_REG]
003F 7F ret
0040
0040
0040 ;-----------------------------------------------------------------------------
0040 ; FUNCTION NAME: bPWM8_1_ReadCounter
0040 ;
0040 ; DESCRIPTION:
0040 ; Reads the count in the Counter register.
0040 ;
0040 ; ARGUMENTS:
0040 ; none.
0040 ;
0040 ; RETURNS:
0040 ; BYTE bCount - current count value in Count register.
0040 ;
0040 ; SIDE EFFECTS:
0040 ; Reading the Counter register may cause the Counter register to miss
0040 ; one or more counts due to the fact that the clock is stopped while
0040 ; the Counter register is read. The preferred method is to use the
0040 ; interrupt feature to determine when the counter has arrived at a
0040 ; specified value.
0040 ;
0040 ; THEORY of OPERATION:
0040 ; Reading the Counter register causes its value to be latched into the
0040 ; CompareValue register. Care must be taken to stop the clock and save
0040 ; the CompareValue register's contents before reading the counter.
0040
0040 ;-----------------------------------------------------------------------------
0040 bPWM8_1_ReadCounter:
0040 _bPWM8_1_ReadCounter:
0040
0040 ; save the input register clock setting
0040 7110 or F, FlagXIOMask
0042 5D31 mov A, REG[PWM8_1_INPUT_REG]
0044 08 push A
0045 ; disable the clock
0045 4131F0 and REG[PWM8_1_INPUT_REG], ~bfINPUT_REG_CLOCK_MASK
0048 70EF and F, ~FlagXIOMask
004A
004A ; save the PulseWidth register value
004A 5D32 mov A, REG[PWM8_1_PWIDTH_REG]
004C 08 push A
004D ; Read the counter. This latches the counter data into
004D ; the PulseWidth register. This may cause an interrupt.
004D 5D30 mov A, REG[PWM8_1_COUNTER_REG]
004F ; Read the PulseWidth register, which contains the counter value
004F 5D32 mov A, REG[PWM8_1_PWIDTH_REG]
0051 ; Save the counter value in X
0051 5C mov X, A
0052 ; Restore the PulseWidth register
0052 18 pop A
0053 6032 mov REG[PWM8_1_PWIDTH_REG], A
0055
0055 ; restore the input register clock setting
0055 7110 or F, FlagXIOMask
0057 18 pop A
0058 6031 mov REG[PWM8_1_INPUT_REG], A
005A 70EF and F, ~FlagXIOMask
005C
005C ; Get the saved read counter value
005C 5B mov A, X
005D
005D 7F ret
005E
005E ; end of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -