由于自己用的单片机只有128个字节的内存,没法用提供的文件级接口,只好自己写低层的程序,但老出问题,
CH375_WR EQU P3.6 ;0,写 CH375_RD EQU P3.7 ;0,读 CH375_A0 EQU P2.0 ;1,命令 0,数据 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 以上是基本的函数,再开始设置ch375工作状态
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 的数据,再读时,得到的是 14H ,而不是 51H,或 5FH,不知道为什么? [Emot]1[/Emot]