$include (c<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />8051f330.inc)
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
ERD BIT P1.0 ;//E/#RD=0,READ STATE
RW BIT P1.1 ;//R/#W=0,WRITE DATA
DC BIT P1.2 ;//D/#C,DATAORCOMMANDSELECT,=1,DATA,=0,COMMAND
RES BIT P1.3 ` ;//#RESET,=0,RESET
CS BIT P1.4 ;//#CS,CHIP SELECT INPUT,=0,CHIP SELECT
写数据:
WrData:
MOV P0,A
SETB DC
CLR RW
CLR CS
SETB ERD
NOP
NOP
CLR ERD
SETB CS
RET
写命令:
WrCmd:
MOV P0,A
CLR DC ;//CONTROL
CLR RW ;//WRITE
CLR CS
SETB ERD
NOP
NOP
CLR ERD
SETB CS
RET
;//=========================================================
DELAY: MOV TIME0,#10
DELAY2:
MOV PCA0MD,#00H ;//WDT
DJNZ TIME0,DELAY2
DJNZ TIME1,DELAY
RET
;//====================================================================
DELAY500:
MOV TIME1,#250
LCALL DELAY
MOV TIME1,#250
LCALL DELAY
RET
;//====================================================================
DELAY1S:
MOV TIME1,#100
LCALL DELAY
MOV TIME1,#100
LCALL DELAY
MOV TIME1,#100
LCALL DELAY
MOV TIME1,#100
LCALL DELAY
RET
;//====================================================================
PortInit:
MOV XBR1,#40H ;//CROSS SW ENABLE
MOV P0MDOUT,#0ffH ;//
MOV P1MDOUT,#0ffH ;//
ret
用户123472 2008-4-3 19:16
用户741296 2008-4-3 11:16
用户456215 2008-4-1 20:49
用户133256 2008-3-27 21:30