⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 111.s

📁 温度测量ds18b20.rar
💻 S
字号:
	.module _111.c
	.area text(rom, con, rel)
	.dbfile ..\..\..\..\PROTEU~2\5.avr\19.温度测量ds18b20\2.精确延时函数\111.c
	.dbfile D:\教程及心得\Proteus\PROTEU~2\5.avr\19.温度测量ds18b20\2.精确延时函数\111.c
	.dbfunc e delay0ms5us _delay0ms5us fV
	.even
_delay0ms5us::
	.dbline -1
	.dbline 10
; //ICC-AVR application builder : 2008/11/17 22:33:32
; // Target : M8
; // Crystal: 8.0000Mhz
; 
; #include <iom8v.h>
; #include <macros.h>
; #include "mydelay.h"
; #define uchar unsigned char
; void delay0ms5us(void)
; {
	.dbline 14
; /*精确延时0ms 5us ,晶振8MHz*/
; /*us级精确延时 766us/晶振以内 延时=1+n*3 */
; // CLI;//屏蔽中断
; asm("LDI R18,10");//1t ,寄存器R15~R30
	LDI R18,10
	.dbline 15
; asm("CLZ");//1t
	CLZ
	.dbline 16
; asm("LOOP1:DEC R18");//1t
	LOOP1:DEC R18
	.dbline 17
; asm("BRNE LOOP1");//1t或2t//标志位Z是0就转移
	BRNE LOOP1
	.dbline 18
; asm("NOP");//1t
	NOP
	.dbline 19
; asm("NOP");//1t
	NOP
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e port_init _port_init fV
	.even
_port_init::
	.dbline -1
	.dbline 27
; // SEI;
; /*us级精确延时 24543us以内,可用nop补足余数*/
; //===精确延时 4.125us,晶振8MHz ===//
; //===调用函数及返回花费0.875us==//
; }
; 
; void port_init(void)
; {
	.dbline 28
;  PORTB = 0x00;
	clr R2
	out 0x18,R2
	.dbline 29
;  DDRB  = 0x00;
	out 0x17,R2
	.dbline 30
;  PORTC = 0x00; //m103 output only
	out 0x15,R2
	.dbline 31
;  DDRC  = 0xff;
	ldi R24,255
	out 0x14,R24
	.dbline 32
;  PORTD = 0x00;
	out 0x12,R2
	.dbline 33
;  DDRD  = 0x00;
	out 0x11,R2
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e init_devices _init_devices fV
	.even
_init_devices::
	.dbline -1
	.dbline 38
; }
; 
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
	.dbline 40
;  //stop errant interrupts until set up
;  CLI(); //disable all interrupts
	cli
	.dbline 41
;  port_init();
	rcall _port_init
	.dbline 43
; 
;  MCUCR = 0x00;
	clr R2
	out 0x35,R2
	.dbline 44
;  GICR  = 0x00;
	out 0x3b,R2
	.dbline 45
;  TIMSK = 0x00; //timer interrupt sources
	out 0x39,R2
	.dbline 46
;  SEI(); //re-enable interrupts
	sei
	.dbline -2
L3:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e main _main fV
	.even
_main::
	.dbline -1
	.dbline 51
;  //all peripherals are now initialized
; }
; 
; void main(void)
; {
	.dbline 52
;   init_devices();
	rcall _init_devices
	.dbline 53
;   PORTC=0x00;
	clr R2
	out 0x15,R2
	.dbline 54
;   delay0ms900us();  
	rcall _delay0ms900us
	.dbline 55
;   PORTC=0xff;
	ldi R24,255
	out 0x15,R24
	.dbline -2
L4:
	.dbline 0 ; func end
	ret
	.dbend
; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -