| ??? 08/24/05 14:32 Read: times |
#100001 - Simulation Results Responding to: ???'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 |
| Topic | Author | Date |
| More encounters with Keil C51 | 01/01/70 00:00 | |
| Simulate it! | 01/01/70 00:00 | |
| It is not an homework | 01/01/70 00:00 | |
| Proving nothing. | 01/01/70 00:00 | |
| LCD | 01/01/70 00:00 | |
| Simulation Results | 01/01/70 00:00 | |
| Pointless | 01/01/70 00:00 | |
| Got it !! | 01/01/70 00:00 | |
| update | 01/01/70 00:00 | |
| do you set SCON as a byte or bitwise ? | 01/01/70 00:00 | |
| not an answer, but why do you call a fun | 01/01/70 00:00 | |
| I don't C | 01/01/70 00:00 | |
| inline | 01/01/70 00:00 | |
| Compiler Tries | 01/01/70 00:00 | |
| OT: inline, Keil ARM | 01/01/70 00:00 | |
C99 does specify inline as a keyword. | 01/01/70 00:00 | |
| Review index boundary value | 01/01/70 00:00 | |
| Even More Pointless simulation! | 01/01/70 00:00 |



