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

📄 test2.s

📁 Atmega128的proteus仿真例程
💻 S
字号:
	.module test2.c
	.area data(ram, con, rel)
_LED1::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
	.dbsym e LED1 _LED1 c
_LED2::
	.blkb 1
	.area idata
	.byte 0
	.area data(ram, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
	.dbsym e LED2 _LED2 c
	.area text(rom, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
	.dbfunc e uart0_init _uart0_init fV
	.even
_uart0_init::
	.dbline -1
	.dbline 40
; 
; #define Test1_GLOBALS
; #include "includes.h"
; 
; 
; #define BitSet(a,b)     (a |= (1<<b)) 
; #define BitClr(a,b)     (a &= ~(1<<b))
; #define	BitStatus(a,b)  (a&BIT(b))
; #define uchar unsigned char
; 
; #define LED1_ON   BitClr(PORTB,4)
; #define LED1_OFF  BitSet(PORTB,4)
; #define LED2_ON   BitClr(PORTB,5)
; #define LED2_OFF  BitSet(PORTB,5)
; 
; //******************************************************************************
; // Constants
; #define TaskStartPrio	10		// Task-Prioritaeten
; //*****************************************************************************
; // Variablen
; //INT8U    display[5];
; char LED1=0,LED2=0;
; OS_STK	Task1Stack[OS_TASK_DEF_STK_SIZE];		// startup task stack
; OS_STK	Task2Stack[OS_TASK_DEF_STK_SIZE];
; //ICC-AVR application builder : 2003-12-28 21:52:56
; // Target : M8
; // Crystal: 8.0000Mhz
; 
; #include <iom128v.h>
; #include <macros.h>
; #include <stdio.h>
; 
; 
; //UART0 initialisation
; // desired baud rate: 9600
; // actual: baud rate:9615 (0.2%)
; // char size: 8 bit
; // parity: Disabled
; void uart0_init(void)
; {
	.dbline 41
;  UCSR0B = 0x00; //disable while setting baud rate
	clr R2
	out 0xa,R2
	.dbline 42
;  UCSR0A = 0x00;
	out 0xb,R2
	.dbline 43
;  UCSR0C = 0x86;
	ldi R24,134
	sts 149,R24
	.dbline 44
;  UBRR0L = 0x33; //set baud rate lo
	ldi R24,51
	out 0x9,R24
	.dbline 45
;  UBRR0H = 0x00; //set baud rate hi
	sts 144,R2
	.dbline 46
;  UCSR0B = 0x08;
	ldi R24,8
	out 0xa,R24
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e TC2_Init _TC2_Init fV
	.even
_TC2_Init::
	.dbline -1
	.dbline 64
;  
;  /*UCSR0B = 0x00; //disable while setting baud rate
;  UCSR0A = 0x00;
;  UCSR0C = 0x06;
;  UBRR0L = 0x33; //set baud rate lo
;  UBRR0H = 0x00; //set baud rate hi
;  UCSR0B = 0x00;
;  */
; }
; 
; //*****************************************************************************
; // Prototypes
; 
; //*****************************************************************************
; //			TickISR
; //*****************************************************************************
; // Init Timer/Counter2 fuer Takterzeugung
; void TC2_Init (void){	
	.dbline 68
; 	/* Only uses TIMER2 overflow for tick interrupt. Timer compare
;      * can also be used.
;      */
; 	TIMSK &= ~(BIT(TOIE2)/* | BIT(OCIE2) */);	//disable TC2 interrupts
	in R24,0x37
	andi R24,191
	out 0x37,R24
	.dbline 69
; 	TCCR2 = 0x00; //stop
	clr R2
	out 0x25,R2
	.dbline 70
;     TCNT2 = 0x06; //setup
	ldi R24,6
	out 0x24,R24
	.dbline 71
;     OCR2  = 0xFA;
	ldi R24,250
	out 0x23,R24
	.dbline 72
;     TCCR2 = 0x03; //start
	ldi R24,3
	out 0x25,R24
	.dbline 73
; 	TIMSK |= BIT(TOIE2);	// enable OVF-interrupt
	in R24,0x37
	ori R24,64
	out 0x37,R24
	.dbline 76
; 	                                                                                                                                //TIMSK |= OCIE2;		// enable COMP-interrupt
; 	
;     SEI();	// enable global interrupt     
	sei
	.dbline -2
L3:
	.dbline 0 ; func end
	ret
	.dbend
	.area vector(rom, abs)
	.org 40
	jmp _OSTickISR
	.area text(rom, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
	.dbfunc e main _main fV
	.even
_main::
	sbiw R28,3
	.dbline -1
	.dbline 89
; }
; 
; //*****************************************************************************
; // Interrupt Timer/Counter0 Overflow
; // OVF_Takt:  4MHz / 1024 / 39 = 10ms
; #pragma interrupt_handler OSTickISR:11
; 
; void Task1(void *pdata);
; void Task2(void *pdata);
; 
; //*****************************************************************************
; // Start
; void main(void){	
	.dbline 90
; 	OSInit();		// OS init
	xcall _OSInit
	.dbline 91
; 	uart0_init();
	xcall _uart0_init
	.dbline 92
; 	puts("ATmega128 uc/os-II Test!");
	ldi R16,<L5
	ldi R17,>L5
	xcall _puts
	.dbline 93
; 	putchar(0x0d);
	ldi R16,13
	xcall _putchar
	.dbline 94
; 	putchar(0x0a);
	ldi R16,10
	xcall _putchar
	.dbline 96
; 	
; 	OSTaskCreate(Task1,	(void *)0, &Task1Stack[OS_TASK_DEF_STK_SIZE-1],	7);
	ldi R24,7
	std y+2,R24
	ldi R24,<_Task1Stack+99
	ldi R25,>_Task1Stack+99
	std y+1,R25
	std y+0,R24
	clr R18
	clr R19
	ldi R16,<PL_Task1
	ldi R17,>PL_Task1
	xcall _OSTaskCreate
	.dbline 98
; 	
; 	OSTaskCreate(Task2,	(void *)0, &Task2Stack[OS_TASK_DEF_STK_SIZE-1],	8); 
	ldi R24,8
	std y+2,R24
	ldi R24,<_Task2Stack+99
	ldi R25,>_Task2Stack+99
	std y+1,R25
	std y+0,R24
	clr R18
	clr R19
	ldi R16,<PL_Task2
	ldi R17,>PL_Task2
	xcall _OSTaskCreate
	.dbline 100
; 	// init und start tick
;     TC2_Init();			// Timer/Counter#2 Overflow and Comp init   
	xcall _TC2_Init
	.dbline 101
;     OSStart();		// start multitasking
	xcall _OSStart
	.dbline -2
L4:
	adiw R28,3
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Task1 _Task1 fV
;           data -> R10,R11
	.even
_Task1::
	xcall push_gset3x
	movw R10,R16
	.dbline -1
	.dbline 105
; }
; 
; void Task1(void *data)
; {
	.dbline 106
;   data = data;
	.dbline 107
;   PORTB|=0x10;
	sbi 0x18,4
	.dbline 108
;   DDRB|=0x10;
	sbi 0x17,4
	xjmp L10
L9:
	.dbline 110
;   while(1)
;   {
	.dbline 111
;   puts("Task1");
	ldi R16,<L12
	ldi R17,>L12
	xcall _puts
	.dbline 112
;   putchar(0x0d);
	ldi R16,13
	xcall _putchar
	.dbline 113
;   putchar(0x0a);
	ldi R16,10
	xcall _putchar
	.dbline 114
;   if(LED1==0)
	lds R2,_LED1
	tst R2
	brne L13
	.dbline 115
;   {
	.dbline 116
;      LED1=1;
	ldi R24,1
	sts _LED1,R24
	.dbline 117
; 	 LED1_ON;
	cbi 0x18,4
	.dbline 118
;   }
	xjmp L14
L13:
	.dbline 120
;   else
;   {
	.dbline 121
;      LED1=0;
	clr R2
	sts _LED1,R2
	.dbline 122
; 	 LED1_OFF;
	sbi 0x18,4
	.dbline 123
;   }
L14:
	.dbline 124
	ldi R16,500
	ldi R17,1
	xcall _OSTimeDly
	.dbline 125
L10:
	.dbline 109
	xjmp L9
X0:
	.dbline -2
L8:
	xcall pop_gset3x
	.dbline 0 ; func end
	ret
	.dbsym r data 10 pV
	.dbend
	.dbfunc e Task2 _Task2 fV
;           data -> R10,R11
	.even
_Task2::
	xcall push_gset3x
	movw R10,R16
	.dbline -1
	.dbline 128
;   OSTimeDly (500);//延时1秒
;   }
; }
; void Task2(void *data)
; {
	.dbline 129
;   data = data;
	.dbline 130
;   PORTB|=0x20;
	sbi 0x18,5
	.dbline 131
;   DDRB|=0x20;
	sbi 0x17,5
	xjmp L17
L16:
	.dbline 133
;   while(1)
;   {
	.dbline 134
;   puts("Task2");
	ldi R16,<L19
	ldi R17,>L19
	xcall _puts
	.dbline 135
;   putchar(0x0d);
	ldi R16,13
	xcall _putchar
	.dbline 136
;   putchar(0x0a);
	ldi R16,10
	xcall _putchar
	.dbline 137
;   if(LED2==0)
	lds R2,_LED2
	tst R2
	brne L20
	.dbline 138
;   {
	.dbline 139
;      LED2=1;
	ldi R24,1
	sts _LED2,R24
	.dbline 140
; 	 LED2_ON;
	cbi 0x18,5
	.dbline 141
;   }
	xjmp L21
L20:
	.dbline 143
;   else
;   {
	.dbline 144
;      LED2=0;
	clr R2
	sts _LED2,R2
	.dbline 145
; 	 LED2_OFF;
	sbi 0x18,5
	.dbline 146
;   }
L21:
	.dbline 147
	ldi R16,1000
	ldi R17,3
	xcall _OSTimeDly
	.dbline 148
L17:
	.dbline 132
	xjmp L16
X1:
	.dbline -2
L15:
	xcall pop_gset3x
	.dbline 0 ; func end
	ret
	.dbsym r data 10 pV
	.dbend
	.area bss(ram, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
_Task2Stack::
	.blkb 100
	.dbsym e Task2Stack _Task2Stack A[100:100]c
_Task1Stack::
	.blkb 100
	.dbsym e Task1Stack _Task1Stack A[100:100]c
	.area data(ram, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
L19:
	.blkb 6
	.area idata
	.byte 'T,'a,'s,'k,50,0
	.area data(ram, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
L12:
	.blkb 6
	.area idata
	.byte 'T,'a,'s,'k,49,0
	.area data(ram, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
L5:
	.blkb 25
	.area idata
	.byte 'A,'T,'m,'e,'g,'a,49,50,56,32,'u,'c,47,'o,'s,45
	.byte 'I,'I,32,'T,'e,'s,'t,33,0
	.area data(ram, con, rel)
	.dbfile D:\MTD\work\iccavr\ucos-M128\test\test2.c
	.area func_lit
PL_Task2:	.word `_Task2
PL_Task1:	.word `_Task1

⌨️ 快捷键说明

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