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

📄 mega8.s

📁 AVR 初学者
💻 S
字号:
	.module mega8.c
	.area text(rom, con, rel)
	.dbfile E:\单片机\单片机程序\AVR程序\闪烁灯\mega8.c
	.dbfunc e port_init _port_init fV
	.even
_port_init::
	.dbline -1
	.dbline 9
; //ICC-AVR application builder : 2008-8-1 19:01:17
; // Target : M8
; // Crystal: 16.000Mhz
; 
; #include <iom8v.h>
; #include <macros.h>
; 
; void port_init(void)
; {
	.dbline 10
;  PORTB = 0x00;
	clr R2
	out 0x18,R2
	.dbline 11
;  DDRB  = 0x00;
	out 0x17,R2
	.dbline 12
;  PORTC = 0x00; //m103 output only
	out 0x15,R2
	.dbline 13
;  DDRC  = 0x7F;
	ldi R24,127
	out 0x14,R24
	.dbline 14
;  PORTD = 0x00;
	out 0x12,R2
	.dbline 15
;  DDRD  = 0x00;
	out 0x11,R2
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e init_devices _init_devices fV
	.even
_init_devices::
	.dbline -1
	.dbline 20
; }
; 
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
	.dbline 22
;  //stop errant interrupts until set up
;  CLI(); //disable all interrupts
	cli
	.dbline 23
;  port_init();
	rcall _port_init
	.dbline 25
; 
;  MCUCR = 0x00;
	clr R2
	out 0x35,R2
	.dbline 26
;  GICR  = 0x00;
	out 0x3b,R2
	.dbline 27
;  TIMSK = 0x00; //timer interrupt sources
	out 0x39,R2
	.dbline 28
;  SEI(); //re-enable interrupts
	sei
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e main _main fV
;              K -> <dead>
;              i -> R20,R21
;              j -> R22,R23
	.even
_main::
	.dbline -1
	.dbline 33
;  //all peripherals are now initialized
; }
; 
; void main()
; {
	.dbline 35
;   unsigned int i,j,K;
;   init_devices();
	rcall _init_devices
	.dbline 36
;   PORTC = 0X2A;
	ldi R24,42
	out 0x15,R24
	rjmp L5
L4:
	.dbline 38
;   while(1)
;   {
	.dbline 39
;     for(i=0;i<500;i++)
	clr R20
	clr R21
	rjmp L10
L7:
	.dbline 40
	clr R22
	clr R23
	rjmp L14
L11:
	.dbline 40
L12:
	.dbline 40
	subi R22,255  ; offset = 1
	sbci R23,255
L14:
	.dbline 40
	cpi R22,44
	ldi R30,1
	cpc R23,R30
	brlo L11
L8:
	.dbline 39
	subi R20,255  ; offset = 1
	sbci R21,255
L10:
	.dbline 39
	cpi R20,244
	ldi R30,1
	cpc R21,R30
	brlo L7
	.dbline 41
	in R2,0x15
	com R2
	out 0x15,R2
	.dbline 42
L5:
	.dbline 37
	rjmp L4
X0:
	.dbline -2
L3:
	.dbline 0 ; func end
	ret
	.dbsym l K 1 i
	.dbsym r i 20 i
	.dbsym r j 22 i
	.dbend

⌨️ 快捷键说明

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