由于自己用的單片機只有128個字節(jié)的內(nèi)存,沒法用提供的文件級接口,只好自己寫低層的程序,但老出問題,
CH375_WR EQU P3.6 ;0,寫 CH375_RD EQU P3.7 ;0,讀 CH375_A0 EQU P2.0 ;1,命令 0,數(shù)據(jù) CH375_CS EQU P2.2 CH375_IN EQU 33H CH375_OUT EQU R5
CH375_INPUT_CMD: SETB CH375_RD CLR CH375_WR SETB CH375_A0 LCALL OPEAN_CH375 MOV P1,CH375_IN NOP LCALL CLOSE_CH375 NOP LCALL CLOSE_CH375 RET
CH375_INPUT_DATA: SETB CH375_RD CLR CH375_WR CLR CH375_A0 LCALL OPEAN_CH375 MOV P1,CH375_IN NOP LCALL CLOSE_CH375 RET
CH375_READ_DATA:MOV P1,#0FFH SETB CH375_WR CLR CH375_RD CLR CH375_A0 LCALL OPEAN_CH375 LCALL DEL_5UMS MOV CH375_OUT,P1 NOP LCALL CLOSE_CH375 RET
OPEAN_CH375:CLR CH375_CS NOP RET
CLOSE_CH375:SETB CH375_CS RET 以上是基本的函數(shù),再開始設置ch375工作狀態(tài)
MOV CH375_IN,#15H LCALL CH375_INPUT_CMD
MOV CH375_IN,#06H LCALL CH375_INPUT_DATA
LCALL DEL_10UMS LCALL DEL_10UMS
LCALL CH375_READ_DATA 先寫入 #15H 的命令,再寫入 #06H 的數(shù)據(jù),再讀時,得到的是 14H ,而不是 51H,或 5FH,不知道為什么? [Emot]1[/Emot]