📄 zuhe.s
字号:
.module zuhe.c
.area data(ram, con, rel)
_d::
.blkb 2
.area idata
.byte 'W,61
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 17,46
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 17,17
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 17,'w
.area data(ram, con, rel)
.blkb 1
.area idata
.byte 35
.area data(ram, con, rel)
.dbfile zuhe.c
.dbsym e d _d A[9:9]c
.area text(rom, con, rel)
.dbfile zuhe.c
.dbfunc e delay _delay fV
; j -> R20
; x -> R16,R17
.even
_delay::
rcall push_gset1
.dbline -1
.dbline 17
; #include<iom8v.h> //??¨1o?ATMEGA8|ì?¨a?¤???t
; #include<macros.h> //??¨1o?¨°?D?3?ê¨??o¨o|ì???§¨°?
; #define uchar unsigned char
; #define uint unsigned int
; #define osccal_addr 0x1ff
; #define fosc 8000000 //??ì??8MHZ
; #define baud 9600 //2?§¨???¨o
; #define LcdCmdPort PORTB
; #define LcdDataPort PORTB
; uint datax;
; char d[9]={0x57,0x3d,0x11,0x2e,0x11,0x11,0x11,0x77,0x23};
; uchar x,datah,K,datal,a[3],i,K,w1,w2,w3,w4;
; float v,W;
;
; //?á?D??¨?¨o?à|죤???ê???16??é??
; void delay(uint x)
; { uchar j;
rjmp L3
L2:
.dbline 19
; while(x-->0)
; {
.dbline 20
; for(j=0;j<5;j++)
clr R20
rjmp L8
L5:
.dbline 21
.dbline 21
.dbline 21
L6:
.dbline 20
inc R20
L8:
.dbline 20
cpi R20,5
brlo L5
.dbline 22
L3:
.dbline 18
movw R2,R16
subi R16,1
sbci R17,0
tst R2
brne L2
tst R3
brne L2
X0:
.dbline -2
.dbline 23
; {;}
; }
; }
L1:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r j 20 c
.dbsym r x 16 i
.dbend
.dbfunc e EEPROM_read _EEPROM_read fc
; uiAddress -> R16,R17
.even
_EEPROM_read::
.dbline -1
.dbline 28
L10:
.dbline 28
L11:
.dbline 28
;
;
;
; unsigned char EEPROM_read(unsigned int uiAddress)
; {while(EECR&(1<<EEWE));
sbic 0x1c,1
rjmp L10
.dbline 29
; EEAR=uiAddress;
out 0x1f,R17
out 0x1e,R16
.dbline 30
; EECR|=(1<<EERE);
sbi 0x1c,0
.dbline 31
; return EEDR;
in R16,0x1d
.dbline -2
L9:
.dbline 0 ; func end
ret
.dbsym r uiAddress 16 i
.dbend
.dbfunc e init_adc _init_adc fV
.even
_init_adc::
.dbline -1
.dbline 35
; }
;
; void init_adc(void)
; {ADMUX=(3<<REFS0); //ADC2???|ì??1?a?¨22?2.56V,??ê?a¨a?§|쨤????ADC0
.dbline 35
ldi R24,192
out 0x7,R24
.dbline 36
; ADCSRA=(1<<ADEN)|(1<<ADSC); //ADC¨o1?¨1?ê?2?é????¥¨°?????áa???ê?2?à??¤??|ì,
out 0x6,R24
.dbline -2
.dbline 38
;
; }
L13:
.dbline 0 ; func end
ret
.dbend
.dbfunc e readadc _readadc fV
.even
_readadc::
.dbline -1
.dbline 41
;
; void readadc(void)
; {datal=ADCL;
.dbline 41
in R2,0x4
sts _datal,R2
.dbline 42
; datah=ADCH;
in R2,0x5
sts _datah,R2
.dbline -2
.dbline 45
; //ADCSRA=(1<<ADSC); //|죤????áa??¥
; //datax=(datah<<8)+datal;
; }
L14:
.dbline 0 ; func end
ret
.dbend
.dbfunc e LcdBusy _LcdBusy fV
.even
_LcdBusy::
.dbline -1
.dbline 50
;
; void LcdBusy(void); /* LCD???ì?????? */
;
; void LcdBusy()
; {
.dbline 52
;
; PORTC &= ~(1<<PORTC4);
cbi 0x15,4
.dbline 53
; PORTC |= (1<<PORTC5);
sbi 0x15,5
.dbline 54
; LcdCmdPort = 0xff;
ldi R24,255
out 0x18,R24
.dbline 55
; DDRB=0x00;
clr R2
out 0x17,R2
.dbline 56
; PORTC |= (1<<PORTC3);
sbi 0x15,3
.dbline 57
; PORTC &= ~(1<<PORTC3);
cbi 0x15,3
rjmp L17
L16:
.dbline 59
.dbline 61
cbi 0x15,3
.dbline 62
sbi 0x15,3
.dbline 63
L17:
.dbline 58
; while ((PINB&0x80)!=0)
sbic 0x16,7
rjmp L16
.dbline 64
; {
;
; PORTC &= ~(1<<PORTC3);
; PORTC |= (1<<PORTC3);
; }
; PORTC |= (1<<PORTC3);
sbi 0x15,3
.dbline 65
; DDRB=0xff;
ldi R24,255
out 0x17,R24
.dbline -2
.dbline 67
; //LcdDelay(500);
; }
L15:
.dbline 0 ; func end
ret
.dbend
.dbfunc e LcdXY _LcdXY fV
; y -> R22
; x -> R20
.even
_LcdXY::
rcall push_gset2
mov R22,R18
mov R20,R16
.dbline -1
.dbline 74
;
;
;
;
; void LcdXY(char,char); /* LCD?????¨?????? */
; void LcdXY(char x,char y)
; {
.dbline 76
;
; if ((y&0x01)!=0)LcdCmd(0x80|(x-1));
sbrs R22,0
rjmp L20
.dbline 76
mov R16,R20
clr R17
subi R16,1
sbci R17,0
ori R16,128
rcall _LcdCmd
rjmp L21
L20:
.dbline 77
mov R16,R20
clr R17
subi R16,1
sbci R17,0
ori R16,192
rcall _LcdCmd
L21:
.dbline -2
.dbline 80
; else LcdCmd(0xC0|(x-1));
;
;
; }
L19:
rcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r y 22 c
.dbsym r x 20 c
.dbend
.dbfunc e LcdCmd _LcdCmd fV
; c -> R20
.even
_LcdCmd::
rcall push_gset1
mov R20,R16
.dbline -1
.dbline 84
;
; void LcdCmd(char); /* LCD?????ü?????? */
; void LcdCmd(char c)
; {
.dbline 86
;
; LcdBusy();
rcall _LcdBusy
.dbline 87
; PORTC |= (1<<PORTC3);
sbi 0x15,3
.dbline 88
; PORTC &= ~(1<<PORTC4);
cbi 0x15,4
.dbline 89
; PORTC &= ~(1<<PORTC5);
cbi 0x15,5
.dbline 92
; //PORTC &= ~(1<<PORTC3);
;
; LcdCmdPort = c;
out 0x18,R20
.dbline 93
; delay(500);
ldi R16,500
ldi R17,1
rcall _delay
.dbline 94
; PORTC &= ~(1<<PORTC3);
cbi 0x15,3
.dbline -2
.dbline 96
;
; }
L22:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbend
.dbfunc e LcdData _LcdData fV
; c -> R20
.even
_LcdData::
rcall push_gset1
mov R20,R16
.dbline -1
.dbline 101
;
;
; void LcdData(char); /* LCD???????????? */
; void LcdData(char c)
; {
.dbline 103
;
; LcdBusy();
rcall _LcdBusy
.dbline 104
; PORTC |= (1<<PORTC3);
sbi 0x15,3
.dbline 105
; PORTC |= (1<<PORTC4);
sbi 0x15,4
.dbline 106
; PORTC &= ~(1<<PORTC5);
cbi 0x15,5
.dbline 109
; //PORTC &= ~(1<<PORTC3);
;
; LcdDataPort = c;
out 0x18,R20
.dbline 110
; delay(500);
ldi R16,500
ldi R17,1
rcall _delay
.dbline 111
; PORTC &= ~(1<<PORTC3);
cbi 0x15,3
.dbline -2
.dbline 112
; }
L23:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbend
.dbfunc e init_wdt _init_wdt fV
.even
_init_wdt::
.dbline -1
.dbline 115
;
; void init_wdt(void)
; {WDTCR=(1<<WDCE)|(1<<WDE);
.dbline 115
ldi R24,24
out 0x21,R24
.dbline 116
; WDTCR=(0<<WDCE)|(1<<WDE)|(1<<WDP2)|(1<<WDP1)|(1<<WDP0);
ldi R24,15
out 0x21,R24
.dbline -2
.dbline 118
; /*看门狗允许、溢出时间2.1s,p44*/
; }
L24:
.dbline 0 ; func end
ret
.dbend
.dbfunc e LcdInit _LcdInit fV
.even
_LcdInit::
.dbline -1
.dbline 122
;
; void LcdInit(void); /* LCD?????????? */
; void LcdInit()
; {
.dbline 123
; PORTC |= (1<<PORTC4);
sbi 0x15,4
.dbline 124
; PORTC |= (1<<PORTC5);
sbi 0x15,5
.dbline 125
; PORTC |= (1<<PORTC3);
sbi 0x15,3
.dbline 126
; LcdCmd(0x38);
ldi R16,56
rcall _LcdCmd
.dbline 127
; LcdCmd(0x38);
ldi R16,56
rcall _LcdCmd
.dbline 128
; LcdCmd(0x06);
ldi R16,6
rcall _LcdCmd
.dbline 129
; LcdCmd(0x0c);
ldi R16,12
rcall _LcdCmd
.dbline 130
; LcdCmd(0x01);
ldi R16,1
.dbline -2
.dbline 131
; }
L25:
.dbline 0 ; func end
rjmp _LcdCmd
.dbend
.dbfunc e LcdClr _LcdClr fV
.even
_LcdClr::
.dbline -1
.dbline 136
;
;
; void LcdClr(void); /* LCD???????? */
; void LcdClr()
; {
.dbline 137
; LcdCmd(0x01);
ldi R16,1
.dbline -2
.dbline 138
; }
L26:
.dbline 0 ; func end
rjmp _LcdCmd
.dbend
.dbfunc e LcdStr _LcdStr fV
; d -> R20,R21
; c -> R22,R23
.even
_LcdStr::
rcall push_gset2
movw R22,R16
.dbline -1
.dbline 146
;
;
;
;
;
; void LcdStr(char *); /* ????×?·??????? */
; void LcdStr(char *c)
; {
.dbline 147
; int d=0;
clr R20
clr R21
rjmp L29
L28:
.dbline 149
movw R2,R20
subi R20,255 ; offset = 1
sbci R21,255
movw R30,R2
add R30,R22
adc R31,R23
ldd R16,z+0
rcall _LcdData
L29:
.dbline 148
; while (c[d]!=0)
movw R30,R20
add R30,R22
adc R31,R23
ldd R2,z+0
tst R2
brne L28
.dbline -2
.dbline 151
; LcdData(c[d++]); /* char of LCM */
;
; }
L27:
rcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r d 20 I
.dbsym r c 22 pc
.dbend
.dbfunc e main _main fV
.even
_main::
sbiw R28,12
.dbline -1
.dbline 156
;
;
;
; void main(void)
; {
.dbline 157
; delay(2000);
ldi R16,2000
ldi R17,7
rcall _delay
.dbline 158
; OSCCAL=EEPROM_read(osccal_addr);
ldi R16,511
ldi R17,1
rcall _EEPROM_read
out 0x31,R16
.dbline 159
; DDRC=0xfe;
ldi R24,254
out 0x14,R24
.dbline 160
; DDRB=0Xff;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -