| ??? 07/19/03 18:57 Read: times |
#50998 - RE: Multiprocessor communication with 8051 Responding to: ???'s previous message |
Configure the uC UART for mode 3 (SCON=0F0h), interrupt driven.
First, set an "address" for each uC. When interrupt happens verify if SM2 bit is set, then check the address and if it matches, then continue with the interrupt service, else get out of there. Example: . ;set baud rate mov th1,#0fah mov scon,#0f0h ;multiprocessor mode setb tr1 ; start communications . . . . ;Interrupt service ;This only happens when you send a byte with the 9th ;bit set SERIAL: clr RI mov a,sbuf ;get buffer cjne a,#65,NODIR ;if uC address <> 65 the get out clr SM2 ;disable 9th bit ;get more data if needed loop: jnb RI,loop mov a,sbuf clr RI ;do more things if you need . . . . NODIR: setb SM2 ;set initial state reti you can try this out using a PC. Use Hyperterminal os something similar.Configure your baud rate as same as your uC with MARK PARITY and send the address to the uC (In this case is an "A"). The uC will stop and will wait for more data. Change parity in the PC to SPACE PARITY and send a byte, the uC will continue with its job. If you have questions feel free to ask |



