📄 mega16.s
字号:
.byte 136,255
.byte 'H,40
.byte 0,255
.byte 193,'A
.byte 'A,'I
.byte 'Q,207
.byte 0,0
.byte 1,'A
.byte 128,127
.byte 0,0
.byte 0,255
.byte 64,35
.byte 20,28
.byte 51,96
.byte 32,0
.dbsym e hanzi_bao _hanzi_bao A[32:32]kc
_hanzi_jing::
.byte 32,26
.byte 250,175
.byte 170,239
.byte 10,250
.byte 16,143
.byte 'T,36
.byte 92,132
.byte 4,0
.byte 2,2
.byte 2,234
.byte 170,170
.byte 171,170
.byte 171,170
.byte 170,234
.byte 2,2
.byte 3,0
.dbsym e hanzi_jing _hanzi_jing A[32:32]kc
_hanzi_guo::
.byte 128,129
.byte 142,4
.byte 0,16
.byte 'P,144
.byte 16,16
.byte 16,255
.byte 16,16
.byte 16,0
.byte 64,32
.byte 31,32
.byte 32,64
.byte 64,'C
.byte 'A,'H
.byte 'P,'O
.byte 64,64
.byte 64,0
.dbsym e hanzi_guo _hanzi_guo A[32:32]kc
_hanzi_qian::
.byte 128,64
.byte 32,24
.byte 15,10
.byte 8,232
.byte 8,8
.byte 'H,40
.byte 24,8
.byte 0,0
.byte 64,64
.byte 32,32
.byte 16,12
.byte 3,0
.byte 3,12
.byte 16,48
.byte 96,32
.byte 32,0
.dbsym e hanzi_qian _hanzi_qian A[32:32]kc
_hanzi_she::
.byte 64,'A
.byte 206,4
.byte 0,128
.byte 64,190
.byte 130,130
.byte 130,190
.byte 192,64
.byte 64,0
.byte 0,0
.byte 127,32
.byte 144,128
.byte 64,'C
.byte 44,16
.byte 16,44
.byte 'C,192
.byte 64,0
.dbsym e hanzi_she _hanzi_she A[32:32]kc
_hanzi_zhi2::
.byte 0,32
.byte 47,169
.byte 169,175
.byte 233,185
.byte 169,175
.byte 169,169
.byte 47,32
.byte 0,0
.byte 128,128
.byte 128,255
.byte 170,170
.byte 170,170
.byte 170,170
.byte 170,255
.byte 128,128
.byte 128,0
.dbsym e hanzi_zhi2 _hanzi_zhi2 A[32:32]kc
_hanzi_xing::
.byte 0,0
.byte 0,190
.byte 42,42
.byte 42,234
.byte 42,42
.byte 42,42
.byte 62,0
.byte 0,0
.byte 0,'H
.byte 'F,'A
.byte 'I,'I
.byte 'I,127
.byte 'I,'I
.byte 'I,'I
.byte 'I,'A
.byte 64,0
.dbsym e hanzi_xing _hanzi_xing A[32:32]kc
_hanzi_qi::
.byte 0,4
.byte 255,'T
.byte 'T,'T
.byte 255,4
.byte 0,254
.byte 34,34
.byte 34,254
.byte 0,0
.byte 'B,34
.byte 27,2
.byte 2,10
.byte 51,'b
.byte 24,7
.byte 2,34
.byte 'B,63
.byte 0,0
.dbsym e hanzi_qi _hanzi_qi A[32:32]kc
_hanzi_nian::
.byte 64,32
.byte 16,12
.byte 227,34
.byte 34,34
.byte 254,34
.byte 34,34
.byte 34,2
.byte 0,0
.byte 4,4
.byte 4,4
.byte 7,4
.byte 4,4
.byte 255,4
.byte 4,4
.byte 4,4
.byte 4,0
.dbsym e hanzi_nian _hanzi_nian A[32:32]kc
_hanzi_yue::
.byte 0,0
.byte 0,0
.byte 0,255
.byte 17,17
.byte 17,17
.byte 17,255
.byte 0,0
.byte 0,0
.byte 0,64
.byte 32,16
.byte 12,3
.byte 1,1
.byte 1,33
.byte 'A,63
.byte 0,0
.byte 0,0
.dbsym e hanzi_yue _hanzi_yue A[32:32]kc
_hanzi_ri::
.byte 0,0
.byte 0,254
.byte 'B,'B
.byte 'B,'B
.byte 'B,'B
.byte 'B,254
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,63
.byte 16,16
.byte 16,16
.byte 16,16
.byte 16,63
.byte 0,0
.byte 0,0
.dbsym e hanzi_ri _hanzi_ri A[32:32]kc
_hanzi_yi::
.byte 0,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,128
.byte 128,192
.byte 128,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.byte 0,0
.dbsym e hanzi_yi _hanzi_yi A[32:32]kc
_hanzi_er::
.byte 0,0
.byte 4,4
.byte 4,4
.byte 4,4
.byte 4,4
.byte 4,6
.byte 4,0
.byte 0,0
.byte 0,16
.byte 16,16
.byte 16,16
.byte 16,16
.byte 16,16
.byte 16,16
.byte 16,24
.byte 16,0
.dbsym e hanzi_er _hanzi_er A[32:32]kc
_hanzi_san::
.byte 0,4
.byte 132,132
.byte 132,132
.byte 132,132
.byte 132,132
.byte 132,132
.byte 132,4
.byte 0,0
.byte 0,32
.byte 32,32
.byte 32,32
.byte 32,32
.byte 32,32
.byte 32,32
.byte 32,32
.byte 32,0
.dbsym e hanzi_san _hanzi_san A[32:32]kc
_hanzi_si::
.byte 0,254
.byte 2,2
.byte 2,254
.byte 2,2
.byte 254,2
.byte 2,2
.byte 2,254
.byte 0,0
.byte 0,127
.byte 40,36
.byte 35,32
.byte 32,32
.byte 33,34
.byte 34,34
.byte 34,127
.byte 0,0
.dbsym e hanzi_si _hanzi_si A[32:32]kc
_hanzi_wu::
.byte 0,2
.byte 130,130
.byte 130,130
.byte 254,130
.byte 130,130
.byte 194,130
.byte 2,0
.byte 0,0
.byte 32,32
.byte 32,32
.byte 32,63
.byte 32,32
.byte 32,32
.byte 63,32
.byte 32,48
.byte 32,0
.dbsym e hanzi_wu _hanzi_wu A[32:32]kc
_hanzi_liu6::
.byte 16,16
.byte 16,16
.byte 16,145
.byte 18,30
.byte 148,16
.byte 16,16
.byte 16,16
.byte 16,0
.byte 0,64
.byte 32,16
.byte 12,3
.byte 1,0
.byte 0,1
.byte 2,12
.byte 'x,48
.byte 0,0
.dbsym e hanzi_liu6 _hanzi_liu6 A[32:32]kc
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
_hanzi_array::
.blkw 1
.area idata
.word _hanzi_ri
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.blkw 1
.area idata
.word _hanzi_yi
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.blkw 1
.area idata
.word _hanzi_er
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.blkw 1
.area idata
.word _hanzi_san
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.blkw 1
.area idata
.word _hanzi_si
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.blkw 1
.area idata
.word _hanzi_wu
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.blkw 1
.area idata
.word _hanzi_liu6
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.dbsym e hanzi_array _hanzi_array A[14:7]pkc
.area vector(rom, abs)
.org 4
jmp _int0_isr
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.area vector(rom, abs)
.org 8
jmp _int1_isr
.area data(ram, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.area text(rom, con, rel)
.dbfile D:\mega16\c/..\drive\hanzi.c
.dbfile D:\mega16\c\mega16.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 34
; //**************************************************************************/
; // 探头控制器第二代mega16L
; // mega16L 8M
; //*************************************************************************/
; //创 建 人:胡勇刚
; //创建日期:2005年3月3日
; //版 本 号:001
; //*************************************************************************/
; #define TANTOU_C
; #include "config.h"
;
; #define key_in() ((PINB >> 5) & 0x07)
;
; uchar char_count;
; uchar set_state;
; uchar time_data[16];
; uchar i;
; //-------------------------------------------------------------------------
;
; #pragma interrupt_handler int0_isr:2
; void int0_isr(void);
;
; #pragma interrupt_handler int1_isr:3
; void int1_isr(void);
;
; //-------------------------------------------------------------------------
; void port_int (void); //端口初始化
; void init_devices(void); //单片机初始化
; void delay_us (uint time); //延迟time微秒
; void delay_ms (uint time); //延迟time毫秒
; void count_write(uchar ,uchar ,uchar);
; //-------------------------------------------------------------------------
; void port_init(void)
; {
.dbline 35
; PORTA = 0x00;
clr R2
out 0x1b,R2
.dbline 36
; DDRA = 0x00;
out 0x1a,R2
.dbline 37
; PORTB = 0xFF;
ldi R24,255
out 0x18,R24
.dbline 38
; DDRB = 0x1F;
ldi R24,31
out 0x17,R24
.dbline 39
; PORTC = 0x00; //m103 output only
out 0x15,R2
.dbline 40
; DDRC = 0x00;
out 0x14,R2
.dbline 41
; PORTD = 0xff;
ldi R24,255
out 0x12,R24
.dbline 42
; DDRD = 0x00;
out 0x11,R2
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e delay_us _delay_us fV
; i -> R20,R21
; time -> R16,R17
.even
_delay_us::
xcall push_gset1
.dbline -1
.dbline 47
; }
; //-------------------------------------------------------------------------
;
; void delay_us(uint time)
; {
.dbline 49
; uint i;
; for(i=0;i<time;i++)
clr R20
clr R21
xjmp L6
L3:
.dbline 50
.dbline 51
nop
.dbline 51
nop
.dbline 51
nop
.dbline 51
nop
.dbline 51
nop
.dbline 51
nop
.dbline 51
nop
.dbline 51
nop
.dbline 52
L4:
.dbline 49
subi R20,255 ; offset = 1
sbci R21,255
L6:
.dbline 49
cp R20,R16
cpc R21,R17
brlo L3
.dbline -2
L2:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 i
.dbsym r time 16 i
.dbend
.dbfunc e delay_ms _delay_ms fV
; i -> R20,R21
; time -> R22,R23
.even
_delay_ms::
xcall push_gset2
movw R22,R16
.dbline -1
.dbline 56
; {
; delay_1us();
; }
; }
; //-------------------------------------------------------------------------
; void delay_ms(uint time)
; {
.dbline 58
; uint i;
; for(i=0;i<time;i++)
clr R20
clr R21
xjmp L11
L8:
.dbline 59
.dbline 60
ldi R16,1000
ldi R17,3
xcall _delay_us
.dbline 61
L9:
.dbline 58
subi R20,255 ; offset = 1
sbci R21,255
L11:
.dbline 58
cp R20,R22
cpc R21,R23
brlo L8
.dbline -2
L7:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r i 20 i
.dbsym r time 22 i
.dbend
.dbfunc e count_write _count_write fV
; count -> y+6
; y -> R22
; x -> R20
.even
_count_write::
xcall push_gset2
mov R22,R18
mov R20,R16
sbiw R28,2
.dbline -1
.dbline 65
; {
; delay_us(1000);
; }
; }
; /******************************************************************************/
; void count_write(uchar x,uchar y,uchar count)
; {
.dbline 66
; lcd_print816(x,y,count_array[count >> 4]);
ldd R24,y+6
swap R24
andi R24,#0x0F
ldi R25,2
mul R25,R24
movw R30,R0
ldi R24,<_count_array
ldi R25,>_count_array
add R30,R24
adc R31,R25
ldd R2,z+0
ldd R3,z+1
std y+1,R3
std y+0,R2
mov R18,R22
mov R16,R20
xcall _lcd_print816
.dbline 67
; lcd_print816(x,y+8,count_array[count & 0xf]);
ldd R24,y+6
andi R24,15
ldi R25,2
mul R25,R24
movw R30,R0
ldi R24,<_count_array
ldi R25,>_count_array
add R30,R24
adc R31,R25
ldd R2,z+0
ldd R3,z+1
std y+1,R3
std y+0,R2
mov R18,R22
subi R18,248 ; addi 8
mov R16,R20
xcall _lcd_print816
.dbline -2
L12:
adiw R28,2
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym l count 6 c
.dbsym r y 22 c
.dbsym r x 20 c
.dbend
.dbfunc e count_reverse _count_reverse fV
; count -> y+6
; y -> R22
; x -> R20
.even
_count_reverse::
xcall push_gset2
mov R22,R18
mov R20,R16
sbiw R28,2
.dbline -1
.dbline 71
; }
; /******************************************************************************/
; void count_reverse(uchar x,uchar y,uchar count)
; {
.dbline 72
; lcd_reverse816(x,y,count_array[count>>4]);
ldd R24,y+6
swap R24
andi R24,#0x0F
ldi R25,2
mul R25,R24
movw R30,R0
ldi R24,<_count_array
ldi R25,>_count_array
add R30,R24
adc R31,R25
ldd R2,z+0
ldd R3,z+1
std y+1,R3
std y+0,R2
mov R18,R22
mov R16,R20
xcall _lcd_reverse816
.dbline 73
; lcd_reverse816(x,y+8,count_array[count & 0xf]);
ldd R24,y+6
andi R24,15
ldi R25,2
mul R25,R24
movw R30,R0
ldi R24,<_count_array
ldi R25,>_count_array
add R30,R24
adc R31,R25
ldd R2,z+0
ldd R3,z+1
std y+1,R3
std y+0,R2
mov R18,R22
subi R18,248 ; addi 8
mov R16,R20
xcall _lcd_reverse816
.dbline -2
L13:
adiw R28,2
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym l count 6 c
.dbsym r y 22 c
.dbsym r x 20 c
.dbend
.dbfunc e watchdog_init _watchdog_init fV
.even
_watchdog_init::
.dbline -1
.dbline 79
; }
; /******************************************************************************/
; //Watchdog initialize
; // prescale: 2048K
; void watchdog_init(void)
; {
.dbline 80
; WDR(); //this prevents a timout on enabling
wdr
.dbline 81
; WDTCR = 0x0F; //WATCHDOG ENABLED - dont forget to issue WDRs
ldi R24,15
out 0x21,R24
.dbline -2
L14:
.dbline 0 ; func end
ret
.dbend
.dbfunc e watchdog_off _watchdog_off fV
.even
_watchdog_off::
.dbline -1
.dbline 84
; }
; void watchdog_off(void)
; {
.dbline 85
; WDR();
wdr
.dbline 86
; WDTCR |= BIT(WDTOE);
in R24,0x21
ori R24,16
out 0x21,R24
.dbline 87
; WDTCR = 0x00;
clr R2
out 0x21,R2
.dbline -2
L15:
.dbline 0 ; func end
ret
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 91
; }
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
.dbline 93
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 94
; port_init();
xcall _port_init
.dbline 95
; watchdog_init();
xcall _watchdog_init
.dbline 97
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 98
; GICR = 0xC0;
ldi R24,192
out 0x3b,R24
.dbline 99
; TIMSK = 0x00; //timer interrupt sources
out 0x39,R2
.dbline 100
; SEI(); //re-enable interrupts
sei
.dbline -2
L16:
.dbline 0 ; func end
ret
.dbend
.dbfunc e time_init _time_init fV
.even
_time_init::
sbiw R28,1
.dbline -1
.dbline 105
.dbline 107
ldi R24,9
sts _time_data,R24
.dbline 108
clr R2
sts _time_data+1,R2
.dbline 109
sts _time_data+2,R2
.dbline 110
sts _time_data+3,R2
.dbline 111
sts _time_data+4,R2
.dbline 112
ldi R24,48
sts _time_data+5,R24
.dbline 113
ldi R24,18
sts _time_data+6,R24
.dbline 114
ldi R24,22
sts _time_data+7,R24
.dbline 115
sts _time_data+8,R2
.dbline 116
ldi R24,3
sts _time_data+9,R24
.dbline 118
sts _time_data+10,R24
.dbline 119
ldi R16,<_time_data
ldi R17,>_time_data
xcall _PCF8563Write
cpi R16,2
brne L28
.dbline 120
ldi R24,255
std y+0,R24
clr R18
ldi R16,6
xcall _count_write
L28:
.dbline -2
L17:
adiw R28,1
.dbline 0 ; func end
ret
.dbend
.dbfunc e time_read _time_read fV
.even
_time_read::
sbiw R28,1
.dbline -1
.dbline 124
; //all peripherals are now initialized
; }
;
; void time_init(void)
; {
; /* 初始化pcf8563 */
; time_data[0] = 9;
; time_data[1] = 0;
; time_data[2] = 0; //控制/状态寄存器1
; time_data[3] = 0; //控制/状态寄存器2
; time_data[4] = 0; //秒
; time_data[5] = 0x30; //分
; time_data[6] = 0x12; //时
; time_data[7] = 0x16; //日
; time_data[8] = 0x00; //星期
; time_data[9] = 0x03; //月/世
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -