?? gb.s
字號:
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
cp R20,R2
cpc R21,R3
cpc R22,R4
cpc R23,R5
brlo L267
.dbline 517
; {
.dbline 518
; clrout(qenum);
lds R16,_qenum
xcall _clrout
.dbline 519
; }
L267:
.dbline 521
;
; imax=imax_1=imax_2=imax_3=tempi=0;
ldi R20,0
ldi R21,0
ldi R22,0
ldi R23,0
movw R30,R28
std z+8,R20
std z+9,R21
std z+10,R22
std z+11,R23
ldi R20,0
ldi R21,0
ldi R22,0
ldi R23,0
movw R2,R20
sts _imax_3+1,R3
sts _imax_3,R2
sts _imax_2+1,R3
sts _imax_2,R2
sts _imax_1+1,R3
sts _imax_1,R2
sts _imax+1,R3
sts _imax,R2
.dbline 522
; umax=umax_1=umax_2=umax_3=tempu=0;
ldi R20,0
ldi R21,0
ldi R22,0
ldi R23,0
movw R30,R28
std z+4,R20
std z+5,R21
std z+6,R22
std z+7,R23
ldi R20,0
ldi R21,0
ldi R22,0
ldi R23,0
movw R2,R20
sts _umax_3+1,R3
sts _umax_3,R2
sts _umax_2+1,R3
sts _umax_2,R2
sts _umax_1+1,R3
sts _umax_1,R2
sts _umax+1,R3
sts _umax,R2
.dbline 523
; phamax=phamax_1=phamax_2=phamax_3=0;
clr R2
clr R3
sts _phamax_3+1,R3
sts _phamax_3,R2
sts _phamax_2+1,R3
sts _phamax_2,R2
sts _phamax_1+1,R3
sts _phamax_1,R2
sts _phamax+1,R3
sts _phamax,R2
.dbline 525
;
; }
L253:
.dbline 526
; PORTA= ~(PORTC&0X0F)&zzcode;
lds R2,_zzcode
in R24,0x15
andi R24,15
com R24
and R24,R2
out 0x1b,R24
.dbline -2
L65:
adiw R28,16
xcall pop_gset5
xcall pop_lset
.dbline 0 ; func end
reti
.dbsym l k3 1 c
.dbsym l k2 1 c
.dbsym l zznum 1 c
.dbsym l i2 1 c
.dbsym l temppha 12 l
.dbsym r tphase 10 c
.dbsym l tempi 8 l
.dbsym l tempu 4 l
.dbsym l tempui 0 l
.dbsym r t1 12 c
.dbsym r errzs 12 c
.dbsym r k1 10 c
.dbsym r i3 10 c
.dbsym r i1 14 c
.dbend
.dbfunc e timer1_init _timer1_init fV
.even
_timer1_init::
.dbline -1
.dbline 537
;
; }
;
; //TIMER1 initialize - prescale:8
; // WGM: 0) Normal, TOP=0xFFFF
; // desired value: 1Hz
; // actual value: Out of range
;
;
; void timer1_init(void)
; {
.dbline 538
; TCCR1B = 0x00; //stop
clr R2
out 0x2e,R2
.dbline 539
; TCNT1H = 0x00 /*INVALID SETTING*/; //setup
out 0x2d,R2
.dbline 540
; TCNT1L = 0x00 /*INVALID SETTING*/;
out 0x2c,R2
.dbline 541
; OCR1AH = 0x00 /*INVALID SETTING*/;
out 0x2b,R2
.dbline 542
; OCR1AL = 0x00 /*INVALID SETTING*/;
out 0x2a,R2
.dbline 543
; OCR1BH = 0x00 /*INVALID SETTING*/;
out 0x29,R2
.dbline 544
; OCR1BL = 0x00 /*INVALID SETTING*/;
out 0x28,R2
.dbline 545
; OCR1CH = 0x00 /*INVALID SETTING*/;
sts 121,R2
.dbline 546
; OCR1CL = 0x00 /*INVALID SETTING*/;
sts 120,R2
.dbline 547
; ICR1H = 0x00 /*INVALID SETTING*/;
out 0x27,R2
.dbline 548
; ICR1L = 0x00 /*INVALID SETTING*/;
out 0x26,R2
.dbline 549
; TCCR1A = 0x00;
out 0x2f,R2
.dbline 550
; TCCR1B = 0xC2; //start Timer prescal=8
ldi R24,194
out 0x2e,R24
.dbline -2
L269:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 44
jmp _timer1_capt_isr
.area text(rom, con, rel)
.dbfile C:\硬件ddb\功補\allinone\GB.C
.dbfunc e timer1_capt_isr _timer1_capt_isr fV
; value -> R16,R17
.even
_timer1_capt_isr::
st -y,R2
st -y,R3
st -y,R16
st -y,R17
st -y,R24
in R2,0x3f
st -y,R2
.dbline -1
.dbline 555
; }
;
; #pragma interrupt_handler timer1_capt_isr:12
; void timer1_capt_isr(void)
; {
.dbline 557
; unsigned int value;
; ADCSRA &=0Xf7;//off adc interrupter
in R24,0x6
andi R24,247
out 0x6,R24
.dbline 558
; if ((TCCR1B&0X40)==0) //DOWN EDGE
in R2,0x2e
sbrc R2,6
rjmp L271
.dbline 560
; //timer 1 input capture event, read (int)value in ICR1 using;
; {
.dbline 561
; value=ICR1L; //Read low byte first (important)
in R16,0x26
clr R17
.dbline 562
; value|=(int)ICR1H << 8; //Read high byte and shift into top byte
in R2,0x27
clr R3
mov R3,R2
clr R2
or R16,R2
or R17,R3
.dbline 564
;
; TCCR1B ^=0X40;//chang ICES1
ldi R24,64
in R2,0x2e
eor R2,R24
out 0x2e,R2
.dbline 565
; TIFR |=(1<<5); //off icp1 interuppter flag
in R24,0x36
ori R24,32
out 0x36,R24
.dbline 568
;
;
; if(value>=phamax){ phamax_3=phamax_2;phamax_2=phamax_1;phamax_1=phamax;phamax=value;}
lds R2,_phamax
lds R3,_phamax+1
cp R16,R2
cpc R17,R3
brlo L273
.dbline 568
.dbline 568
lds R2,_phamax_2
lds R3,_phamax_2+1
sts _phamax_3+1,R3
sts _phamax_3,R2
.dbline 568
lds R2,_phamax_1
lds R3,_phamax_1+1
sts _phamax_2+1,R3
sts _phamax_2,R2
.dbline 568
lds R2,_phamax
lds R3,_phamax+1
sts _phamax_1+1,R3
sts _phamax_1,R2
.dbline 568
sts _phamax+1,R17
sts _phamax,R16
.dbline 568
xjmp L272
L273:
.dbline 569
; else{ if (value>=phamax_1) { phamax_3=phamax_2;phamax_2=phamax_1;phamax_1=value;}
.dbline 569
lds R2,_phamax_1
lds R3,_phamax_1+1
cp R16,R2
cpc R17,R3
brlo L275
.dbline 569
.dbline 569
lds R2,_phamax_2
lds R3,_phamax_2+1
sts _phamax_3+1,R3
sts _phamax_3,R2
.dbline 569
lds R2,_phamax_1
lds R3,_phamax_1+1
sts _phamax_2+1,R3
sts _phamax_2,R2
.dbline 569
sts _phamax_1+1,R17
sts _phamax_1,R16
.dbline 569
xjmp L272
L275:
.dbline 570
; else {if (value>=phamax_2) { phamax_3=phamax_2;phamax_2=value;}
.dbline 570
lds R2,_phamax_2
lds R3,_phamax_2+1
cp R16,R2
cpc R17,R3
brlo L277
.dbline 570
.dbline 570
sts _phamax_3+1,R3
sts _phamax_3,R2
.dbline 570
sts _phamax_2+1,R17
sts _phamax_2,R16
.dbline 570
xjmp L272
L277:
.dbline 571
; else if (value>=phamax_3) phamax_3=value;
lds R2,_phamax_3
lds R3,_phamax_3+1
cp R16,R2
cpc R17,R3
brlo L272
.dbline 571
sts _phamax_3+1,R17
sts _phamax_3,R16
.dbline 572
; }
.dbline 573
; }
.dbline 575
;
; }
xjmp L272
L271:
.dbline 577
; else
; {
.dbline 578
; TCNT1=0;
clr R2
clr R3
out 0x2d,R3
out 0x2c,R2
.dbline 579
; TCCR1B ^=0X40;//chang ICES1
ldi R24,64
in R2,0x2e
eor R2,R24
out 0x2e,R2
.dbline 580
; TIFR |=(1<<5);
in R24,0x36
ori R24,32
out 0x36,R24
.dbline 581
; PORTB|=(1<<6);//TET
sbi 0x18,6
.dbline 582
; }
L272:
.dbline 583
; ADCSRA |=0xD8; //AD INTERUPPTER ENABLED
in R24,0x6
ori R24,216
out 0x6,R24
.dbline 584
; return;
.dbline -2
L270:
ld R2,y+
out 0x3f,R2
ld R24,y+
ld R17,y+
ld R16,y+
ld R3,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbsym r value 16 i
.dbend
.dbfunc e adc_init _adc_init fV
.even
_adc_init::
.dbline -1
.dbline 589
; }
; //ADC initialize
; // Conversion time: 52uS
; void adc_init(void)
; {
.dbline 590
; ADCSRA = 0x00; //disable adc
clr R2
out 0x6,R2
.dbline 591
; ADMUX = 0x00; //select adc input 0
out 0x7,R2
.dbline 592
; ACSR = 0x80;//no anog comp
ldi R24,128
out 0x8,R24
.dbline 593
; ADCSRA = 0xCD;//prescal=32
ldi R24,205
out 0x6,R24
.dbline -2
L281:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 84
jmp _adc_isr
.area text(rom, con, rel)
.dbfile C:\硬件ddb\功補\allinone\GB.C
.dbfunc e adc_isr _adc_isr fV
; value -> R16,R17
.even
_adc_isr::
st -y,R2
st -y,R3
st -y,R16
st -y,R17
st -y,R24
st -y,R30
in R2,0x3f
st -y,R2
.dbline -1
.dbline 598
; }
;
; #pragma interrupt_handler adc_isr:22
; void adc_isr(void)
; {signed int value;
.dbline 600
; //conversion complete, read value (int) using...
; value=ADCL; //Read 8 low bits first (important)
in R16,0x4
clr R17
.dbline 601
; value|=(int)ADCH << 8; //read 2 high bits and shift into top byte
in R2,0x5
clr R3
mov R3,R2
clr R2
or R16,R2
or R17,R3
.dbline 602
; if(value<0) value=0;
cpi R16,0
ldi R30,0
cpc R17,R30
brge L283
.dbline 602
clr R16
clr R17
L283:
.dbline 603
; ADMUX ^=0X01; //num0 and num1 chang
ldi R24,1
in R2,0x7
eor R2,R24
out 0x7,R2
.dbline 604
; if ((ADMUX & 0X01)==0)
sbic 0x7,0
rjmp L285
.dbline 605
; {if (value>=imax){ imax_3=imax_2;imax_2=imax_1;imax_1=imax;imax=value;}
.dbline 605
lds R2,_imax
lds R3,_imax+1
cp R16,R2
cpc R17,R3
brlo L287
.dbline 605
.dbline 605
lds R2,_imax_2
lds R3,_imax_2+1
sts _imax_3+1,R3
sts _imax_3,R2
.dbline 605
lds R2,_imax_1
lds R3,_imax_1+1
sts _imax_2+1,R3
sts _imax_2,R2
.dbline 605
lds R2,_imax
lds R3,_imax+1
sts _imax_1+1,R3
sts _imax_1,R2
.dbline 605
sts _imax+1,R17
sts _imax,R16
.dbline 605
xjmp L286
L287:
.dbline 606
; else{ if (value>=imax_1) { imax_3=imax_2;imax_2=imax_1;imax_1=value;}
.dbline 606
lds R2,_imax_1
lds R3,_imax_1+1
cp R16,R2
cpc R17,R3
brlo L289
.dbline 606
.dbline 606
lds R2,_imax_2
lds R3,_imax_2+1
sts _imax_3+1,R3
sts _imax_3,R2
.dbline 606
lds R2,_imax_1
lds R3,_imax_1+1
sts _imax_2+1,R3
sts _imax_2,R2
.dbline 606
sts _imax_1+1,R17
sts _imax_1,R16
.dbline 606
xjmp L286
L289:
.dbline 607
; else{ if (value>=imax_2) { imax_3=imax_2;imax_2=value;}
.dbline 607
lds R2,_imax_2
lds R3,_imax_2+1
cp R16,R2
cpc R17,R3
brlo L291
.dbline 607
.dbline 607
sts _imax_3+1,R3
sts _imax_3,R2
.dbline 607
sts _imax_2+1,R17
sts _imax_2,R16
.dbline 607
xjmp L286
L291:
.dbline 608
; else {if (value>=imax_3) imax_3=value;}
.dbline 608
lds R2,_imax_3
lds R3,_imax_3+1
cp R16,R2
cpc R17,R3
brsh X10
xjmp L286
X10:
.dbline 608
sts _imax_3+1,R17
sts _imax_3,R16
.dbline 608
.dbline 609
; }
.dbline 610
; }
.dbline 611
; }
xjmp L286
L285:
.dbline 613
; else
; {if (value>=umax){ umax_3=umax_2;umax_2=umax_1;umax_1=umax;umax=value;}
.dbline 613
lds R2,_umax
lds R3,_umax+1
cp R16,R2
cpc R17,R3
brlo L295
.dbline 613
.dbline 613
lds R2,_umax_2
lds R3,_umax_2+1
sts _umax_3+1,R3
sts _umax_3,R2
.dbline 613
lds R2,_umax_1
lds R3,_umax_1+1
sts _umax_2+1,R3
sts _umax_2,R2
.dbline 613
lds R2,_umax
lds R3,_umax+1
sts _umax_1+1,R3
sts _umax_1,R2
.dbline 613
sts _umax+1,R17
sts _umax,R16
.dbline 613
xjmp L296
L295:
.dbline 614
; else { if (value>=umax_1) { umax_3=umax_2;umax_2=umax_1;umax_1=value;}
.dbline 614
lds R2,_umax_1
lds R3,_umax_1+1
cp R16,R2
cpc R17,R3
brlo L297
.dbline 614
.dbline 614
lds R2,_umax_2
lds R3,_umax_2+1
sts _umax_3+1,R3
sts _umax_3,R2
.dbline 614
lds R2,_umax_1
lds R3,_umax_1+1
sts _umax_2+1,R3
sts _umax_2,R2
.dbline 614
sts _umax_1+1,R17
sts _umax_1,R16
.dbline 614
xjmp L298
L297:
.dbline 615
; else{ if (value>=umax_2) { umax_3=umax_2;umax_2=value;}
.dbline 615
lds R2,_umax_2
lds R3,_umax_2+1
cp R16,R2
cpc R17,R3
brlo L299
.dbline 615
.dbline 615
sts _umax_3+1,R3
sts _umax_3,R2
.dbline 615
sts _umax_2+1,R17
sts _umax_2,R16
.dbline 615
xjmp L300
L299:
.dbline 616
; else if (value>=umax_3) umax_3=value;
lds R2,_umax_3
lds R3,_umax_3+1
cp R16,R2
cpc R17,R3
brlo L301
.dbline 616
sts _umax_3+1,R17
sts _umax_3,R16
L301:
L300:
.dbline 617
; }
L298:
.dbline 618
; }
L296:
.dbline 619
; }
L286:
.dbline 620
; ADCSRA |=0X40;
sbi 0x6,6
.dbline 621
; return;
.dbline -2
L282:
ld R2,y+
out 0x3f,R2
ld R30,y+
ld R24,y+
ld R17,y+
ld R16,y+
ld R3,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbsym r value 16 I
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 626
; }
;
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
.dbline 628
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 629
; XDIV = 0x00; //xtal divider
clr R2
out 0x3c,R2
.dbline 630
; XMCRA = 0x00; //external memory
sts 109,R2
.dbline 631
; port_init();
xcall _port_init
.dbline 633
; // watchdog_init();
; timer1_init();
xcall _timer1_init
.dbline 634
; timer2_init();
xcall _timer2_init
.dbline 635
; adc_init();
xcall _adc_init
.dbline 637
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 638
; EICRA = 0x00; //extended ext ints
sts 106,R2
.dbline 639
; EICRB = 0x00; //extended ext ints
out 0x3a,R2
.dbline 640
; EIMSK = 0x00;
out 0x39,R2
.dbline 641
; TIMSK = 0x60; //timer interrupt sources
ldi R24,96
out 0x37,R24
.dbline 642
; SEI();
sei
.dbline -2
L303:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 648
; //all peripherals are now initialized
; }
;
;
; void main(void)
; { init_devices();
.dbline 648
xcall _init_devices
.dbline 649
; pfcz[0].s=1; pfcz[0].zznum=0;
ldi R24,1
sts _pfcz,R24
.dbline 649
clr R2
sts _pfcz+5,R2
.dbline 650
; pfcz[1].s=2; pfcz[1].zznum=0;
ldi R24,2
sts _pfcz+8,R24
.dbline 650
sts _pfcz+8+5,R2
.dbline 651
; pfcz[2].s=3; pfcz[2].zznum=0;
ldi R24,3
sts _pfcz+16,R24
.dbline 651
sts _pfcz+16+5,R2
.dbline 652
; pfcz[3].s=4; pfcz[3].zznum=0;
ldi R24,4
sts _pfcz+24,R24
.dbline 652
sts _pfcz+24+5,R2
.dbline 653
; zzcode=0xff;
ldi R24,255
sts _zzcode,R24
.dbline 654
; count=0;
ldi R20,0
ldi R21,0
ldi R22,0
ldi R23,0
sts _count+1,R21
sts _count,R20
sts _count+2+1,R23
sts _count+2,R22
.dbline 655
; cutpulse=1;
ldi R24,1
sts _cutpulse,R24
.dbline 65
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -