從機已初設:
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
可以自動試別及判斷位址正確與否從而接收數據,但始終未能實現,已苦試個多月,請各高手指點指點!!!
}
從以上兩點,究竟89c51可否實現硬件核對地址呢??
因為此功能對本人十分重要!!