?? ad.s
字號(hào):
.module AD.c
.area text(rom, con, rel)
.dbfile D:\ATP_AVR\AD.c
.dbfunc e AD_Init _AD_Init fV
.even
_AD_Init::
.dbline -1
.dbline 4
; #include "public.h"
;
; void AD_Init(void)
; {
.dbline 5
; SETBIT(AD_RST_OUT, AD_RST);
sbi 0x12,1
.dbline 6
; CLEARBIT(AD_RST_OUT, AD_RST);
cbi 0x12,1
.dbline 7
; NOP();
nop
.dbline 8
; NOP();
nop
.dbline 9
; SETBIT(AD_RST_OUT, AD_RST);
sbi 0x12,1
.dbline 10
; NOP();
nop
.dbline 11
; NOP();
nop
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e AD_GetData _AD_GetData fV
; uctemp -> y+0
; pusOutBuff -> R16,R17
.even
_AD_GetData::
sbiw R28,2
.dbline -1
.dbline 15
; }
;
; void AD_GetData(u16* pusOutBuff)
; {
.dbline 18
; u8 uctemp[2];
; //u16 usADData[4]={0,0,0,0};
; pusOutBuff[0]=0;
clr R2
clr R3
movw R30,R16
std z+1,R3
std z+0,R2
.dbline 19
; pusOutBuff[1]=0;
std z+3,R3
std z+2,R2
.dbline 20
; pusOutBuff[2]=0;
movw R30,R16
std z+5,R3
std z+4,R2
.dbline 21
; pusOutBuff[3]=0;
movw R30,R16
std z+7,R3
std z+6,R2
.dbline 25
;
;
; //hold channel A and channel B
; PORTD=PORTD&0x9F; //bring HoldA,HoldB low
in R24,0x12
andi R24,159
out 0x12,R24
.dbline 26
; PORTD=PORTD|0xE0; //bring HoldA,HoldB high
in R24,0x12
ori R24,224
out 0x12,R24
L3:
.dbline 31
L4:
.dbline 31
;
; //PORTD=PORTD&0xDF; //bring HoldA,HoldB low
; //PORTD=PORTD|0xE0; //bring HoldA,HoldB high
;
; while(CHECKBIT(AD_BUSY_IN, AD_BUSY));//wait until first convertion is started
sbic 0x10,0
rjmp L3
L6:
.dbline 32
L7:
.dbline 32
; while(0x00==CHECKBIT(AD_BUSY_IN, AD_BUSY));//wait until first convertion is finished
sbis 0x10,0
rjmp L6
L9:
.dbline 33
L10:
.dbline 33
; while(CHECKBIT(AD_BUSY_IN, AD_BUSY));//wait until second convertion is started
sbic 0x10,0
rjmp L9
L12:
.dbline 34
L13:
.dbline 34
; while(0x00==CHECKBIT(AD_BUSY_IN, AD_BUSY));//wait until second convertion is finished
sbis 0x10,0
rjmp L12
.dbline 35
; CLEARBIT(AD_CS_OUT, AD_CS);//select the ads7864
lds R24,101
andi R24,254
sts 101,R24
.dbline 37
;
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 39
;
; PORTD=PORTD|0x0C;
in R24,0x12
ori R24,12
out 0x12,R24
.dbline 40
; PORTD=PORTD&0xE3; //A2A1A0:000 channel A0
in R24,0x12
andi R24,227
out 0x12,R24
.dbline 41
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 42
; NOP();
nop
.dbline 43
; uctemp[0]=PINC; //first byte
in R2,0x13
std y+0,R2
.dbline 44
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 45
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 46
; NOP();
nop
.dbline 47
; uctemp[1]=PINC; //second byte
in R2,0x13
std y+1,R2
.dbline 48
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 49
; pusOutBuff[0]=(uctemp[1]&0x0F)<<8;
mov R24,R2
clr R25
andi R24,15
andi R25,0
mov R25,R24
clr R24
movw R30,R16
std z+1,R25
std z+0,R24
.dbline 50
; pusOutBuff[0]=pusOutBuff[0]|uctemp[0];
ldd R2,y+0
clr R3
ldd R4,z+0
ldd R5,z+1
or R4,R2
or R5,R3
std z+1,R5
std z+0,R4
.dbline 52
;
; PORTD=PORTD|0x0C;
in R24,0x12
ori R24,12
out 0x12,R24
.dbline 53
; PORTD=PORTD&0xE7; //A2A1A0:001 channel A1
in R24,0x12
andi R24,231
out 0x12,R24
.dbline 54
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 55
; NOP();
nop
.dbline 56
; uctemp[0]=PINC; //first byte
in R2,0x13
std y+0,R2
.dbline 57
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 58
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 59
; NOP();
nop
.dbline 60
; uctemp[1]=PINC; //second byte
in R2,0x13
std y+1,R2
.dbline 61
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 62
; pusOutBuff[1]=(uctemp[1]&0x0F)<<8;
mov R24,R2
clr R25
andi R24,15
andi R25,0
mov R25,R24
clr R24
std z+3,R25
std z+2,R24
.dbline 63
; pusOutBuff[1]=pusOutBuff[1]|uctemp[0];
movw R24,R16
adiw R24,2
ldd R4,y+0
clr R5
movw R30,R24
ldd R6,z+0
ldd R7,z+1
or R6,R4
or R7,R5
std z+1,R7
std z+0,R6
.dbline 67
;
;
;
; PORTD=PORTD|0x0C;
in R24,0x12
ori R24,12
out 0x12,R24
.dbline 68
; PORTD=PORTD&0xEB; //A2A1A0:010 channel B0
in R24,0x12
andi R24,235
out 0x12,R24
.dbline 69
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 70
; NOP();
nop
.dbline 71
; uctemp[0]=PINC; //first byte
in R2,0x13
std y+0,R2
.dbline 72
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 73
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 74
; NOP();
nop
.dbline 75
; uctemp[1]=PINC; //second byte
in R2,0x13
std y+1,R2
.dbline 76
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 77
; pusOutBuff[2]=(uctemp[1]&0x0F)<<8;
mov R24,R2
clr R25
andi R24,15
andi R25,0
mov R25,R24
clr R24
movw R30,R16
std z+5,R25
std z+4,R24
.dbline 78
; pusOutBuff[2]=pusOutBuff[2]|uctemp[0];
movw R24,R16
adiw R24,4
ldd R4,y+0
clr R5
movw R30,R24
ldd R6,z+0
ldd R7,z+1
or R6,R4
or R7,R5
std z+1,R7
std z+0,R6
.dbline 81
;
;
; PORTD=PORTD|0x0C;
in R24,0x12
ori R24,12
out 0x12,R24
.dbline 82
; PORTD=PORTD&0xEF; //A2A1A0:011 channel B1
in R24,0x12
andi R24,239
out 0x12,R24
.dbline 83
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 84
; NOP();
nop
.dbline 85
; uctemp[0]=PINC; //first byte
in R2,0x13
std y+0,R2
.dbline 86
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 87
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 88
; NOP();
nop
.dbline 89
; uctemp[1]=PINC; //second byte
in R2,0x13
std y+1,R2
.dbline 90
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 91
; pusOutBuff[3]=(uctemp[1]&0x0F)<<8;
mov R24,R2
clr R25
andi R24,15
andi R25,0
mov R25,R24
clr R24
movw R30,R16
std z+7,R25
std z+6,R24
.dbline 92
; pusOutBuff[3]=pusOutBuff[3]|uctemp[0];
movw R24,R16
adiw R24,6
ldd R4,y+0
clr R5
movw R30,R24
ldd R6,z+0
ldd R7,z+1
or R6,R4
or R7,R5
std z+1,R7
std z+0,R6
.dbline 94
;
; SETBIT(AD_CS_OUT, AD_CS);//unselect the ads7864
lds R24,101
ori R24,1
sts 101,R24
.dbline -2
L2:
adiw R28,2
.dbline 0 ; func end
ret
.dbsym l uctemp 0 A[2:2]c
.dbsym r pusOutBuff 16 ps
.dbend
.dbfunc e ulAD_GetData _ulAD_GetData fV
; uctemp -> y+8
; sstemp -> y+0
; pulOutBuff -> R16,R17
.even
_ulAD_GetData::
sbiw R28,10
.dbline -1
.dbline 100
;
; }
;
;
; void ulAD_GetData(u32* pulOutBuff)
; {
.dbline 111
; u8 uctemp[2];
; s16 sstemp[4];
;
; //sstemp[0]=0;
; //sstemp[1]=0;
; //sstemp[2]=0;
; //sstemp[3]=0;
;
;
; //hold channel A and channel B
; PORTD=PORTD&0x9F; //bring HoldA,HoldB low
in R24,0x12
andi R24,159
out 0x12,R24
.dbline 112
; PORTD=PORTD|0xE0; //bring HoldA,HoldB high
in R24,0x12
ori R24,224
out 0x12,R24
L24:
.dbline 114
L25:
.dbline 114
;
; while(CHECKBIT(AD_BUSY_IN, AD_BUSY));//wait until first convertion is started
sbic 0x10,0
rjmp L24
L27:
.dbline 115
L28:
.dbline 115
; while(0x00==CHECKBIT(AD_BUSY_IN, AD_BUSY));//wait until first convertion is finished
sbis 0x10,0
rjmp L27
L30:
.dbline 116
L31:
.dbline 116
; while(CHECKBIT(AD_BUSY_IN, AD_BUSY));//wait until second convertion is started
sbic 0x10,0
rjmp L30
L33:
.dbline 117
L34:
.dbline 117
; while(0x00==CHECKBIT(AD_BUSY_IN, AD_BUSY));//wait until second convertion is finished
sbis 0x10,0
rjmp L33
.dbline 118
; CLEARBIT(AD_CS_OUT, AD_CS);//select the ads7864
lds R24,101
andi R24,254
sts 101,R24
.dbline 120
;
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 122
;
; PORTD=PORTD|0x0C;
in R24,0x12
ori R24,12
out 0x12,R24
.dbline 123
; PORTD=PORTD&0xE3; //A2A1A0:000 channel A0
in R24,0x12
andi R24,227
out 0x12,R24
.dbline 124
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 125
; NOP();
nop
.dbline 126
; uctemp[0]=PINC; //first byte
in R2,0x13
std y+8,R2
.dbline 127
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 128
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 129
; NOP();
nop
.dbline 130
; uctemp[1]=PINC; //second byte
in R2,0x13
std y+9,R2
.dbline 131
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 132
; sstemp[0]=(uctemp[1]&0x0F)<<8;
mov R24,R2
clr R25
andi R24,15
andi R25,0
mov R25,R24
clr R24
std y+1,R25
std y+0,R24
.dbline 133
; sstemp[0]=sstemp[0]|uctemp[0];
ldd R2,y+8
clr R3
movw R4,R24
or R4,R2
or R5,R3
std y+1,R5
std y+0,R4
.dbline 134
; sstemp[0]=sstemp[0]<<4;
movw R2,R4
lsl R2
rol R3
lsl R2
rol R3
lsl R2
rol R3
lsl R2
rol R3
std y+1,R3
std y+0,R2
.dbline 136
;
; PORTD=PORTD|0x0C;
in R24,0x12
ori R24,12
out 0x12,R24
.dbline 137
; PORTD=PORTD&0xE7; //A2A1A0:001 channel A1
in R24,0x12
andi R24,231
out 0x12,R24
.dbline 138
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 139
; NOP();
nop
.dbline 140
; uctemp[0]=PINC; //first byte
in R2,0x13
std y+8,R2
.dbline 141
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 142
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 143
; NOP();
nop
.dbline 144
; uctemp[1]=PINC; //second byte
in R2,0x13
std y+9,R2
.dbline 145
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 146
; sstemp[1]=(uctemp[1]&0x0F)<<8;
mov R24,R2
clr R25
andi R24,15
andi R25,0
mov R25,R24
clr R24
std y+3,R25
std y+2,R24
.dbline 147
; sstemp[1]=sstemp[1]|uctemp[0];
ldd R2,y+8
clr R3
movw R4,R24
or R4,R2
or R5,R3
std y+3,R5
std y+2,R4
.dbline 148
; sstemp[1]=sstemp[1]<<4;
movw R2,R4
lsl R2
rol R3
lsl R2
rol R3
lsl R2
rol R3
lsl R2
rol R3
std y+3,R3
std y+2,R2
.dbline 151
;
;
; PORTD=PORTD|0x0C;
in R24,0x12
ori R24,12
out 0x12,R24
.dbline 152
; PORTD=PORTD&0xEB; //A2A1A0:010 channel B0
in R24,0x12
andi R24,235
out 0x12,R24
.dbline 153
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 154
; NOP();
nop
.dbline 155
; uctemp[0]=PINC; //first byte
in R2,0x13
std y+8,R2
.dbline 156
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 157
; CLEARBIT(AD_RD_OUT, AD_RD);
lds R24,101
andi R24,253
sts 101,R24
.dbline 158
; NOP();
nop
.dbline 159
; uctemp[1]=PINC; //second byte
in R2,0x13
std y+9,R2
.dbline 160
; SETBIT(AD_RD_OUT, AD_RD);
lds R24,101
ori R24,2
sts 101,R24
.dbline 161
; sstemp[2]=(uctemp[1]&0x0F)<<8;
mov R24,R2
clr R25
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -