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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Praveen Kumar
08/07/10 00:01
Read: 656 times
Hyderabad
India


 
#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      Praveen Kumar      08/07/10 00:01      
   Sure...      Michael Karas      08/07/10 00:57      
   yes, but      Erik Malund      08/07/10 06:44      
      TX inside serialint      Johan Smit      08/07/10 23:38      
         Pardon??      Andy Neil      08/08/10 01:16      
            Pardon accepted      Johan Smit      08/08/10 09:03      
               Still a Missing Part of Scheme      Michael Karas      08/08/10 10:49      
            Pardon      Johan Smit      08/08/10 09:09      
               Will that work in 'C' ?      Andy Neil      08/08/10 12:53      
                  Assembler if you want      Johan Smit      08/08/10 22:39      
                     Why send_char?      Maarten Brock      08/10/10 01:11      
                        Why send_char      Johan Smit      08/11/10 22:43      
                           You missed the point      Maarten Brock      08/12/10 03:12      
                              Call a routine from an interrupt      Johan Smit      08/13/10 00:17      
                                 Still misunderstanding      Maarten Brock      08/13/10 05:02      
                                 misunderstandings      Erik Malund      08/13/10 07:36      
      what happened to the OP?      Erik Malund      08/10/10 05:38      

Back to Subject List