?? ds12887.s
字號:
xcall _write_ds
.dbline 351
; write_ds(chMinutesChannel,chMinutes);
mov R18,R20
ldi R16,2
xcall _write_ds
.dbline 352
; write_ds(chHoursChannel,chHours);
ldd R18,y+4
ldi R16,4
xcall _write_ds
.dbline 353
; write_ds(chRegB,chRegB & MASK_CLR_SET);/* 使能刷新 */
ldi R18,11
ldi R16,11
xcall _write_ds
.dbline -2
.dbline 354
; }
L58:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym l chHours 4 c
.dbsym r chMinutes 20 c
.dbsym r chSeconds 22 c
.dbend
.dbfunc e SetDate _SetDate fV
; chYear -> y+4
; chMonth -> R20
; chDate -> R22
.even
_SetDate::
xcall push_gset2
mov R20,R18
mov R22,R16
.dbline -1
.dbline 363
;
; /*************************************************************
; 函數功能:該函數用來設置時鐘芯片的日期
; 應用范圍:
; 入口參數:chDate、chMonth、chYear是設定日期的壓縮BCD碼
; 出口參數:
; *************************************************************/
; void SetDate(unsigned char chDate,unsigned char chMonth,unsigned char chYear)
; {
.dbline 364
; write_ds(chRegB,chRegB | MASK_SETB_SET); /* 禁止刷新 */
ldi R18,139
ldi R16,11
xcall _write_ds
.dbline 365
; write_ds(chDateChannel,chDate);
mov R18,R22
ldi R16,7
xcall _write_ds
.dbline 366
; write_ds(chMonthChannel,chMonth);
mov R18,R20
ldi R16,8
xcall _write_ds
.dbline 367
; write_ds(chYearChannel,chYear);
ldd R18,y+4
ldi R16,9
xcall _write_ds
.dbline 368
; write_ds(chRegB,chRegB & MASK_CLR_SET); /* 使能刷新 */
ldi R18,11
ldi R16,11
xcall _write_ds
.dbline -2
.dbline 369
; }
L59:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym l chYear 4 c
.dbsym r chMonth 20 c
.dbsym r chDate 22 c
.dbend
.dbfunc e Natural_Menu _Natural_Menu fV
; m -> <dead>
.even
_Natural_Menu::
.dbline -1
.dbline 377
;
; /*******************************************************************/
; /* */
; /* 時間 正常顯示菜單 */
; /* */
; /*******************************************************************/
; void Natural_Menu ()
; {
.dbline 379
; uchar m;
; LCD1602_initial(); //初始化LCD
xcall _LCD1602_initial
.dbline 380
; LCD1602_gotoXY(1,0); //設置顯示位置為第一行的第1個字符
clr R18
ldi R16,1
xcall _LCD1602_gotoXY
.dbline 381
; LCD1602_sendstr("DATE: 2008-08-08");
ldi R16,<L61
ldi R17,>L61
xcall _LCD1602_sendstr
.dbline 385
; // for(m=0;m<16;m++)
; // LCD1602_sendbyte(iDat,cdis1[m]);
;
; LCD1602_gotoXY(2,0); //設置顯示位置為第二行第1個字符
clr R18
ldi R16,2
xcall _LCD1602_gotoXY
.dbline 386
; LCD1602_sendstr("TIME: 08: 08: 08");
ldi R16,<L62
ldi R17,>L62
.dbline -2
.dbline 389
; // for(m=0;m<16;m++)
; // LCD1602_sendbyte(iDat,cdis2[m]); //顯示字符
; }
L60:
.dbline 0 ; func end
xjmp _LCD1602_sendstr
.dbsym l m 1 c
.dbend
.dbfunc e daydis _daydis fV
.even
_daydis::
.dbline -1
.dbline 396
; /*******************************************************************/
; /* */
; /* 日期 正常顯示數據 */
; /* */
; /*******************************************************************/
; void daydis()
; {
.dbline 397
; display[0]=(temp_data1[0]>>4)+0x30;
lds R24,_temp_data1
swap R24
andi R24,#0x0F
subi R24,208 ; addi 48
sts _display,R24
.dbline 398
; display[1]=(temp_data1[0]&0x0F)+0x30;
lds R24,_temp_data1
andi R24,15
subi R24,208 ; addi 48
sts _display+1,R24
.dbline 399
; display[2]=(temp_data1[1]>>4)+0x30;
lds R24,_temp_data1+1
swap R24
andi R24,#0x0F
subi R24,208 ; addi 48
sts _display+2,R24
.dbline 400
; display[3]=(temp_data1[1]&0x0F)+0x30;
lds R24,_temp_data1+1
andi R24,15
subi R24,208 ; addi 48
sts _display+3,R24
.dbline 401
; display[4]=(temp_data1[2]>>4)+0x30;
lds R24,_temp_data1+2
swap R24
andi R24,#0x0F
subi R24,208 ; addi 48
sts _display+4,R24
.dbline 402
; display[5]=(temp_data1[2]&0x0F)+0x30;
lds R24,_temp_data1+2
andi R24,15
subi R24,208 ; addi 48
sts _display+5,R24
.dbline 404
;
; LCD1602_gotoXY(1,8);
ldi R18,8
ldi R16,1
xcall _LCD1602_gotoXY
.dbline 405
; LCD1602_sendbyte(iDat,display[0]);
lds R18,_display
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 406
; LCD1602_sendbyte(iDat,display[1]);
lds R18,_display+1
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 407
; LCD1602_gotoXY(1,11);
ldi R18,11
ldi R16,1
xcall _LCD1602_gotoXY
.dbline 408
; LCD1602_sendbyte(iDat,display[2]);
lds R18,_display+2
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 409
; LCD1602_sendbyte(iDat,display[3]);
lds R18,_display+3
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 410
; LCD1602_gotoXY(1,14);
ldi R18,14
ldi R16,1
xcall _LCD1602_gotoXY
.dbline 411
; LCD1602_sendbyte(iDat,display[4]);
lds R18,_display+4
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 412
; LCD1602_sendbyte(iDat,display[5]);
lds R18,_display+5
ldi R16,1
.dbline -2
.dbline 414
;
; }
L63:
.dbline 0 ; func end
xjmp _LCD1602_sendbyte
.dbend
.dbfunc e timedis _timedis fV
.even
_timedis::
.dbline -1
.dbline 421
; /*******************************************************************/
; /* */
; /* 時間 正常顯示數據 */
; /* */
; /*******************************************************************/
; void timedis()
; {
.dbline 422
; display[0]=(temp_data2[0]>>4)+0x30;
lds R24,_temp_data2
swap R24
andi R24,#0x0F
subi R24,208 ; addi 48
sts _display,R24
.dbline 423
; display[1]=(temp_data2[0]&0x0F)+0x30;
lds R24,_temp_data2
andi R24,15
subi R24,208 ; addi 48
sts _display+1,R24
.dbline 424
; display[2]=(temp_data2[1]>>4)+0x30;
lds R24,_temp_data2+1
swap R24
andi R24,#0x0F
subi R24,208 ; addi 48
sts _display+2,R24
.dbline 425
; display[3]=(temp_data2[1]&0x0F)+0x30;
lds R24,_temp_data2+1
andi R24,15
subi R24,208 ; addi 48
sts _display+3,R24
.dbline 426
; display[4]=(temp_data2[2]>>4)+0x30;
lds R24,_temp_data2+2
swap R24
andi R24,#0x0F
subi R24,208 ; addi 48
sts _display+4,R24
.dbline 427
; display[5]=(temp_data2[2]&0x0F)+0x30;
lds R24,_temp_data2+2
andi R24,15
subi R24,208 ; addi 48
sts _display+5,R24
.dbline 428
; LCD1602_gotoXY(2,6);
ldi R18,6
ldi R16,2
xcall _LCD1602_gotoXY
.dbline 429
; LCD1602_sendbyte(iDat,display[0]);
lds R18,_display
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 430
; LCD1602_sendbyte(iDat,display[1]);
lds R18,_display+1
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 431
; LCD1602_gotoXY(2,10);
ldi R18,10
ldi R16,2
xcall _LCD1602_gotoXY
.dbline 432
; LCD1602_sendbyte(iDat,display[2]);
lds R18,_display+2
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 433
; LCD1602_sendbyte(iDat,display[3]);
lds R18,_display+3
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 434
; LCD1602_gotoXY(2,14);
ldi R18,14
ldi R16,2
xcall _LCD1602_gotoXY
.dbline 435
; LCD1602_sendbyte(iDat,display[4]);
lds R18,_display+4
ldi R16,1
xcall _LCD1602_sendbyte
.dbline 436
; LCD1602_sendbyte(iDat,display[5]);
lds R18,_display+5
ldi R16,1
.dbline -2
.dbline 439
;
;
; }
L78:
.dbline 0 ; func end
xjmp _LCD1602_sendbyte
.dbend
.dbfunc e main _main fV
; sec_bak -> R20
; sec -> R22
.even
_main::
sbiw R28,1
.dbline -1
.dbline 448
;
; /*************************************************************
; 函數功能:主函數
; 應用范圍:
; 入口參數:
; 出口參數:
; *************************************************************/
; void main(void)
; {
.dbline 449
; unsigned char sec,sec_bak=sec;
mov R20,R22
.dbline 450
; Board_init();
xcall _Board_init
.dbline 451
; PORTA=0XFF;
ldi R24,255
out 0x1b,R24
.dbline 452
; PORTC=0X1F;
ldi R24,31
out 0x15,R24
.dbline 453
; InitDs12c887();
xcall _InitDs12c887
.dbline 454
; SetDate(0x15,0x10,0x08);
ldi R24,8
std y+0,R24
ldi R18,16
ldi R16,21
xcall _SetDate
.dbline 455
; SetTime(0x10,0x10,0x11);
ldi R24,17
std y+0,R24
ldi R18,16
ldi R16,16
xcall _SetTime
.dbline 456
; Natural_Menu ();
xcall _Natural_Menu
.dbline 457
; PORTD=0xFF;
ldi R24,255
out 0x12,R24
xjmp L95
L94:
.dbline 461
;
;
; while(1)
; {
.dbline 462
; PORTC&=0X1F;
in R24,0x15
andi R24,31
out 0x15,R24
.dbline 463
; sec=GetSeconds();
xcall _GetSeconds
mov R22,R16
.dbline 465
;
; if(sec!=sec_bak)
cp R16,R20
breq L97
.dbline 466
; {
.dbline 468
;
; sec_bak=sec;
mov R20,R22
.dbline 469
; temp_data1[0]=GetYear();
xcall _GetYear
sts _temp_data1,R16
.dbline 470
; temp_data1[1]=GetMonth();
xcall _GetMonth
sts _temp_data1+1,R16
.dbline 471
; temp_data1[2]=GetDate();
xcall _GetDate
sts _temp_data1+2,R16
.dbline 472
; temp_data2[0]=GetHours();
xcall _GetHours
sts _temp_data2,R16
.dbline 473
; temp_data2[1]=GetMinutes();
xcall _GetMinutes
sts _temp_data2+1,R16
.dbline 474
; temp_data2[2]=GetSeconds();
xcall _GetSeconds
sts _temp_data2+2,R16
.dbline 475
; daydis();
xcall _daydis
.dbline 476
; timedis();
xcall _timedis
.dbline 477
; if(sec%2)
ldi R17,2
mov R16,R22
xcall mod8u
tst R16
breq L103
.dbline 478
; {
.dbline 479
; LCD1602_gotoXY(2,12);
ldi R18,12
ldi R16,2
xcall _LCD1602_gotoXY
.dbline 480
; LCD1602_sendstr(" ");
ldi R16,<L105
ldi R17,>L105
xcall _LCD1602_sendstr
.dbline 481
; PORTC|=BIT(PC3);
sbi 0x15,3
.dbline 482
; }
xjmp L104
L103:
.dbline 484
; else
; {
.dbline 485
; LCD1602_gotoXY(2,12);
ldi R18,12
ldi R16,2
xcall _LCD1602_gotoXY
.dbline 486
; LCD1602_sendstr(":");
ldi R16,<L106
ldi R17,>L106
xcall _LCD1602_sendstr
.dbline 487
; PORTC&=~BIT(PC3);
cbi 0x15,3
.dbline 488
; }
L104:
.dbline 489
; PORTD=0xFF;
ldi R24,255
out 0x12,R24
.dbline 490
; }
L97:
.dbline 491
L95:
.dbline 460
xjmp L94
X1:
.dbline -2
.dbline 494
; }
;
;
; }
L93:
adiw R28,1
.dbline 0 ; func end
ret
.dbsym r sec_bak 20 c
.dbsym r sec 22 c
.dbend
.area data(ram, con, rel)
.dbfile D:\開發板\OK400C\程序\avr程序\26.ds12c887實時時鐘LCD1602顯示\DS12887.C
L106:
.blkb 2
.area idata
.byte 58,0
.area data(ram, con, rel)
.dbfile D:\開發板\OK400C\程序\avr程序\26.ds12c887實時時鐘LCD1602顯示\DS12887.C
L105:
.blkb 2
.area idata
.byte 32,0
.area data(ram, con, rel)
.dbfile D:\開發板\OK400C\程序\avr程序\26.ds12c887實時時鐘LCD1602顯示\DS12887.C
L62:
.blkb 17
.area idata
.byte 'T,'I,'M,'E,58,32,48,56,58,32,48,56,58,32,48,56
.byte 0
.area data(ram, con, rel)
.dbfile D:\開發板\OK400C\程序\avr程序\26.ds12c887實時時鐘LCD1602顯示\DS12887.C
L61:
.blkb 17
.area idata
.byte 'D,'A,'T,'E,58,32,50,48,48,56,45,48,56,45,48,56
.byte 0
.area data(ram, con, rel)
.dbfile D:\開發板\OK400C\程序\avr程序\26.ds12c887實時時鐘LCD1602顯示\DS12887.C
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -