logo

请教
我用CH375 芯片,自己做的板子,用的不是51单片机,我对其设置波特率和工作方式后,读到的返回码是00,请问怎么回事啊?
Thanks for all your help!
热门产品推荐 : BLE/Zigbee双模无线MCU CH579
SCON = 0xd0; 9位UART;
PCON = 0x80;
TMOD = 0x20;
TL1=0xf3;
TH1 = 0xf3; /* 24MHz晶振, 9600bps */
TR1 = 1;
bit set_baudrate_s(UCHAR modulus,UCHAR constant)
{ UCHAR i;
RI=0;
TI=0;
TB8=1;
SBUF=CMD_SET_BAUDRATE;
while(!TI);
TI=0;
TB8=0;
SBUF=modulus;
while(!TI);
TI=0;
TB8=0;
SBUF=constant;
while(!TI);
TI=0;
TR1=0;
TL1=0xfe;
TH1=0xfe;
TR1=1;
delay1ms();
while(!RI);
RI=0;
i=SBUF;
if(i==CMD_RET_SUCCESS)return(SUCCESS);
else return(ABORT);
}
bit set_usb_mode_s(UCHAR mode)
{ UCHAR i;
RI=0;
TI=0;
TB8=1;
SBUF=CMD_SET_USB_MODE;
while(!TI);
TI=0;
TB8=0;
SBUF=mode;
while(!TI);
TI=0;
// delay20us();
while(!RI);
RI=0;
i=SBUF;
if(i==CMD_RET_SUCCESS)return(SUCCESS);
else return(ABORT);
}
哼哼!
只有登录才能回复,可以选择微信和github账号登录