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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Vignesh Prasad
08/24/05 08:32
Read: 493 times
Bangalore
India


 
#100001 - Simulation Results
Responding to: Andy Neil's previous message
Dear Andy, I have stripped off the remaining portions and have put the simplified version of my serial handling routine and corresponding screen shot of Keil C51 simulator. The combuf[..] array doesnt get stored by the values of SBUF..

The chip is 89S52 running at 12.0 MHz. Here is the code:

#include <REGX52.H>
#define PACKETLEN	5

void comhandle(void);

unsigned char combuf[PACKETLEN];//com buffer
unsigned char bufcntr=0;

void serialhandler(void) interrupt 4
{
	TI=0;
	if(RI)
	{
		comhandle();
		RI=0;
	}
}

void comhandle(void)
{
	combuf[bufcntr]=SBUF;
	bufcntr++;
	
	if(bufcntr>=PACKETLEN)
	bufcntr=0;	
}

void serialbaud(void) interrupt 5//timer 2 interrupt
{
}

void initser(void)
{
	IE|=0xB0;//timer 2 and serial interrupts enabled
	T2CON=0x30;//rclk and tclk enabled
	
	SCON=0x50;//serial mode 1
	
	RCAP2L=0x64;//reload values for 2403 baud
	RCAP2H=0xFF;

	TR2=1;//start the baud rate generator
}

void main(void)
{
	initser();
	while(1);
}


Simulation Screen Shot:


Erik, I hope this answers your query regarding SCON. Yes Erik, I must restructure the program so that it doesnt take longer ISR time, will do that later.

Thanks and Regards,
Vignesh

List of 18 messages in thread
TopicAuthorDate
More encounters with Keil C51      Vignesh Prasad      08/23/05 23:28      
   Simulate it!      Andy Neil      08/24/05 03:30      
      It is not an homework      Vignesh Prasad      08/24/05 06:07      
         Proving nothing.      Andy Neil      08/24/05 07:01      
         LCD      Andy Neil      08/24/05 07:10      
      Simulation Results      Vignesh Prasad      08/24/05 08:32      
         Pointless      Andy Neil      08/24/05 10:52      
            Got it !!      Vignesh Prasad      08/24/05 13:02      
            update      Andy Neil      08/26/05 05:43      
   do you set SCON as a byte or bitwise ?      Erik Malund      08/24/05 06:37      
   not an answer, but why do you call a fun      Erik Malund      08/24/05 07:18      
      I don't C      Jan Waclawek      08/24/05 08:06      
         inline      Andy Neil      08/24/05 08:26      
            Compiler Tries      Abhishek Singh      08/25/05 21:59      
            OT: inline, Keil ARM      Andy Neil      09/06/05 07:18      
               C99 does specify inline as a keyword.      Maarten Brock      09/06/05 10:38      
   Review index boundary value      Tsuneo Chinzei      08/26/05 02:31      
      Even More Pointless simulation!      Andy Neil      08/26/05 05:40      

Back to Subject List