?? ds12997.s
字號:
; _NOP();
nop
.dbline 191
; _NOP();
nop
.dbline 192
; P_AS_1; //鎖存信號高電平
sbi 0x18,3
.dbline 193
; _NOP();
nop
.dbline 194
; _NOP();
nop
.dbline 195
; AD_DDR = 0xFF; //數(shù)據(jù)口設(shè)置為輸出
ldi R24,255
out 0x1a,R24
.dbline 196
; _NOP();
nop
.dbline 197
; _NOP();
nop
.dbline 198
; _NOP();
nop
.dbline 199
; _NOP();
nop
.dbline 200
; AD_PORT = Address; //給出地址
out 0x1b,R16
.dbline 201
; _NOP();
nop
.dbline 202
; _NOP();
nop
.dbline 203
; _NOP();
nop
.dbline 204
; _NOP();
nop
.dbline 205
; _NOP();
nop
.dbline 206
; _NOP();
nop
.dbline 207
; _NOP();
nop
.dbline 208
; _NOP();
nop
.dbline 209
; P_AS_0; //鎖存信號低電平
cbi 0x18,3
.dbline 210
; _NOP();
nop
.dbline 211
; _NOP();
nop
.dbline 212
; P_DS_0; //給出寫信號
cbi 0x18,1
.dbline 213
; _NOP();
nop
.dbline 214
; _NOP();
nop
.dbline 215
; AD_DDR = 0X00; //端口方向設(shè)置為輸入
clr R2
out 0x1a,R2
.dbline 216
; _NOP();
nop
.dbline 217
; _NOP();
nop
.dbline 218
; _NOP();
nop
.dbline 219
; _NOP();
nop
.dbline 220
; temp = AD_PIN; //讀入數(shù)據(jù)
in R20,0x19
.dbline 221
; _NOP();
nop
.dbline 222
; _NOP();
nop
.dbline 223
; _NOP();
nop
.dbline 224
; _NOP();
nop
.dbline 225
; _NOP();
nop
.dbline 226
; _NOP();
nop
.dbline 227
; _NOP();
nop
.dbline 228
; _NOP();
nop
.dbline 229
; P_DS_1; //
sbi 0x18,1
.dbline 230
; _NOP();
nop
.dbline 231
; _NOP();
nop
.dbline 232
; P_AS_1; //
sbi 0x18,3
.dbline 233
; _NOP();
nop
.dbline 234
; _NOP();
nop
.dbline 235
; return temp;
mov R16,R20
.dbline -2
L26:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r temp 20 c
.dbsym r Address 16 c
.dbend
.dbfunc e DS12887_Init _DS12887_Init fV
.even
_DS12887_Init::
.dbline -1
.dbline 240
; }
;
; //DS12887初始化
; void DS12887_Init(void)
; {
.dbline 241
; DS12887_Write(0x0a, 0x20); //打開振蕩器,啟動DS12887
ldi R18,32
ldi R16,10
xcall _DS12887_Write
.dbline 242
; DS12887_Write(0x0b, 0x86); //禁止更新,接下來初始化數(shù)據(jù),即寫入時間,日期等
ldi R18,134
ldi R16,11
xcall _DS12887_Write
.dbline 243
; DS12887_Write(0x0b, 0x06); //正常更新,二進制格式,24進制小時
ldi R18,6
ldi R16,11
xcall _DS12887_Write
.dbline -2
L27:
.dbline 0 ; func end
ret
.dbend
.dbfunc e DS12887_SetTime _DS12887_SetTime fV
; Value -> R22
; Address -> R20
.even
_DS12887_SetTime::
xcall push_gset2
mov R22,R18
mov R20,R16
.dbline -1
.dbline 250
; }
;
;
;
; //設(shè)置時間函數(shù)
; void DS12887_SetTime( uchar Address, uchar Value)
; {
.dbline 251
; DS12887_Write(0x0b, 0x86); //禁止更新,接下來初始化數(shù)據(jù),即寫入時間,日期等
ldi R18,134
ldi R16,11
xcall _DS12887_Write
.dbline 252
; DS12887_Write(Address,Value);
mov R18,R22
mov R16,R20
xcall _DS12887_Write
.dbline 253
; DS12887_Write(0x0b, 0x06); //正常更新,二進制格式,24進制小時
ldi R18,6
ldi R16,11
xcall _DS12887_Write
.dbline -2
L28:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r Value 22 c
.dbsym r Address 20 c
.dbend
.dbfunc e DS12887_GetTime _DS12887_GetTime fV
.dbstruct 0 25 _SYSTEMTIME_
.dbfield 0 Second c
.dbfield 1 Minute c
.dbfield 2 Hour c
.dbfield 3 Week c
.dbfield 4 Day c
.dbfield 5 Month c
.dbfield 6 Year c
.dbfield 7 DateString A[9:9]c
.dbfield 16 TimeString A[9:9]c
.dbend
; temp -> <dead>
; Time -> R20,R21
.even
_DS12887_GetTime::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 259
; }
;
;
; //讀出時間
; void DS12887_GetTime(SYSTEMTIME *Time)
; { uchar temp;
.dbline 260
; Time->Second = DS12887_Read(DS12887_Second);
clr R16
xcall _DS12887_Read
movw R30,R20
std z+0,R16
.dbline 261
; Time->Minute = DS12887_Read(DS12887_Minute);
ldi R16,2
xcall _DS12887_Read
movw R30,R20
std z+1,R16
.dbline 262
; Time->Hour = DS12887_Read(DS12887_Hour );
ldi R16,4
xcall _DS12887_Read
movw R30,R20
std z+2,R16
.dbline 263
; Time->Day = DS12887_Read(DS12887_Day );
ldi R16,7
xcall _DS12887_Read
movw R30,R20
std z+4,R16
.dbline 265
; //Time->Week = DS12887_Read(DS12887_Week );
; Time->Month = DS12887_Read(DS12887_Month );
ldi R16,8
xcall _DS12887_Read
movw R30,R20
std z+5,R16
.dbline 266
; Time->Year = DS12887_Read(DS12887_Year );
ldi R16,9
xcall _DS12887_Read
movw R30,R20
std z+6,R16
.dbline 268
;
; y1=DS12887_Read(DS12887_Second);
clr R16
xcall _DS12887_Read
sts _y1,R16
.dbline 269
; y2=DS12887_Read(DS12887_Minute);
ldi R16,2
xcall _DS12887_Read
sts _y2,R16
.dbline 270
; y3=DS12887_Read(DS12887_Hour );
ldi R16,4
xcall _DS12887_Read
sts _y3,R16
.dbline 271
; y4=DS12887_Read(DS12887_Day );
ldi R16,7
xcall _DS12887_Read
sts _y4,R16
.dbline 272
; y5=DS12887_Read(DS12887_Month );
ldi R16,8
xcall _DS12887_Read
sts _y5,R16
.dbline 273
; y6=DS12887_Read(DS12887_Year );
ldi R16,9
xcall _DS12887_Read
sts _y6,R16
.dbline -2
L29:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym l temp 1 c
.dbsym r Time 20 pS[_SYSTEMTIME_]
.dbend
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 278
; }
;
; /*****************端口初始化********************************/
; void port_init(void)
; {
.dbline 279
; DDRB = 0xFF;
ldi R24,255
out 0x17,R24
.dbline 280
; PORTB = 0xFF; //設(shè)為輸出高電平
out 0x18,R24
.dbline 282
;
; DDRA = 0x00;
clr R2
out 0x1a,R2
.dbline 283
; PORTA = 0x00; //設(shè)為高阻態(tài)
out 0x1b,R2
.dbline -2
L30:
.dbline 0 ; func end
ret
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 288
;
; }
; /********************初始化器件************************************/
; void init_devices(void)
; {
.dbline 289
; port_init();
xcall _port_init
.dbline -2
L31:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
; CurrentTime -> y+0
.even
_main::
sbiw R28,25
.dbline -1
.dbline 296
; }
;
;
;
; /***************主函數(shù)*****************************/
; void main(void)
; {
.dbline 298
; SYSTEMTIME CurrentTime;
; init_devices();
xcall _init_devices
.dbline 300
;
; DS12887_Init();
xcall _DS12887_Init
.dbline 301
; DS12887_GetTime(&CurrentTime);
movw R16,R28
xcall _DS12887_GetTime
.dbline 304
; /*************時間初始化設(shè)置 ,2009-2-16 2:00:00************/
; //*
; DS12887_SetTime(DS12887_Second, 0); //設(shè)置秒
clr R18
clr R16
xcall _DS12887_SetTime
.dbline 305
; DS12887_SetTime(DS12887_Minute, 34); //設(shè)置分
ldi R18,34
ldi R16,2
xcall _DS12887_SetTime
.dbline 306
; DS12887_SetTime(DS12887_Hour,16); //設(shè)置時
ldi R18,16
ldi R16,4
xcall _DS12887_SetTime
.dbline 307
; DS12887_SetTime(DS12887_Day, 4); //設(shè)置天
ldi R18,4
ldi R16,7
xcall _DS12887_SetTime
.dbline 308
; DS12887_SetTime(DS12887_Month, 3); //設(shè)置月
ldi R18,3
ldi R16,8
xcall _DS12887_SetTime
.dbline 309
; DS12887_SetTime(DS12887_Year, 9); //設(shè)置年
ldi R18,9
ldi R16,9
xcall _DS12887_SetTime
xjmp L34
L33:
.dbline 313
.dbline 314
movw R16,R28
xcall _DS12887_GetTime
.dbline 317
L34:
.dbline 312
xjmp L33
X1:
.dbline -2
L32:
adiw R28,25
.dbline 0 ; func end
ret
.dbsym l CurrentTime 0 S[_SYSTEMTIME_]
.dbend
.area bss(ram, con, rel)
.dbfile C:\DOCUME~1\wangqinbo\MYDOCU~1\avrc\ds12997.c
_y6::
.blkb 1
.dbsym e y6 _y6 c
_y5::
.blkb 1
.dbsym e y5 _y5 c
_y4::
.blkb 1
.dbsym e y4 _y4 c
_y3::
.blkb 1
.dbsym e y3 _y3 c
_y2::
.blkb 1
.dbsym e y2 _y2 c
_y1::
.blkb 1
.dbsym e y1 _y1 c
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -