📄 delay.inc
字号:
; extern Delay50us, Delay250us, Delay500us, Delay2ms, Delay4ms, Delay1ms, Delay350us, Delay400us, Delay_15ms, Delay_15ms, Delay_50ms, Delay_100ms, Delay_500ms
#define Delay.Returned Delay.flag,3
extern Delay.flag, Delay.Start8, Delay.Start16, Delay.Wait, Delay.CounterL, Delay.CounterH
;------------------------------------------------------------------------------+
; |
; Delay.Returned Delay.Mikros( Delay.CounterH w ) |
; |
;------------------------------------------------------------------------------+
; |
; This function starts a delay routine with the given time in us. |
; Appropriate values are multiples of 50 us up to a maximum of ~3.27 |
; seconds. |
; To wait for the counter to finish call Delay.Wait |
; |
; |
; Parameters: |
; Delay.CounterH - The high byte of the multiplicator |
; w - The low byte of the multiplicator |
; |
; |
; Returns: |
; Delay.Returned - 1 if counter is zero, 0 otherwise |
; |
; |
; Used SFRs: INTCON T0CON |
; |
; |
; Calls subroutines: |
; Delay.Start8 |
; Delay.Start16 |
; |
; |
; Stacklevel: 1 |
; |
; |
; Example: |
; banksel PORTB |
; bsf PORTB,0 |
; Delay.Mikros .50000 |
; call Delay.Wait ;waits untill the 50ms are over |
; banksel PORTB |
; bcf PORTB,0 |
; |
; |
; Description: |
; This sets Pin RB0 high for approx. 50 ms |
; |
;------------------------------------------------------------------------------+
Delay.Mikros macro time
if (time/.50) > 0xFFFF
error "The requested delay time exceeds the capability of this module (0xFFFF * 50us)"
else
if (time/.50) < .256
movlw (time/.50)
call Delay.Start8
else
if ((low (time/.50)) == .0)
movlw (high (time/.50))
else
movlw ((high (time/.50))+1)
endif
movwf Delay.CounterH
movlw low (time/.50)
call Delay.Start16
endif
endif
endm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -