📄 delay.c
字号:
/******************************************************************************
File Name : Delay.c
Author : Rene Trenado
Location : Motorola Applications Lab, Baja California
Date Created : July 2000
Current Revision : 0.0
Notes : This file contains the code for a variable Delay function
*******************************************************************************/
#include "delay.h"
BYTE delayCounter;
/***********************************************************************
Function : Delay
Parameters : A Byte containing the number of times __Delay will be
called
Date : July 2000
Desc : This function blocks the CPU in multiples of _Delay times
***********************************************************************/
void Delay (register BYTE times) {
_Delay();
}
/***********************************************************************
Assembly Function : __1msDelay
Parameters : None
Date : July 2000
Desc : This function blocks the CPU in multiples of 1.3mSecs
delayCount specifies the time base
__1msDelay = delayCounter x 1.3 mSec
***********************************************************************/
#asm
xref.b _delayCounter
xdef __Delay
BUSFREQ: EQU 2
_1msDelay:
PSHA ;2 cycles
LDA #BUSFREQ ;2
DLLoop: DBNZA DLSub ;3
BRA DLDone ;3
DLSub:
MOV #$FF,_delayCounter ;4
Here:
DBNZ _delayCounter,Here ;5
BRA DLLoop ;3
DLDone: PULA ;2
RTS ;4
/***********************************************************************
Function : _Delay
Parameters : A Byte containing the number of times a base delay will be
called
Date : July 2000
Desc : This function blocks the CPU in multiples (Acc value) of
delay times
***********************************************************************/
__Delay:
JSR _1msDelay
DBNZA __Delay
RTS
#endasm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -