📄 8255.s
字号:
.dbline 448
; write_command((Disp_On));
ldi R16,63
xcall _write_command
.dbline -2
L52:
.dbline 0 ; func end
ret
.dbend
.dbfunc e init_IO _init_IO fV
.even
_init_IO::
.dbline -1
.dbline 452
; }
;
; void init_IO()
; {
.dbline 453
; DDRE=0xEF;
ldi R24,239
out 0x2,R24
.dbline 454
; PORTE=0xff;
ldi R24,255
out 0x3,R24
.dbline 455
; DDRB=0xff;
out 0x17,R24
.dbline 456
; PORTB=0xff;
out 0x18,R24
.dbline 457
; DDRD=0xf0;
ldi R24,240
out 0x11,R24
.dbline 458
; PORTD=0xf0;
out 0x12,R24
.dbline 459
; DDRF=0xfb;
ldi R24,251
sts 97,R24
.dbline 460
; PORTF=0xfb;
sts 98,R24
.dbline 461
; DDRG=0xff;
ldi R24,255
sts 100,R24
.dbline 462
; PORTG=0xff;
sts 101,R24
.dbline 463
; DDRA=0XFF;
out 0x1a,R24
.dbline 464
; PORTA=0XFF;
out 0x1b,R24
.dbline 465
; DDRC=0XFF;
out 0x14,R24
.dbline 466
; PORTC=0XFF;
out 0x15,R24
.dbline -2
L53:
.dbline 0 ; func end
ret
.dbend
.dbfunc e startDA _startDA fV
; i -> R20
; da -> R22,R23
.even
_startDA::
xcall push_xgsetF000
movw R22,R16
.dbline -1
.dbline 472
;
; }
;
; //TLC5615
; void startDA(unsigned int da)
; {
.dbline 474
; unsigned char i;
; da<<=6;
ldi R18,6
ldi R19,0
movw R16,R22
xcall lsl16
movw R22,R16
.dbline 475
; CS_DA0;asm("nop");
cbi 0x12,7
.dbline 475
nop
.dbline 476
; SPI_CLK0;
cbi 0x12,6
.dbline 477
; for (i=0;i<11;i++)
clr R20
xjmp L58
L55:
.dbline 478
; {
.dbline 479
; if((da&0x8000)==0x8000)
movw R24,R22
andi R24,0
andi R25,128
cpi R24,0
ldi R30,128
cpc R25,R30
brne L59
X12:
.dbline 480
; SPI_DATA1;
lds R24,98
ori R24,1
sts 98,R24
L59:
.dbline 481
; if((da&0x8000)!=0x8000)
movw R24,R22
andi R24,0
andi R25,128
cpi R24,0
ldi R30,128
cpc R25,R30
breq L61
X13:
.dbline 482
; SPI_DATA0;
lds R24,98
andi R24,254
sts 98,R24
L61:
.dbline 483
; SPI_CLK1;
sbi 0x12,6
.dbline 484
; da<<=1;
lsl R22
rol R23
.dbline 485
; SPI_CLK0;
cbi 0x12,6
.dbline 486
; }
L56:
.dbline 477
inc R20
L58:
.dbline 477
cpi R20,11
brlo L55
X14:
.dbline 487
; CS_DA1;
sbi 0x12,7
.dbline 488
; SPI_CLK0;
cbi 0x12,6
.dbline 489
; for (i=0;i<11;i++);
clr R20
xjmp L66
L63:
.dbline 489
L64:
.dbline 489
inc R20
L66:
.dbline 489
cpi R20,11
brlo L63
X15:
.dbline -2
L54:
.dbline 0 ; func end
xjmp pop_xgsetF000
.dbsym r i 20 c
.dbsym r da 22 i
.dbend
.dbfunc e startAD _startAD fi
; CHN1 -> R10
; k -> R20
; backcode -> R22,R23
; i -> R14
; CHN -> R12
.even
_startAD::
xcall push_xgsetF0FC
mov R12,R16
.dbline -1
.dbline 493
; }
; //TLC2543
; unsigned int startAD(unsigned char CHN)
; {
.dbline 495
; unsigned char i,CHN1,k;
; unsigned int backcode=0;
clr R22
clr R23
.dbline 497
;
; CHN1=CHN;
mov R10,R12
.dbline 498
; for(k=0;k<50;k++)
clr R20
xjmp L71
L68:
.dbline 500
;
; { CHN=CHN1;backcode=0;
.dbline 500
mov R12,R10
.dbline 500
clr R22
clr R23
.dbline 501
; CHN <<= 4;
mov R24,R12
andi R24,#0x0F
swap R24
mov R12,R24
.dbline 502
; tlc2543_cs1;
lds R24,98
ori R24,8
sts 98,R24
.dbline 503
; tlc2543_clk0;
cbi 0x12,5
.dbline 504
; tlc2543_cs0;
lds R24,98
andi R24,247
sts 98,R24
.dbline 505
; for(i=0;i<12;i++)
clr R14
xjmp L75
L72:
.dbline 506
; {
.dbline 507
; if(i < 8)
mov R24,R14
cpi R24,8
brsh L76
X16:
.dbline 508
; {
.dbline 509
; if(CHN & 0x80) tlc2543_din1;
sbrs R12,7
rjmp L78
X17:
.dbline 509
lds R24,98
ori R24,2
sts 98,R24
xjmp L79
L78:
.dbline 510
; else tlc2543_din0;
lds R24,98
andi R24,253
sts 98,R24
L79:
.dbline 512
;
; CHN<<=1;
lsl R12
.dbline 513
; }
L76:
.dbline 514
; backcode <<= 1;
lsl R22
rol R23
.dbline 515
; if(tlc2543_dout==0x04)
in R24,0x0
andi R24,4
cpi R24,4
brne L80
X18:
.dbline 516
; backcode|= 1;
ori R22,1
xjmp L81
L80:
.dbline 517
; else backcode|= 0;
L81:
.dbline 518
; tlc2543_clk1;
sbi 0x12,5
.dbline 519
; asm("nop");
nop
.dbline 520
; asm("nop");
nop
.dbline 521
; tlc2543_clk0;
cbi 0x12,5
.dbline 522
; }
L73:
.dbline 505
inc R14
L75:
.dbline 505
mov R24,R14
cpi R24,12
brlo L72
X19:
.dbline 525
;
;
; tlc2543_cs1;
lds R24,98
ori R24,8
sts 98,R24
.dbline 526
; date2=(date2*1000+backcode )/1000;
ldi R16,<L82
ldi R17,>L82
xcall elpm32
ldi R24,<_date2
ldi R25,>_date2
st -y,R25
st -y,R24
xcall fpmule1
movw R2,R16
movw R4,R18
movw R16,R22
xcall uint2fp
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R16,R2
movw R18,R4
xcall fpadd2
movw R2,R16
movw R4,R18
ldi R16,<L82
ldi R17,>L82
xcall elpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R16,R2
movw R18,R4
xcall fpdiv2
sts _date2+1,R17
sts _date2,R16
sts _date2+2+1,R19
sts _date2+2,R18
.dbline 528
;
; }
L69:
.dbline 498
inc R20
L71:
.dbline 498
cpi R20,50
brsh X21
xjmp L68
X21:
X20:
.dbline 530
;
; date1=(date2/50)*1000; date2=0;
ldi R16,<L82
ldi R17,>L82
xcall elpm32
movw R2,R16
movw R4,R18
lds R8,_date2+2
lds R9,_date2+2+1
lds R6,_date2
lds R7,_date2+1
ldi R16,<L83
ldi R17,>L83
xcall elpm32
st -y,R19
st -y,R18
st -y,R17
st -y,R16
movw R16,R6
movw R18,R8
xcall fpdiv2x
movw R16,R2
movw R18,R4
xcall fpmule2
xcall fpint
sts _date1+1,R17
sts _date1,R16
.dbline 530
ldi R16,<L84
ldi R17,>L84
xcall elpm32
sts _date2+1,R17
sts _date2,R16
sts _date2+2+1,R19
sts _date2+2,R18
.dbline 532
;
; return(date1) ;
lds R16,_date1
lds R17,_date1+1
.dbline -2
L67:
.dbline 0 ; func end
xjmp pop_xgsetF0FC
.dbsym r CHN1 10 c
.dbsym r k 20 c
.dbsym r backcode 22 i
.dbsym r i 14 c
.dbsym r CHN 12 c
.dbend
.dbfunc e ad9851 _ad9851 fV
; i -> R10
; pinlv -> y+6
.even
_ad9851::
xcall push_arg4
xcall push_xgsetF00C
.dbline -1
.dbline 537
;
; }
; //ad9851
; void ad9851( unsigned long int pinlv)
; { char i;
.dbline 539
;
; kongzhi[0]=0x09;
ldi R24,9
sts _kongzhi,R24
.dbline 540
; kongzhi[1]=12*pinlv/256/256;
ldd R2,y+6
ldd R3,y+7
ldd R4,y+8
ldd R5,y+9
ldi R20,12
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R5
st -y,R4
st -y,R3
st -y,R2
movw R16,R20
movw R18,R22
xcall empy32u
ldi R24,8
ldi R25,0
st -y,R24
xcall lsr32
ldi R24,8
ldi R25,0
st -y,R24
xcall lsr32
sts _kongzhi+1,R16
.dbline 541
; kongzhi[2]=12*pinlv/256%256;
ldd R2,y+6
ldd R3,y+7
ldd R4,y+8
ldd R5,y+9
ldi R20,12
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R5
st -y,R4
st -y,R3
st -y,R2
movw R16,R20
movw R18,R22
xcall empy32u
ldi R24,8
ldi R25,0
st -y,R24
xcall lsr32
movw R2,R16
movw R4,R18
ldi R20,255
ldi R21,0
ldi R22,0
ldi R23,0
and R2,R20
and R3,R21
and R4,R22
and R5,R23
sts _kongzhi+2,R2
.dbline 542
; kongzhi[3]=12*pinlv%256;
ldd R2,y+6
ldd R3,y+7
ldd R4,y+8
ldd R5,y+9
ldi R20,12
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R5
st -y,R4
st -y,R3
st -y,R2
movw R16,R20
movw R18,R22
xcall empy32u
ldi R20,255
ldi R21,0
ldi R22,0
ldi R23,0
movw R2,R16
movw R4,R18
and R2,R20
and R3,R21
and R4,R22
and R5,R23
sts _kongzhi+3,R2
.dbline 543
; kongzhi[4]=1490*pinlv%256;
ldd R2,y+6
ldd R3,y+7
ldd R4,y+8
ldd R5,y+9
ldi R20,210
ldi R21,5
ldi R22,0
ldi R23,0
st -y,R5
st -y,R4
st -y,R3
st -y,R2
movw R16,R20
movw R18,R22
xcall empy32u
ldi R20,255
ldi R21,0
ldi R22,0
ldi R23,0
movw R2,R16
movw R4,R18
and R2,R20
and R3,R21
and R4,R22
and R5,R23
sts _kongzhi+4,R2
.dbline 544
; wclk0; fqud0;
lds R24,98
andi R24,223
sts 98,R24
.dbline 544
lds R24,98
andi R24,191
sts 98,R24
.dbline 545
; for (i=0;i<5;i++)
clr R10
xjmp L93
L90:
.dbline 546
; {
.dbline 547
; ad9851shuju=kongzhi[i];
ldi R24,<_kongzhi
ldi R25,>_kongzhi
mov R30,R10
clr R31
add R30,R24
adc R31,R25
ldd R2,z+0
out 0x1b,R2
.dbline 548
; delay(1);
ldi R16,1
ldi R17,0
xcall _delay
.dbline 549
; wclk1;
lds R24,98
ori R24,32
sts 98,R24
.dbline 550
; delay(1);
ldi R16,1
ldi R17,0
xcall _delay
.dbline 551
; wclk0;
lds R24,98
andi R24,223
sts 98,R24
.dbline 554
;
;
; }
L91:
.dbline 545
inc R10
L93:
.dbline 545
mov R24,R10
cpi R24,5
brlo L90
X22:
.dbline 555
; fqud1;
lds R24,98
ori R24,64
sts 98,R24
.dbline 556
; delay(1);
ldi R16,1
ldi R17,0
xcall _delay
.dbline 557
; fqud0;
lds R24,98
andi R24,191
sts 98,R24
.dbline -2
L85:
.dbline 0 ; func end
xcall pop_xgsetF00C
adiw R28,4
ret
.dbsym r i 10 c
.dbsym l pinlv 6 l
.dbend
.dbfunc e startmsg _startmsg fV
; nm -> R10
; nu -> R20,R21
.even
_startmsg::
xcall push_xgset300C
sbiw R28,2
.dbline -1
.dbline 563
;
; }
;
; //显示部分
; void startmsg()
; {int nu;
.dbline 564
; unsigned char nm=0;
clr R10
.dbline 565
; Clr_Scr();
xcall _Clr_Scr
.dbline 566
; LCDCS21;LCDCS10;
sbi 0x3,2
.dbline 566
cbi 0x3,1
.dbline 567
; disp_hz(0,32, huan);
ldi R24,<_huan
ldi R25,>_huan
std y+1,R25
std y+0,R24
ldi R18,32
clr R16
xcall _disp_hz
.dbline 568
; delay(3000);
ldi R16,3000
ldi R17,11
xcall _delay
.dbline 569
; disp_hz(0,48, ying);
ldi R24,<_ying
ldi R25,>_ying
std y+1,R25
std y+0,R24
ldi R18,48
clr R16
xcall _disp_hz
.dbline 570
; delay(3000);
ldi R16,3000
ldi R17,11
xcall _delay
.dbline 571
; LCDCS20;LCDCS11;
cbi 0x3,2
.dbline 571
sbi 0x3,1
.dbline 572
; disp_hz(0,0, shi);
ldi R24,<_shi
ldi R25,>_shi
std y+1,R25
std y+0,R24
clr R18
clr R16
xcall _disp_hz
.dbline 573
; delay(3000);
ldi R16,3000
ldi R17,11
xcall _delay
.dbline 574
; disp_hz(0,16, yong);
ldi R24,<_yong
ldi R25,>_yong
std y+1,R25
std y+0,R24
ldi R18,16
clr R16
xcall _disp_hz
.dbline 575
; LCDCS21;LCDCS10;
sbi 0x3,2
.dbline 575
cbi 0x3,1
.dbline 576
; disp_hz(4,16, shu);
ldi R24,<_shu
ldi R25,>_shu
std y+1,R25
std y+0,R24
ldi R18,16
ldi R16,4
xcall _disp_hz
.dbline 577
; delay(3000);
ldi R16,3000
ldi R17,11
xcall _delay
.dbline 578
; disp_hz(4,32, kong);
ldi R24,<_kong
ldi R25,>_kong
std y+1,R25
std y+0,R24
ldi R18,32
ldi R16,4
xcall _disp_hz
.dbline 579
; delay(3000);
ldi R16,3000
ldi R17,11
xcall _delay
.dbline 580
; disp_hz(4,48, wen);
ldi R24,<_wen
ldi R25,>_wen
std y+1,R25
std y+0,R24
ldi R18,48
ldi R16,4
xcall _disp_hz
.dbline 581
; delay(3000);
ldi R16,3000
ldi R17,11
xcall _delay
.dbline 582
; LCDCS20;LCDCS11;
cbi 0x3,2
.dbline 582
sbi 0x3,1
.dbline 583
; disp_hz(4,0, dya);
ldi R24,<_dya
ldi R25,>_dya
std y+1,R25
std y+0,R24
clr R18
ldi R16,4
xcall _disp_hz
.dbline 584
; delay(3000);
ldi R16,3000
ldi R17,11
xcall _delay
.dbline 585
; disp_hz(4,16, ddian);
ldi R24,<_ddian
ldi R25,>_ddian
std y+1,R25
std y+0,R24
ldi R18,16
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -