📄 app.s
字号:
.module app.c
.area vector(rom, abs)
.org 64
jmp _OSTickISR
.org 72
jmp _uart0_rx_isr
.org 76
jmp _uart0_udre_isr
.org 120
jmp _uart1_rx_isr
.org 124
jmp _uart1_udre_isr
.area text(rom, con, rel)
.dbfile D:\编写软件小系统\纯ucos\source\app.c
.dbfunc e BeeIO _BeeIO fV
.even
_BeeIO::
.dbline -1
.dbline 46
; /*******************************************************************************
; *************************** * Copyright : COPYRIGHT(C) 1997-2005
;
;
; * Project Name : UCOS2纯系统
; * File name :
; * Crystal : 16MHZ
; * PCB P/N :
; * Comments :
; * SoftWareP/N :
; * ----------< History >---------------------------------------------------------
;
; * File Version : 1.0
; * Author : jjx
; * E-Mail :
; * Date : 2008 10 08
; * Comments :
; *******************************************************************************/
;
; #include "includes.h"
; #include "Publics.H"
;
; //在os_cfg.h中作修改
; #define OS_TASK_START_STK_SIZE OS_TASK_STK_SIZE
; #define OS_TASK_START_HARD_STK_SIZE OS_TASK_HARD_STK_SIZE
;
; OS_STK AppTaskStartStk[OS_TASK_START_STK_SIZE];
;
;
; /*
; **************************************************************************************************************
; * FUNCTION PROTOTYPES
; **************************************************************************************************************
; */
;
;
; static void AppTaskStart (void *p_arg);
; static void AppTaskCreate(void);
; static void AppIOInit(void);
;
; void watchdog_init(void);
;
;
;
; void BeeIO(void)
; {
.dbline 47
; PORTB&=~(1<<PB5);
cbi 0x18,5
.dbline 49
; //PORTB|=1<<PB5;
; DDRB|=1<<PB5;
sbi 0x17,5
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e timer1_init _timer1_init fV
.even
_timer1_init::
.dbline -1
.dbline 53
; }
;
; void timer1_init(void) //接15脚,OC1A,为定时器T/C1
; {
.dbline 54
; TCCR1B=0x00; //关闭
clr R2
out 0x2e,R2
.dbline 56
; //TCCR3B = 0x00; //stop
; OCR1AH = 0x00; //16位的比较PWM高位
out 0x2b,R2
.dbline 65
; //OCR3AH = 0x00;
; //OCR3AL = 0xe6; //2 k
; //OCR3AL = 0x99; //3 k
; //OCR3AL = 0x73; //4 k
; //OCR3AL = 0x5c; //5 k
; //OCR3AL = 0x4c; //6 k
; //OCR1AL = 0x41;
; //OCR1AL = 0x89;
; OCR1AL = 0xe6;
ldi R24,230
out 0x2a,R24
.dbline 70
; //OCR1AL = 0x73; //7 k形 //16位的比较PWM低位
; //OCR3AL = 0x39; //8 k
; //OCR3AL = 0x33; //9 k
; //OCR3AL = 0x2e; //10 k
; TCCR1A=0x40; //CTC模式
ldi R24,64
out 0x2f,R24
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
; temp -> y+0
; ko -> R20
; it -> R20
.even
_main::
sbiw R28,1
.dbline -1
.dbline 83
; }
;
; /*
; **************************************************************************************************************
; * MAIN
; *
; * Note(s): 1) You SHOULD use OS_TASK_STK_SIZE (see OS_CFG.H) when setting OSTaskStkSize prior to calling
; * OSInit() because OS_TASK_IDLE_STK_SIZE and OS_TASK_STAT_STK_SIZE are set to this value in
; * OS_CFG.H.
; **************************************************************************************************************
; */
; void main (void)
; {
.dbline 84
; INT8U it =0;
clr R20
.dbline 85
; INT8U ko=0;
.dbline 88
;
; INT8U temp; // IMPORTANT: MUST be setup before calling 'OSInit()'
; OSTaskStkSize = OS_TASK_STK_SIZE; // Setup the default stack size
ldi R24,256
ldi R25,1
sts _OSTaskStkSize+1,R25
sts _OSTaskStkSize,R24
.dbline 89
; OSTaskHardStkSize = OS_TASK_HARD_STK_SIZE; // Setup the default hardware stack size
ldi R24,64
ldi R25,0
sts _OSTaskHardStkSize+1,R25
sts _OSTaskHardStkSize,R24
.dbline 90
; AppIOInit();
xcall _AppIOInit
.dbline 92
;
; BeeIO();
xcall _BeeIO
.dbline 93
; timer1_init();
xcall _timer1_init
.dbline 96
;
;
; OSInit(); // Initialize "uC/OS-II, The Real-Time Kernel"
xcall _OSInit
.dbline 97
; watchdog_init();
xcall _watchdog_init
.dbline 102
;
; //---- Any initialization code before starting multitasking --------------//
;
; // View_Pic(aVfdDispRAM1,DisplayBuff1,1);
; AppTaskCreate();
xcall _AppTaskCreate
.dbline 103
; AppTaskStart(&temp);
movw R16,R28
xcall _AppTaskStart
.dbline 106
;
; //---- Create any other task you want before we start multitasking -------//
; WDR();
wdr
.dbline 108
;
; OSStart(); //Start multitasking (i.e. give control to uC/OS-II)
xcall _OSStart
.dbline -2
L3:
adiw R28,1
.dbline 0 ; func end
ret
.dbsym l temp 0 c
.dbsym r ko 20 c
.dbsym r it 20 c
.dbend
.dbfunc s AppTaskStart _AppTaskStart fV
; p_arg -> R20,R21
.even
_AppTaskStart:
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 124
; }
; /*
; *********************************************************************************************************
; * STARTUP TASK
; *
; * Description : This is an example of a startup task. As mentioned in the book's text, you MUST
; * initialize the ticker only once multitasking has started.
; *
; * Arguments : p_arg is the argument passed to 'AppStartTask()' by 'OSTaskCreate()'.
; *
; * Notes : 1) The first line of code is used to prevent a compiler warning because 'p_arg' is not
; * used. The compiler should not generate any code for this statement.
; *********************************************************************************************************
; */
; static void AppTaskStart (void *p_arg)
; {
.dbline 125
; p_arg = p_arg; // Prevent compiler warnings
.dbline 126
; OSTickISR_Init(); // Initialize the ticker
xcall _OSTickISR_Init
.dbline -2
L4:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r p_arg 20 pV
.dbend
.dbfunc s AppTaskCreate _AppTaskCreate fV
.even
_AppTaskCreate:
.dbline -1
.dbline 141
; }
; /*
; *********************************************************************************************************
; * CREATE APPLICATION TASKS
; *
; * Description : This function creates the application tasks.
; *
; * Arguments : p_arg is the argument passed to 'AppStartTask()' by 'OSTaskCreate()'.
; *
; * Notes : 1) The first line of code is used to prevent a compiler warning because 'p_arg' is not
; * used. The compiler should not generate any code for this statement.
; *********************************************************************************************************
; */
; static void AppTaskCreate (void)
; {
.dbline 142
; Init_AppTask1(); //任务1初始化
xcall _Init_AppTask1
.dbline 143
; Init_AppTask2(); //任务2初始化
xcall _Init_AppTask2
.dbline 144
; Init_AppTask6(); //任务6初始化
xcall _Init_AppTask6
.dbline 145
; Init_AppTask8(); //任务8初始化
xcall _Init_AppTask8
.dbline -2
L5:
.dbline 0 ; func end
ret
.dbend
.dbfunc e OSTickISR_Init _OSTickISR_Init fV
.even
_OSTickISR_Init::
.dbline -1
.dbline 152
; }
;
; //----------------------------------------------------------------------------//
; //SETUP THE TICK RATE //中断在os_cpu_a.s上做定义并与ucos系统相结合
; //----------------------------------------------------------------------------//
; void OSTickISR_Init (void)
; {
.dbline 153
; TCNT0 =0;
clr R2
out 0x32,R2
.dbline 154
; TCCR0 = 0x07; // Set TIMER0 prescaler to CLK/1024
ldi R24,7
out 0x33,R24
.dbline 155
; TIMSK = 0x01; // Enable TIMER0 overflow interrupt
ldi R24,1
out 0x37,R24
.dbline -2
L6:
.dbline 0 ; func end
ret
.dbend
.dbfunc e OSTickISR_Handler _OSTickISR_Handler fV
.even
_OSTickISR_Handler::
.dbline -1
.dbline 161
; }
; //----------------------------------------------------------------------------//
; // SETUP THE TICK RATE
; //----------------------------------------------------------------------------//
; void OSTickISR_Handler (void)
; {
.dbline 162
; TCNT0 = 0x64; //100HZ
ldi R24,100
out 0x32,R24
.dbline 163
; OSTimeTick();
xcall _OSTimeTick
.dbline -2
L7:
.dbline 0 ; func end
ret
.dbend
.dbfunc e watchdog_init _watchdog_init fV
.even
_watchdog_init::
.dbline -1
.dbline 172
; }
; //----------------------------------------------------------------------------//
; //函数介绍: 看门狗初始化 (prescale: 2048K cycles = 2s)
; //输入参数:--
; // 输出参数:--
; //返 回 值:--
; //----------------------------------------------------------------------------//
; void watchdog_init(void)
; {
.dbline 173
; WDR();
wdr
.dbline 174
; WDTCR = (1<<WDCE)|(1<<WDE);
ldi R24,24
out 0x21,R24
.dbline 175
; WDTCR = (1<<WDE)|(1<<WDP2)|(1<<WDP1)|(1<<WDP0);
ldi R24,15
out 0x21,R24
.dbline -2
L8:
.dbline 0 ; func end
ret
.dbend
.dbfunc s AppIOInit _AppIOInit fV
.even
_AppIOInit:
.dbline -1
.dbline 182
; }
;
; //----------------------------------------------------------------------------//
; // SETUP I/Os
; //----------------------------------------------------------------------------//
; static void AppIOInit (void) /*IO全部初始化为高阻态*/
; {
.dbline 183
; PORTA = 0x00;
clr R2
out 0x1b,R2
.dbline 184
; DDRA = 0x00;
out 0x1a,R2
.dbline 185
; PORTB = 0x00;
out 0x18,R2
.dbline 186
; DDRB = 0x00;
out 0x17,R2
.dbline 187
; PORTC = 0x00; //m103 output only
out 0x15,R2
.dbline 188
; DDRC = 0x00;
out 0x14,R2
.dbline 189
; PORTD = 0x00;
out 0x12,R2
.dbline 190
; DDRD = 0x00;
out 0x11,R2
.dbline 191
; PORTE = 0x00;
out 0x3,R2
.dbline 192
; DDRE = 0x00;
out 0x2,R2
.dbline 193
; PORTF = 0x00;
sts 98,R2
.dbline 194
; DDRF = 0x00;
sts 97,R2
.dbline 195
; PORTG = 0x00;
sts 101,R2
.dbline 196
; DDRG = 0x00;
sts 100,R2
.dbline -2
L9:
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile D:\编写软件小系统\纯ucos\source\app.c
_AppTaskStartStk::
.blkb 256
.dbsym e AppTaskStartStk _AppTaskStartStk A[256:256]c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -