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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/15/04 16:51
Read: times


 
#81200 - Strange problem with KEIL C++ and 8052
Hi all,

i have a strang broblem using Keil Software and working with AT89c52 and it took a lot of time of mine to debug and figure out where is the problem. Okey below is the whole program. what does it do is that it initializes the timer and go in the infinite loop in which i turn on off a pin of 52 each second. now look at the statement //SendComChar(1); in the loop which i have commented. now program is working perfectly fine when this statement is commented and the 8052 pin goes ON for one second and then OFF for one second.


NOW If i uncomment the statement //SendComChar(1); and it seems that nothing is working... (i detect it because the pin is not going ON/OFF as expected). Please look in the function and you will see a simple assignment statement.




few months ago i was working with a 700 line program written in KEIL C++. originally the program was written in SDCC and it was supposed to be compiled in KEIL as usual with some changes in code. the program did not work on the microcontroller. and after 2-3 weeks of debugging i came across this statement whihc i suspect was creating problem

cyrunTime = processTimes(3,1) * 20;

for FUN i make this change in the statement

cyrunTime = processTimes(3,1);

and WHOPS the whole 700 line program start working.




SO CAN ANY BODY IN THIS WORLD tell me what's going on in KEIL and why the following program is not working with SendComChar(1); statement.


Shahzad Aslam









#include <AT89x55.h>
#include <intrins.h>


void Simple_Delay_N_Fifty(int);
void Simple_Delay_Fifty_Milliseconds(void);
void initComm(void);
void SendComChar(unsigned char);


sbit zoneOnOff = P2^7;
int temp, temp2;
unsigned char chrRec;


void main(void)
{
unsigned char c;
//---------------------------
// These two statements will initialize the time for Delay's
TMOD |= 0x01;
ET0 = 0;
//---------------------------



Simple_Delay_N_Fifty(20);


initComm();

c = 20;

temp2 = 0;


while(1)
{
zoneOnOff = 0;
Simple_Delay_N_Fifty(20);
zoneOnOff = 1;
Simple_Delay_N_Fifty(20);

//HERE NOW THE PROGRAM IS WORKING FIND
//BUT IF I UNCOMMENT THE FOLLOWING
//Statement the program stops working


//SendComChar(1);
c++;
}
}





void Simple_Delay_N_Fifty(int n)
{

for(temp=0;temp<n;temp++)
{
Simple_Delay_Fifty_Milliseconds();
}


}



void Simple_Delay_Fifty_Milliseconds()
{

TR0 = 0;

TH0 = 0x4B;
TL0 = 0xFD;


TF0 = 0;
TR0 = 1;

while(TF0 == 0);

TR0 = 0;

}







void initComm(void)
{

//-----------
//TMOD = 0x21;
TMOD |= 0x21;
TH1 = 0xe6;
TCON = 0x00;

SCON = 0x50;
ET0 = 0;
TR1 = 1;
//----------



}



void SendComChar(unsigned char c)
{
temp = c;
}

List of 19 messages in thread
TopicAuthorDate
Strange problem with KEIL C++ and 8052            01/01/70 00:00      
   Wait a minute...            01/01/70 00:00      
   Your code            01/01/70 00:00      
   RE: Strange problem with KEIL C++ and 8052            01/01/70 00:00      
      RE: Strange problem with KEIL C++ and 8052            01/01/70 00:00      
         RE: Strange problem with KEIL C++ and 8052            01/01/70 00:00      
            poor practice            01/01/70 00:00      
   andy + gopalakrishn + program with <pre>            01/01/70 00:00      
      RE: andy + gopalakrishn + program with <pre>            01/01/70 00:00      
         RE: andy + gopalakrishn + program with <pre>            01/01/70 00:00      
   RE: Strange problem with KEIL C++ and 8052            01/01/70 00:00      
   KEIL Debugger            01/01/70 00:00      
      RE: KEIL Debugger            01/01/70 00:00      
      RE: KEIL Debugger            01/01/70 00:00      
   try this on your keil            01/01/70 00:00      
   Keil Debugger screen shoots            01/01/70 00:00      
      Shazad            01/01/70 00:00      
      RE: Keil Debugger screen shoots            01/01/70 00:00      
   I am facing Nearly Similar Problem            01/01/70 00:00      

Back to Subject List