在調(diào)試51和CH375B的串口通信, 本網(wǎng)站上下載了通用程序,用的通信是并口的,我把通信方式改成了串口,現(xiàn)在我用的是仿真器來(lái)調(diào)試,只看到發(fā)出去的數(shù)據(jù),從375上讀不到數(shù)據(jù).CH375工作正常(25腳L,26腳為H)請(qǐng)幫我看看
讀寫數(shù)據(jù) 寫命令 并口改串口 /* void CH375_WR_CMD_PORT( unsigned char cmd ) // 向CH375的命令端口寫入命令,周期不小于4uS,如果單片機(jī)較快則延時(shí) { delay2us(); CH375_CMD_PORT=cmd; delay2us(); } */
void CH375_WR_CMD_PORT( unsigned char mCmd )//向CH375的命令端口寫入命令 { REN=0; TI = 0; TB8 = 1; SBUF = mCmd; while ( TI == 0 ); }
/* void CH375_WR_DAT_PORT( unsigned char dat ) { //向CH375的數(shù)據(jù)端口寫入數(shù)據(jù),周期不小于1.5uS,如果單片機(jī)較快則延時(shí) CH375_DAT_PORT=dat; delay1us(); // 因?yàn)镸CS51單片機(jī)較慢所以實(shí)際上無(wú)需延時(shí) } */ void CH375_WR_DAT_PORT( unsigned char mData )//向CH375的數(shù)據(jù)端口寫入數(shù)據(jù) { REN=0; TI = 0; TB8 = 0; SBUF = mData; while ( TI == 0 );
}
/*unsigned char CH375_RD_DAT_PORT() { // 從CH375的數(shù)據(jù)端口讀出數(shù)據(jù),周期不小于1.5uS,如果單片機(jī)較快則延時(shí) delay1us(); // 因?yàn)镸CS51單片機(jī)較慢所以實(shí)際上無(wú)需延時(shí) return( CH375_DAT_PORT ); }
*/
unsigned char CH375_RD_DAT_PORT() { REN=1; while ( RI == 0 ); RI = 0; return( SBUF);