嘗試串連89C51多處理機連線通信出現問題,急求高手指點指點!!
嘗試使用串列埠模式3 之多處理機連線通信,發現89C51 未能自動識別及判斷位址以接收數據,請各高手指點指點!!
主機已初設:
SCON = 0xF0; /* uart in mode 3(9 bit), REN=1 */
SADDR=0x01; /* local address */
SADEN=0xFF; /* address mask*/
從機已初設:
SCON = 0xF0; /* uart in mode 3 (9 bit), REN=1 */
SADDR=0x02; /* local address*/
SADEN=0xFF; /* address mask*/
已確定從機能夠收到主機發出之8位元地址及數據
問題是:
如主機發出之地址不等於從機之地址時,從機依然接收數據
例如:
TB8 = 1;
SBUF = 0xf3;
<---不等於從機地址
TB8 = 0;
SBUF = 0x55; <----從機依然接收數據0x55
從Atmel 89c51 Data Sheet
"The automatic
address recognition feature is enabled when the multiprocessor communication feature is enabled
(SM2 bit in SCON register is set).
Implemented in the hardware, automatic address recognition
enhances the multiprocessor communication feature by allowing the serial port to examine the
address of each incoming command frame. Only when the serial port recognizes its own address will
the receiver set the RI bit in the SCON register to generate an interrupt."
得知89C51
可以自動試別及判斷位址正確與否從而接收數據,但始終未能實現,已苦試個多月,請各高手指點指點!!!
发表时间:2006年1月19日5:48:54