📄 delay.asm
字号:
/* ***********************************************************************
**
** Copyright (C) 2002 Jesper Hansen <jesperh@telia.com> and
** Romuald Bialy (MIS) <romek_b@o2.pl>.
**
**
** Yampp-7/USB - low level support library
**
**
*************************************************************************
**
** This file is part of the yampp system.
**
** This program is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License
** as published by the Free Software Foundation; either version 2
** of the License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation,
** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
*************************************************************************
**
** Revision History
**
** when what who why
**
** 2002-09-22 1.0 MIS initial public release
**
*********************************************************************** */
#include "Constants.h"
;********************************************************************
;*
;* Delay stuff
;*
;********************************************************************
;
;void delay10(void)
#define LOOPS (((F_CPU / 100000) - 8) / 3)
.global delay10
delay10:
ldi r24,LOOPS ; 1 cycle
d10l: dec r24 ; 1 cycle
brne d10l ; 2 (1) cycle
ret ; + 8 cycles for call and ret
;void delay100(void)
.global delay100
delay100:
ldi r25,10
d100l: rcall delay10
dec r25
brne d100l
ret
; r25/r24
;void delayms(u16 ms)
.global delayms
delayms:
push r24
push r25
ldi r25,100
del1m: rcall delay10
dec r25
brne del1m
wdr
pop r25
pop r24
sbiw r24,1
brne delayms
ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -