Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/07/10 05:01
Read: times


 
#177838 - Writing to SBUF in Serial Routine
I am using Philips P89C52X2 controller in my project. I am also using serial communication Mode 3(Multiprocessor mode) for communicating with individual slave controller units.

Q: Can we SEND DATA to SBUF inside RI code? An example is as shown:


/*SERIAL INTERRUPT SERVICE ROUTINE*/

#include<reg52.h>
unsigned char buf;

void onSerialPortISR(void) interrupt 4 using 3
{
	if(TI)
	{	
		TI = 0;	    /* clr ti since we are going to transmit again */
	}
	if(RI)					
	{
		RI = 0;	    /* clear ri to wait for next character */
		buf = SBUF; /* store the character from sbuf into temp buffer */

		if(buf == 0xAA)/* IF THE RECEIVED VALUE IS 0xAA */ 
		{
			while(!TI){;}   /* waiting for any previous transmission to finish */
			TI = 0;		/* clr ti since we are going to transmit again */
			SBUF = 0x55;	/* sending the data acknowledged byte back */
			while(!TI){;}	/* waiting for data to be transmitted */
		}
	}
}
 



List of 17 messages in thread
TopicAuthorDate
Writing to SBUF in Serial Routine            01/01/70 00:00      
   Sure...            01/01/70 00:00      
   yes, but            01/01/70 00:00      
      TX inside serialint            01/01/70 00:00      
         Pardon??            01/01/70 00:00      
            Pardon accepted            01/01/70 00:00      
               Still a Missing Part of Scheme            01/01/70 00:00      
            Pardon            01/01/70 00:00      
               Will that work in 'C' ?            01/01/70 00:00      
                  Assembler if you want            01/01/70 00:00      
                     Why send_char?            01/01/70 00:00      
                        Why send_char            01/01/70 00:00      
                           You missed the point            01/01/70 00:00      
                              Call a routine from an interrupt            01/01/70 00:00      
                                 Still misunderstanding            01/01/70 00:00      
                                 misunderstandings            01/01/70 00:00      
      what happened to the OP?            01/01/70 00:00      

Back to Subject List