📄 main.s
字号:
.module main.c
.area lit(rom, con, rel)
_arab_1:
.byte 0,16
.byte 16,248
.byte 0,0
.byte 0,0
.byte 0,32
.byte 32,63
.byte 32,32
.byte 0,0
.dbfile D:\zhangyu\H2test\program/lcd.h
.dbsym s arab_1 _arab_1 A[16:16]kc
_arab_2:
.byte 0,'p
.byte 8,8
.byte 8,136
.byte 'p,0
.byte 0,48
.byte 40,36
.byte 34,33
.byte 48,0
.dbsym s arab_2 _arab_2 A[16:16]kc
_arab_3:
.byte 0,48
.byte 8,136
.byte 136,'H
.byte 48,0
.byte 0,24
.byte 32,32
.byte 32,17
.byte 14,0
.dbsym s arab_3 _arab_3 A[16:16]kc
_arab_4:
.byte 0,0
.byte 192,32
.byte 16,248
.byte 0,0
.byte 0,7
.byte 4,36
.byte 36,63
.byte 36,0
.dbsym s arab_4 _arab_4 A[16:16]kc
_arab_5:
.byte 0,248
.byte 8,136
.byte 136,8
.byte 8,0
.byte 0,25
.byte 33,32
.byte 32,17
.byte 14,0
.dbsym s arab_5 _arab_5 A[16:16]kc
_arab_6:
.byte 0,224
.byte 16,136
.byte 136,24
.byte 0,0
.byte 0,15
.byte 17,32
.byte 32,17
.byte 14,0
.dbsym s arab_6 _arab_6 A[16:16]kc
_arab_7:
.byte 0,56
.byte 8,8
.byte 200,56
.byte 8,0
.byte 0,0
.byte 0,63
.byte 0,0
.byte 0,0
.dbsym s arab_7 _arab_7 A[16:16]kc
_arab_8:
.byte 0,'p
.byte 136,8
.byte 8,136
.byte 'p,0
.byte 0,28
.byte 34,33
.byte 33,34
.byte 28,0
.dbsym s arab_8 _arab_8 A[16:16]kc
_arab_9:
.byte 0,224
.byte 16,8
.byte 8,16
.byte 224,0
.byte 0,0
.byte 49,34
.byte 34,17
.byte 15,0
.dbsym s arab_9 _arab_9 A[16:16]kc
_arab_0:
.byte 0,224
.byte 16,8
.byte 8,16
.byte 224,0
.byte 0,15
.byte 16,32
.byte 32,16
.byte 15,0
.dbsym s arab_0 _arab_0 A[16:16]kc
_T:
.byte 24,8
.byte 8,248
.byte 8,8
.byte 24,0
.byte 0,0
.byte 32,63
.byte 32,0
.byte 0,0
.dbsym s T _T A[16:16]kc
_t:
.byte 0,128
.byte 128,224
.byte 128,128
.byte 0,0
.byte 0,0
.byte 0,31
.byte 32,32
.byte 0,0
.dbsym s t _t A[16:16]kc
_maohao:
.byte 0,0
.byte 0,192
.byte 192,0
.byte 0,0
.byte 0,0
.byte 0,48
.byte 48,0
.byte 0,0
.dbsym s maohao _maohao A[16:16]kc
_xiaoshudian:
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,48
.byte 48,0
.byte 0,0
.byte 0,0
.dbsym s xiaoshudian _xiaoshudian A[16:16]kc
_E:
.byte 8,248
.byte 136,136
.byte 232,8
.byte 16,0
.byte 32,63
.byte 32,32
.byte 35,32
.byte 24,0
.dbsym s E _E A[16:16]kc
_l:
.byte 0,8
.byte 8,248
.byte 0,0
.byte 0,0
.byte 0,32
.byte 32,63
.byte 32,32
.byte 0,0
.dbsym s l _l A[16:16]kc
_g:
.byte 0,0
.byte 128,128
.byte 128,128
.byte 128,0
.byte 0,'k
.byte 148,148
.byte 148,147
.byte 96,0
.dbsym s g _g A[16:16]kc
_P:
.byte 8,248
.byte 8,8
.byte 8,8
.byte 240,0
.byte 32,63
.byte 33,1
.byte 1,1
.byte 0,0
.dbsym s P _P A[16:16]kc
_H:
.byte 0,126
.byte 16,126
.byte 0,'P
.byte 'p,64
.dbsym s H _H A[8:8]kc
_ll:
.byte 0,0
.byte 'B,126
.byte 'B,0
.byte 0,0
.dbsym s ll _ll A[8:8]kc
_lll:
.byte 0,0
.byte 'B,126
.byte 'B,126
.byte 'B,0
.dbsym s lll _lll A[8:8]kc
_zhenghao:
.byte 0,0
.byte 0,240
.byte 0,0
.byte 0,0
.byte 1,1
.byte 1,31
.byte 1,1
.byte 1,0
.dbsym s zhenghao _zhenghao A[16:16]kc
_fuhao:
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,1
.byte 1,1
.byte 1,1
.byte 1,1
.dbsym s fuhao _fuhao A[16:16]kc
.area text(rom, con, rel)
.dbfile D:\zhangyu\H2test\program/lcd.h
.dbfile D:\zhangyu\H2test\program\main.c
.dbfunc e show_time _show_time fV
; sec -> R20
; min -> R22
; hour -> R10
.even
_show_time::
xcall push_gset3
sbiw R28,1
.dbline -1
.dbline 33
; /************************************************************
; FileName: main.c
; Author: Version : Date:
; Description: // 模块描述
; Version: // 版本信息
; Function List: // 主要函数及其功能
; 1. -------
; History: // 历史修改记录
; <author> <time> <version > <desc>
; David 96/10/12 1.0 build this moudle
; ***********************************************************/
; #include <iom16v.h>
; #include <macros.h>
; #include "main.h"
; #include "initial_mcu.h"
; #include "232.h"
; #include "lcd.h"
; #include "key.h"
; #include "6675.h"
; #include "1302.h"
; #include "7135.h"
;
; #define ICP PORTD&0x40
; //全局变量
; unsigned char entercount,leftcount,rightcount;
; unsigned char position1302,hh,mm,positioncanbi,canbianjian;
; unsigned int time_array[6],canbi_array[5];
;
; unsigned char endflag;
; unsigned int ovcounter,pulse;
;
; void show_time(void)
; {
.dbline 36
; unsigned char hour,min,sec;
;
; hour=pDS1302_Read(mDS1302_HOUR_Reg); //时
ldi R16,132
xcall _pDS1302_Read
mov R10,R16
.dbline 37
; min=pDS1302_Read(mDS1302_MIN_Reg); //分
ldi R16,130
xcall _pDS1302_Read
mov R22,R16
.dbline 38
; sec=pDS1302_Read(mDS1302_SEC_Reg); //秒
ldi R16,128
xcall _pDS1302_Read
mov R20,R16
.dbline 39
; time_array[0]=hour>>4;
mov R2,R10
clr R3
asr R3
ror R2
asr R3
ror R2
asr R3
ror R2
asr R3
ror R2
sts _time_array+1,R3
sts _time_array,R2
.dbline 40
; time_array[1]=hour&0x0f;
mov R24,R10
clr R25
andi R24,15
andi R25,0
sts _time_array+2+1,R25
sts _time_array+2,R24
.dbline 41
; time_array[2]=min>>4;
mov R2,R22
clr R3
asr R3
ror R2
asr R3
ror R2
asr R3
ror R2
asr R3
ror R2
sts _time_array+4+1,R3
sts _time_array+4,R2
.dbline 42
; time_array[3]=min&0x0f;
mov R24,R22
clr R25
andi R24,15
andi R25,0
sts _time_array+6+1,R25
sts _time_array+6,R24
.dbline 43
; time_array[4]=sec>>4;
mov R2,R20
clr R3
asr R3
ror R2
asr R3
ror R2
asr R3
ror R2
asr R3
ror R2
sts _time_array+8+1,R3
sts _time_array+8,R2
.dbline 44
; time_array[5]=sec&0x0f;
mov R24,R20
clr R25
andi R24,15
andi R25,0
sts _time_array+10+1,R25
sts _time_array+10,R24
.dbline 45
; Draw_NtoArab(0x00,0x28,time_array[0]);
lds R2,_time_array
lds R3,_time_array+1
std y+0,R2
ldi R18,40
clr R16
xcall _Draw_NtoArab
.dbline 46
; Draw_NtoArab(0x00,0x30,time_array[1]);
lds R2,_time_array+2
lds R3,_time_array+2+1
std y+0,R2
ldi R18,48
clr R16
xcall _Draw_NtoArab
.dbline 47
; Draw_NtoArab(0x00,0x40,time_array[2]);
lds R2,_time_array+4
lds R3,_time_array+4+1
std y+0,R2
ldi R18,64
clr R16
xcall _Draw_NtoArab
.dbline 48
; Draw_NtoArab(0x00,0x48,time_array[3]);
lds R2,_time_array+6
lds R3,_time_array+6+1
std y+0,R2
ldi R18,72
clr R16
xcall _Draw_NtoArab
.dbline 49
; Draw_NtoArab(0x00,0x58,time_array[4]);
lds R2,_time_array+8
lds R3,_time_array+8+1
std y+0,R2
ldi R18,88
clr R16
xcall _Draw_NtoArab
.dbline 50
; Draw_NtoArab(0x00,0x60,time_array[5]);
lds R2,_time_array+10
lds R3,_time_array+10+1
std y+0,R2
ldi R18,96
clr R16
xcall _Draw_NtoArab
.dbline -2
L1:
adiw R28,1
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r sec 20 c
.dbsym r min 22 c
.dbsym r hour 10 c
.dbend
.dbfunc e show_canbi _show_canbi fV
.even
_show_canbi::
sbiw R28,1
.dbline -1
.dbline 54
; }
;
; void show_canbi(void)
; {
.dbline 55
; Draw_NtoArab(0x04,0x40,canbi_array[1]);
lds R2,_canbi_array+2
lds R3,_canbi_array+2+1
std y+0,R2
ldi R18,64
ldi R16,4
xcall _Draw_NtoArab
.dbline 56
; Draw_NtoArab(0x04,0x48,canbi_array[2]);
lds R2,_canbi_array+4
lds R3,_canbi_array+4+1
std y+0,R2
ldi R18,72
ldi R16,4
xcall _Draw_NtoArab
.dbline 57
; Draw_NtoArab(0x04,0x58,canbi_array[3]);
lds R2,_canbi_array+6
lds R3,_canbi_array+6+1
std y+0,R2
ldi R18,88
ldi R16,4
xcall _Draw_NtoArab
.dbline 58
; Draw_NtoArab(0x04,0x60,canbi_array[4]);
lds R2,_canbi_array+8
lds R3,_canbi_array+8+1
std y+0,R2
ldi R18,96
ldi R16,4
xcall _Draw_NtoArab
.dbline -2
L12:
adiw R28,1
.dbline 0 ; func end
ret
.dbend
.dbfunc e data_init _data_init fV
; i -> R16
.even
_data_init::
.dbline -1
.dbline 62
; }
;
; void data_init(void)
; {
.dbline 64
; unsigned char i;
; entercount=0;
clr R2
sts _entercount,R2
.dbline 65
; leftcount=0;
sts _leftcount,R2
.dbline 66
; rightcount=0;
sts _rightcount,R2
.dbline 67
; position1302=0;
sts _position1302,R2
.dbline 68
; positioncanbi=0x02;
ldi R24,2
sts _positioncanbi,R24
.dbline 69
; for(i=1;i<5;i++)
ldi R16,1
xjmp L21
L18:
.dbline 70
ldi R24,2
mul R24,R16
movw R30,R0
ldi R24,<_canbi_array
ldi R25,>_canbi_array
add R30,R24
adc R31,R25
clr R2
clr R3
std z+1,R3
std z+0,R2
L19:
.dbline 69
inc R16
L21:
.dbline 69
cpi R16,5
brlo L18
.dbline -2
L17:
.dbline 0 ; func end
ret
.dbsym r i 16 c
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 74
; canbi_array[i]=0x00;
; }
;
; void main(void)
; {
.dbline 75
; Initial_MCU(); //初始化mcu
xcall _Initial_MCU
.dbline 76
; Initial_LCD(); //初始化LCD
xcall _Initial_LCD
.dbline 77
; Com0_Init(); //初始化串口
xcall _Com0_Init
.dbline 78
; pDS1302_Init(); //初始化1302
xcall _pDS1302_Init
.dbline 79
; data_init();
xcall _data_init
.dbline 80
; Clear_DDRAM(0x00,0x07); //清除lcd的所有显示内容
ldi R18,7
clr R16
xcall _Clear_DDRAM
.dbline 81
; Draw_Menu_Interface(); //绘制主菜单
xcall _Draw_Menu_Interface
xjmp L24
L23:
.dbline 83
.dbline 84
ldi R16,97
xcall _Uart_Transmit
.dbline 85
xcall _show_time
.dbline 86
xcall _show_temperature
.dbline 87
xcall _show_canbi
.dbline 88
xcall _checkkey
.dbline 89
xcall _display7135
.dbline 90
L24:
.dbline 82
xjmp L23
X0:
.dbline -2
L22:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 20
jmp _timer1_capt_isr
.area text(rom, con, rel)
.dbfile D:\zhangyu\H2test\program\main.c
.dbfunc e timer1_capt_isr _timer1_capt_isr fV
.even
_timer1_capt_isr::
st -y,R2
st -y,R3
st -y,R24
in R2,0x3f
st -y,R2
.dbline -1
.dbline 97
; while(1)
; {
; Uart_Transmit('a');
; show_time();
; show_temperature();
; show_canbi();
; checkkey();
; display7135();
; }
; }
;
;
; //测7135的busy信号所需的定时器捕获中断函数
; #pragma interrupt_handler timer1_capt_isr:6
; void timer1_capt_isr(void)
; {
.dbline 98
; if(ICP)
sbis 0x12,6
rjmp L27
.dbline 99
; {
.dbline 100
; endflag=0;
clr R2
sts _endflag,R2
.dbline 101
; TCCR1B&=0xbf; //下降沿捕获
in R24,0x2e
andi R24,191
out 0x2e,R24
.dbline 102
; }
xjmp L28
L27:
.dbline 104
.dbline 105
in R2,0x26
in R3,0x27
sts _pulse+1,R3
sts _pulse,R2
.dbline 106
ldi R24,1
sts _endflag,R24
.dbline 107
clr R2
out 0x2e,R2
.dbline 108
L28:
.dbline -2
L26:
ld R2,y+
out 0x3f,R2
ld R24,y+
ld R3,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbend
.area bss(ram, con, rel)
.dbfile D:\zhangyu\H2test\program\main.c
_pulse::
.blkb 2
.dbsym e pulse _pulse i
_ovcounter::
.blkb 2
.dbsym e ovcounter _ovcounter i
_endflag::
.blkb 1
.dbsym e endflag _endflag c
_canbi_array::
.blkb 10
.dbsym e canbi_array _canbi_array A[10:5]i
_time_array::
.blkb 12
.dbsym e time_array _time_array A[12:6]i
_canbianjian::
.blkb 1
.dbsym e canbianjian _canbianjian c
_positioncanbi::
.blkb 1
.dbsym e positioncanbi _positioncanbi c
_mm::
.blkb 1
.dbsym e mm _mm c
_hh::
.blkb 1
.dbsym e hh _hh c
_position1302::
.blkb 1
.dbsym e position1302 _position1302 c
_rightcount::
.blkb 1
.dbsym e rightcount _rightcount c
_leftcount::
.blkb 1
.dbsym e leftcount _leftcount c
_entercount::
.blkb 1
.dbsym e entercount _entercount c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -