📄 26l.s
字号:
.module _26L.C
.area data(ram, con, rel)
_com1::
.blkb 1
.area idata
.byte 6
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e com1 _com1 c
_com2::
.blkb 1
.area idata
.byte 5
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e com2 _com2 c
_cnt1::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e cnt1 _cnt1 c
_temp::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e temp _temp i
_qiangdu::
.blkb 2
.area idata
.word 368
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e qiangdu _qiangdu i
_disp::
.blkb 2
.area idata
.byte 192,249
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.blkb 2
.area idata
.byte 164,176
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.blkb 2
.area idata
.byte 153,146
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.blkb 2
.area idata
.byte 130,248
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.blkb 2
.area idata
.byte 128,144
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e disp _disp A[10:10]c
_kashu::
.blkb 2
.area idata
.byte 3,0
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e kashu _kashu A[2:2]C
_kawei::
.blkb 1
.area idata
.byte 1
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e kawei _kawei c
_jianshu::
.blkb 1
.area idata
.byte 0
.area data(ram, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbsym e jianshu _jianshu c
.area text(rom, con, rel)
.dbfile G:\AVR\AVR实例程序\实例源文件\read26\26L.C
.dbfunc e delayus _delayus fV
; a -> R16,R17
.even
_delayus::
.dbline -1
.dbline 41
; #include "iot26v.h"
; #include "macros.h"
;
; #define uchar unsigned char
; #define uint unsigned int
;
; #define anjianweikai DDRA|=(1<<7);PORTA&=~(1<<7);
; #define anjianweiguan DDRA&=~(1<<7);
;
; #define fengmingkai PORTB|=(1<<6);PORTB|=(1<<7);
; #define fengmingguan PORTB&=~(1<<6);PORTB&=~(1<<7);
;
; #define rst0 PORTB&=~(1<<5)
; #define rst1 PORTB|=(1<<5)
; #define sda0 DDRB|=(1<<0);PORTB&=~(1<<0);
; #define sda1 DDRB|=(1<<0);PORTB|=(1<<0);
; #define scl0 DDRB|=(1<<2);PORTB&=~(1<<2);
; #define scl1 DDRB|=(1<<2);PORTB|=(1<<2);
; #define sdawei DDRB&=~(1<<0);PORTB|=(1<<0);
;
;
; unsigned char com1=6,com2=5,cnt1=0;
; unsigned int temp=0,qiangdu=368;
;
; unsigned char disp[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
; signed char kashu[2]={3,0};
; unsigned char kawei=1,jianshu=0;
;
; uchar x24c02_read(uchar address); //从24c02的地址address中读取一个字节数据
; void x24c02_write(uchar address,uchar info);//向24c02的address地址中写入一字节数据info
; void x24c02_init(void); //24c02初始化子程序
; void delay1(uchar x);
; void x24c01_init(void);
; void start(void);
; void stop(void);
; void writex(uchar j);
; unsigned char readx(void);
; void clock(void);
; /*延时函数*/
; void delayus(int a) //微秒级
; {
L2:
.dbline 43
; do
; a--;
subi R16,1
sbci R17,0
L3:
.dbline 44
; while(a>1);
ldi R24,1
ldi R25,0
cp R24,R16
cpc R25,R17
brlt L2
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbsym r a 16 I
.dbend
.dbfunc e delayms _delayms fV
; a -> R20,R21
.even
_delayms::
rcall push_gset1
mov R20,R16
mov R21,R17
.dbline -1
.dbline 49
; //WDR();
; }
;
; void delayms(unsigned int a) //毫秒级
; {
rjmp L7
L6:
.dbline 51
.dbline 52
ldi R16,250
ldi R17,0
rcall _delayus
.dbline 53
subi R20,1
sbci R21,0
.dbline 54
L7:
.dbline 50
; while(a!=0)
cpi R20,0
cpc R20,R21
brne L6
X0:
.dbline -2
L5:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r a 20 i
.dbend
.dbfunc e fengming _fengming fV
; a -> R20
.even
_fengming::
rcall push_gset1
mov R20,R16
.dbline -1
.dbline 58
; {
; delayus(250);
; a--;
; }
; }
;
; void fengming(unsigned char a) ////蜂鸣器
; {
.dbline 59
; fengmingkai;
sbi 0x18,6
.dbline 59
sbi 0x18,7
.dbline 59
rjmp L11
L10:
.dbline 61
.dbline 62
dec R20
.dbline 63
ldi R16,1
ldi R17,0
rcall _delayms
.dbline 64
L11:
.dbline 60
; while(a>1)
ldi R24,1
cp R24,R20
brlo L10
.dbline 65
; {
; a--;
; delayms(1);
; }
; fengmingguan;
cbi 0x18,6
.dbline 65
cbi 0x18,7
.dbline 65
.dbline -2
L9:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r a 20 c
.dbend
.dbfunc e x24c02_init _x24c02_init fV
.even
_x24c02_init::
.dbline -1
.dbline 69
; }
;
; void x24c02_init(void)
; {
.dbline 70
; scl1; delayus(1); sda1; delayus(1);
sbi 0x17,2
.dbline 70
sbi 0x18,2
.dbline 70
.dbline 70
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 70
sbi 0x17,0
.dbline 70
sbi 0x18,0
.dbline 70
.dbline 70
ldi R16,1
ldi R17,0
rcall _delayus
.dbline -2
L13:
.dbline 0 ; func end
ret
.dbend
.dbfunc e start _start fV
.even
_start::
.dbline -1
.dbline 73
; }
; void start(void)
; {
.dbline 74
; sda1; delayus(1); scl1;delayus(1); sda0; delayus(1); scl0; delayus(1);
sbi 0x17,0
.dbline 74
sbi 0x18,0
.dbline 74
.dbline 74
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 74
sbi 0x17,2
.dbline 74
sbi 0x18,2
.dbline 74
.dbline 74
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 74
sbi 0x17,0
.dbline 74
cbi 0x18,0
.dbline 74
.dbline 74
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 74
sbi 0x17,2
.dbline 74
cbi 0x18,2
.dbline 74
.dbline 74
ldi R16,1
ldi R17,0
rcall _delayus
.dbline -2
L14:
.dbline 0 ; func end
ret
.dbend
.dbfunc e stop _stop fV
.even
_stop::
.dbline -1
.dbline 77
; }
; void stop(void)
; {
.dbline 78
; sda0; delayus(1); scl1; delayus(1); sda1; delayus(1);
sbi 0x17,0
.dbline 78
cbi 0x18,0
.dbline 78
.dbline 78
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 78
sbi 0x17,2
.dbline 78
sbi 0x18,2
.dbline 78
.dbline 78
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 78
sbi 0x17,0
.dbline 78
sbi 0x18,0
.dbline 78
.dbline 78
ldi R16,1
ldi R17,0
rcall _delayus
.dbline -2
L15:
.dbline 0 ; func end
ret
.dbend
.dbfunc e writex _writex fV
; i -> R20
; temp -> R22
; j -> R20
.even
_writex::
rcall push_gset2
mov R20,R16
.dbline -1
.dbline 81
; }
; void writex(uchar j)
; {
.dbline 83
; uchar i,temp;
; temp=j;
mov R22,R20
.dbline 84
clr R20
rjmp L20
L17:
.dbline 84
; for (i=0;i<8;i++){
.dbline 85
; scl0; delayus(1);
sbi 0x17,2
.dbline 85
cbi 0x18,2
.dbline 85
.dbline 85
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 86
; if((temp&0x80)==0){sda0;}
sbrc R22,7
rjmp L21
.dbline 86
.dbline 86
sbi 0x17,0
.dbline 86
cbi 0x18,0
.dbline 86
.dbline 86
rjmp L22
L21:
.dbline 87
; else{sda1;}
.dbline 87
sbi 0x17,0
.dbline 87
sbi 0x18,0
.dbline 87
.dbline 87
L22:
.dbline 88
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 88
sbi 0x17,2
.dbline 88
sbi 0x18,2
.dbline 88
.dbline 88
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 89
lsl R22
.dbline 90
L18:
.dbline 84
inc R20
L20:
.dbline 84
cpi R20,8
brlo L17
.dbline 91
; delayus(1); scl1; delayus(1);
; temp=temp<<1;
; }
; scl0; delayus(1); sda1; delayus(1);
sbi 0x17,2
.dbline 91
cbi 0x18,2
.dbline 91
.dbline 91
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 91
sbi 0x17,0
.dbline 91
sbi 0x18,0
.dbline 91
.dbline 91
ldi R16,1
ldi R17,0
rcall _delayus
.dbline -2
L16:
rcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r temp 22 c
.dbsym r j 20 c
.dbend
.dbfunc e readx _readx fc
; j -> R20
; i -> R22
; k -> R10
.even
_readx::
rcall push_gset3
.dbline -1
.dbline 95
; }
;
; unsigned char readx(void)
; {
.dbline 96
; uchar i,j,k=0;
clr R10
.dbline 97
; scl0; delayus(1); sda1;
sbi 0x17,2
.dbline 97
cbi 0x18,2
.dbline 97
.dbline 97
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 97
sbi 0x17,0
.dbline 97
sbi 0x18,0
.dbline 97
.dbline 98
clr R22
rjmp L27
L24:
.dbline 98
; for (i=0;i<8;i++){
.dbline 99
; delayus(1); scl1; delayus(1);
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 99
sbi 0x17,2
.dbline 99
sbi 0x18,2
.dbline 99
.dbline 99
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 100
; sdawei;
cbi 0x17,0
.dbline 100
sbi 0x18,0
.dbline 100
.dbline 101
; if ((PINB&0X01)==0){j=0;}
sbic 0x16,0
rjmp L28
.dbline 101
.dbline 101
clr R20
.dbline 101
rjmp L29
L28:
.dbline 102
; else {j=1;}
.dbline 102
ldi R20,1
.dbline 102
L29:
.dbline 103
mov R2,R10
lsl R2
or R2,R20
mov R10,R2
.dbline 103
sbi 0x17,2
.dbline 103
cbi 0x18,2
.dbline 103
.dbline 104
L25:
.dbline 98
inc R22
L27:
.dbline 98
cpi R22,8
brlo L24
.dbline 105
; k=(k<<1)|j; scl0;
; }
; delayus(1); return(k);
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 105
mov R16,R10
.dbline -2
L23:
rcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r j 20 c
.dbsym r i 22 c
.dbsym r k 10 c
.dbend
.dbfunc e clock _clock fV
; i -> R20
.even
_clock::
rcall push_gset1
.dbline -1
.dbline 109
; }
;
; void clock()
; {
.dbline 110
; uchar i=0;
clr R20
.dbline 111
; scl1; delayus(1);
sbi 0x17,2
.dbline 111
sbi 0x18,2
.dbline 111
.dbline 111
ldi R16,1
ldi R17,0
rcall _delayus
.dbline 112
; sdawei;
cbi 0x17,0
.dbline 112
sbi 0x18,0
.dbline 112
rjmp L32
L31:
.dbline 113
.dbline 113
inc R20
.dbline 113
cbi 0x17,0
.dbline 113
sbi 0x18,0
.dbline 113
.dbline 113
L32:
.dbline 113
; while ((PINB&0X01!=0)&&(i<255)){i++;sdawei;}
sbis 0x16,0
rjmp L34
cpi R20,255
brlo L31
L34:
.dbline 114
; scl0; delayus(1);
sbi 0x17,2
.dbline 114
cbi 0x18,2
.dbline 114
.dbline 114
ldi R16,1
ldi R17,0
rcall _delayus
.dbline -2
L30:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbend
.dbfunc e x24c02_read _x24c02_read fc
; i -> R20
; address -> R20
.even
_x24c02_read::
rcall push_gset1
mov R20,R16
.dbline -1
.dbline 117
; }
; uchar x24c02_read(uchar address)
; {
.dbline 119
; uchar i;
; start(); writex(0xa0);
rcall _start
.dbline 119
ldi R16,160
rcall _writex
.dbline 120
; clock(); writex(address);
rcall _clock
.dbline 120
mov R16,R20
rcall _writex
.dbline 121
; clock(); start();
rcall _clock
.dbline 121
rcall _start
.dbline 122
; writex(0xa1); clock();
ldi R16,161
rcall _writex
.dbline 122
rcall _clock
.dbline 123
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -