📄 main.s
字号:
.module main.c
.area text(rom, con, rel)
.dbfile E:\_ING\文档\_STQ\easy-STQ-20080712\main.c
.dbfunc e main _main fV
.even
_main::
sbiw R28,2
.dbline -1
.dbline 25
;
; ///////////////////////////////////////////////////////////////
; /**************************************************************
;
; 公司名称: 扬州恒博科技
; 模块名 : 点动型STQ执行机构主控程序
; 创建人 : 章俭文
; 日期 : 2008/08/19
; 功能描述: 完成对本地旋钮和远程开关量的控制功能
; 其它说明: 编译环境为ICCAVR V6.31A
; 版本 : V1.0
;
; **************************************************************/
; ///////////////////////////////////////////////////////////////
;
; #define MAIN_GLOBAL
; #include "main.h"
;
;
; static void InitPort(void);
; static void InitDevices(void);
;
;
; void main()
; {
.dbline 27
;
; InitDevices(); //设备初始化
xcall _InitDevices
.dbline 29
;
; SCH_Add_Task(Motor, 900, 1); //电机任务,10ms循环一次
ldi R24,1
ldi R25,0
std y+1,R25
std y+0,R24
ldi R18,900
ldi R19,3
ldi R16,<PL_Motor
ldi R17,>PL_Motor
xcall _SCH_Add_Task
.dbline 31
;
; SCH_Add_Task(Alarm,901,10); //LED告警指示,100ms循环一次
ldi R24,10
ldi R25,0
std y+1,R25
std y+0,R24
ldi R18,901
ldi R19,3
ldi R16,<PL_Alarm
ldi R17,>PL_Alarm
xcall _SCH_Add_Task
.dbline 33
;
; SCH_Add_Task(check,1,0); //电机参数检测任务,只上电时执行一次
clr R2
clr R3
std y+1,R3
std y+0,R2
ldi R18,1
ldi R19,0
ldi R16,<PL_check
ldi R17,>PL_check
xcall _SCH_Add_Task
.dbline 35
;
; SCH_Start();
xcall _SCH_Start
xjmp L6
L5:
.dbline 38
.dbline 39
xcall _SCH_Dispatch_Tasks
.dbline 40
L6:
.dbline 37
xjmp L5
X0:
.dbline -2
L4:
adiw R28,2
.dbline 0 ; func end
ret
.dbend
.dbfunc s InitDevices _InitDevices fV
.even
_InitDevices:
.dbline -1
.dbline 46
;
; while(1)
; {
; SCH_Dispatch_Tasks();
; }
;
; }
;
;
; static void InitDevices(void)
; {
.dbline 47
; CLI(); //关中断
cli
.dbline 49
;
; InitPort(); //IO端口初始化
xcall _InitPort
.dbline 51
;
; StopMotor(); //设置电机关
xcall _StopMotor
.dbline 54
;
;
; MotorFlag = STOP; //状态标识
ldi R24,3
sts _MotorFlag,R24
.dbline 55
; ControlFlag = IN_LOCAL;
ldi R24,1
sts _ControlFlag,R24
.dbline 56
; limit_direction = 1;
sts _limit_direction,R24
.dbline 58
;
; SetLocalLed(); //本地LED指示
cbi 0x18,5
.dbline 59
; ClrRemoteLed();
sbi 0x18,6
.dbline 61
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 62
; GICR = 0x00;
out 0x3b,R2
.dbline 63
; TIMSK = 0x04; //timer interrupt sources
ldi R24,4
out 0x39,R24
.dbline 65
;
; InitTimer1(); //调度定时器
xcall _InitTimer1
.dbline 67
;
; OutWdServer(); //喂外部看门狗
xcall _OutWdServer
.dbline -2
L8:
.dbline 0 ; func end
ret
.dbend
.dbfunc s InitPort _InitPort fV
.even
_InitPort:
.dbline -1
.dbline 72
; }
;
;
; static void InitPort(void)
; {
.dbline 73
; PORTB =(1<<LOCAL_LED)|(1<<REMOTE_LED)|(1<<OUT_WD);
ldi R24,112
out 0x18,R24
.dbline 74
; DDRB=((1<<LOCAL_LED)|(1<<REMOTE_LED)|(1<<OUT_WD));
out 0x17,R24
.dbline 76
;
; PORTA =0x00;
clr R2
out 0x1b,R2
.dbline 77
; DDRA=0x00;
out 0x1a,R2
.dbline 79
;
; PORTC =0x00;
out 0x15,R2
.dbline 80
; DDRC =(0<<LOCAL_CLOSE)|(0<<LOCAL_OPEN)|(1<<MOTOR_1)|(1<<MOTOR_2);
ldi R24,3
out 0x14,R24
.dbline 82
;
; PORTD =0x00;
out 0x12,R2
.dbline 83
; DDRD = ((0<<REMOTE_STOP)|(0<<REMOTE_CLOSE)|(0<<REMOTE_OPEN))|((1<<S1|(1<<S2)));
ldi R24,192
out 0x11,R24
.dbline -2
L9:
.dbline 0 ; func end
ret
.dbend
.area data(ram, con, rel)
.dbfile E:\_ING\文档\_STQ\easy-STQ-20080712\main.c
L11:
.blkb 1
.area idata
.byte 1
.area data(ram, con, rel)
.dbfile E:\_ING\文档\_STQ\easy-STQ-20080712\main.c
.area text(rom, con, rel)
.dbfile E:\_ING\文档\_STQ\easy-STQ-20080712\main.c
.dbfunc e OutWdServer _OutWdServer fV
.dbsym s WdFlag L11 c
.even
_OutWdServer::
.dbline -1
.dbline 89
;
; }
;
;
; void OutWdServer(void) //喂外部看门狗
; {
.dbline 92
; static uchar WdFlag=1;
;
; if (WdFlag)
lds R2,L11
tst R2
breq L12
.dbline 93
; {
.dbline 94
; SetOutWd();
sbi 0x18,4
.dbline 95
; WdFlag=0;
clr R2
sts L11,R2
.dbline 96
; }
xjmp L13
L12:
.dbline 98
.dbline 99
cbi 0x18,4
.dbline 100
ldi R24,1
sts L11,R24
.dbline 101
L13:
.dbline -2
L10:
.dbline 0 ; func end
ret
.dbend
.area func_lit
PL_check: .word `_check
PL_Alarm: .word `_Alarm
PL_Motor: .word `_Motor
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -