.module RTC.C
.area data(ram, con, rel)
_Table::
.blkb 2
.area idata
.byte 63,6
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 91,'O
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 'f,'m
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 125,7
.area data(ram, con, rel)
.blkb 2
.area idata
.byte 127,'o
.area data(ram, con, rel)
.dbfile C:\DOCUME~1\Administrator\桌面\张军\PS2-ICC\RTC.C
.dbsym e Table _Table A[10:10]c
.area text(rom, con, rel)
.dbfile C:\DOCUME~1\Administrator\桌面\张军\PS2-ICC\RTC.C
.dbfunc e DelayMs _DelayMs fV
; j -> R20
; i -> R16,R17
.even
_DelayMs::
rcall push_gset1
.dbline -1
.dbline 14
; #include
; #include
; #ifndef uchar
; #define uchar unsigned char
; #define uint unsigned int
; #endif
;
; #define SD2303 0x64 //SD2303器件IIC识别码
;
; uchar F_Flag;
; uchar Table[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
;
; void DelayMs(uint i) //0.25ms
; {uchar j;
.dbline 15
; for(;i!=0;i--)
rjmp L5
L2:
.dbline 16
.dbline 16
ldi R20,208
rjmp L9
L6:
.dbline 16
.dbline 16
.dbline 16
L7:
.dbline 16
dec R20
L9:
.dbline 16
tst R20
brne L6
.dbline 16
L3:
.dbline 15
subi R16,1
sbci R17,0
L5:
.dbline 15
cpi R16,0
cpc R16,R17
brne L2
X0:
.dbline -2
.dbline 17
; {for(j=2000;j!=0;j--) {;}}
; }
L1:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r j 20 c
.dbsym r i 16 i
.dbend
.dbfunc e Display _Display fV
; i -> R20
; sel -> R22
; p -> R10,R11
.even
_Display::
rcall push_gset3
mov R10,R16
mov R11,R17
.dbline -1
.dbline 20
;
; void Display(uchar *p) //间隔5ms显示
; {uchar i,sel=0x01;
.dbline 20
ldi R22,1
.dbline 21
; for(i=0;i clr R20
rjmp L14
L11:
.dbline 22
.dbline 22
mov R2,R22
com R2
out 0x18,R2
.dbline 23
ldi R24, ldi R25,>_Table
mov R30,R10
mov R31,R11
ldd R30,z+0
clr R31
add R30,R24
adc R31,R25
ldd R2,z+0
out 0x1b,R2
.dbline 24
mov R24,R10
mov R25,R11
adiw R24,1
mov R10,R24
mov R11,R25
.dbline 25
ldi R16,20
ldi R17,0
rcall _DelayMs
.dbline 26
lsl R22
.dbline 27
L12:
.dbline 21
inc R20
L14:
.dbline 21
cpi R20,4
brlo L11
.dbline -2
.dbline 28
; {PORTB=~sel;
; PORTA=Table[*p];
; p++;
; DelayMs(20);
; sel=sel ; }
; }
L10:
rcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r sel 22 c
.dbsym r p 10 pc
.dbend
.dbfunc e NOPNOP _NOPNOP fV
; i -> R16
.even
_NOPNOP::
.dbline -1
.dbline 32
.dbline 32
rjmp L19
L16:
.dbline 32
nop
L17:
.dbline 32
dec R16
L19:
.dbline 32
;
;
; void NOPNOP(uchar i)
; {for(;i!=0;i--) NOP();}
tst R16
brne L16
.dbline -2
.dbline 32
L15:
.dbline 0 ; func end
ret
.dbsym r i 16 c
.dbend
.dbfunc e SetSCL _SetSCL fV
; i -> R16
.even
_SetSCL::
.dbline -1
.dbline 36
;
; //sbit SCL=PC^0; //定义SD2303IIC时钟线
; void SetSCL(uchar i)
; {if(i==1) PORTC=PORTC|0x01;
.dbline 36
cpi R16,1
brne L21
.dbline 36
sbi 0x15,0
rjmp L22
L21:
.dbline 37
in R24,0x15
andi R24,254
out 0x15,R24
L22:
.dbline -2
.dbline 37
; else PORTC=PORTC&0xfe;}
L20:
.dbline 0 ; func end
ret
.dbsym r i 16 c
.dbend
.dbfunc e SetSDA _SetSDA fV
; i -> R16
.even
_SetSDA::
.dbline -1
.dbline 41
;
; //sbit SDA=PC^1; //定义SD2303IIC数据线
; void SetSDA(uchar i)
; {if(i==1) PORTC=PORTC|0x02;
.dbline 41
cpi R16,1
brne L24
.dbline 41
sbi 0x15,1
rjmp L25
L24:
.dbline 42
in R24,0x15
andi R24,253
out 0x15,R24
L25:
.dbline -2
.dbline 42
; else PORTC=PORTC&0xfd;}
L23:
.dbline 0 ; func end
ret
.dbsym r i 16 c
.dbend
.dbfunc e Start _Start fV
.even
_Start::
.dbline 0 ; func end
ret
.dbend
.dbfunc e Stop _Stop fV
.even
_Stop::
.dbline 0 ; func end
ret
.dbend
.dbfunc e Ack _Ack fV
.even
_Ack::
.dbline 0 ; func end
ret
.dbend
.dbfunc e Nack _Nack fV
.even
_Nack::
.dbline 0 ; func end
ret
.dbend
.dbfunc e Check_Ack _Check_Ack fV
.even
_Check_Ack::
.dbline 0 ; func end
ret
.dbend
.dbfunc e Write_Bit0 _Write_Bit0 fV
.even
_Write_Bit0::
.dbline 0 ; func end
ret
.dbend
.dbfunc e Write_Bit1 _Write_Bit1 fV
.even
_Write_Bit1::
.dbline 0 ; func end
ret
.dbend
.dbfunc e Write_Byte _Write_Byte fV
; Data -> R0
.even
_Write_Byte::
.dbline 0 ; func end
ret
.dbsym l Data 0 c
.dbend
.dbfunc e Read_Byte _Read_Byte fc
.even
_Read_Byte::
.dbline 0 ; func end
ret
.dbend
.dbfunc e Write_Nbyte _Write_Nbyte fV
; Number -> R3
; Array -> R2,R3
; Address -> R1
; Slave -> R0
.even
_Write_Nbyte::
.dbline 0 ; func end
ret
.dbsym l Number 6 c
.dbsym l Array 4 pc
.dbsym l Address 2 c
.dbsym l Slave 0 c
.dbend
.dbfunc e Write_1byte _Write_1byte fV
; Data -> R2
; Address -> R1
; Slave -> R0
.even
_Write_1byte::
.dbline 0 ; func end
ret
.dbsym l Data 4 c
.dbsym l Address 2 c
.dbsym l Slave 0 c
.dbend
.dbfunc e Read_Nbyte _Read_Nbyte fV
; Number -> R3
; Array -> R2,R3
; Address -> R1
; Slave -> R0
.even
_Read_Nbyte::
.dbline 0 ; func end
ret
.dbsym l Number 6 c
.dbsym l Array 4 pc
.dbsym l Address 2 c
.dbsym l Slave 0 c
.dbend
.area lit(rom, con, rel)
L86:
.byte 2,0
.byte 0,4
.byte 1,2
.byte 2,7
.byte 1,1
.byte 7,3
.byte 0,5
.byte 0
L87:
.byte 'P,48
.byte 23,1
.byte 39,18
.byte 4
.area text(rom, con, rel)
.dbfile C:\DOCUME~1\Administrator\桌面\张军\PS2-ICC\RTC.C
.dbfunc e main _main fV
.even
_main::
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile C:\DOCUME~1\Administrator\桌面\张军\PS2-ICC\RTC.C
_K::
.blkb 2
.dbsym e K _K I
_F_Flag::
.blkb 1
.dbsym e F_Flag _F_Flag c