Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Address space overflow in Keil compiler

Status
Not open for further replies.

Sudhp

Member level 4
Member level 4
Joined
Oct 11, 2013
Messages
69
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Location
India
Activity points
528
Hello everyone,
I am working on a project using AT89s52 and using keil Uvision 4 as compiler.Here i am using uart communication interrupt method..
I am posting it here....
Code:
void serial_IT(void) interrupt 4 
{
 char c;
 start:
  if (RI == 1) 
    {    
	 RI = 0; 
     c = SBUF;
     if(c <= 24)
	 {
	 buzzer=1;led_off=0;led=0;
     zone = c/10;
	 error_type = c%10;
	 send_command_lcd(0xc0,"                \0");
	 send_command_lcd(0xc0,"ZONE \0");
	 send_com_lcd8(0xc5,zone);
	//if(error_type == 1)
	//	tt[zone]=1;
	if(error_type == 2)
	    send_command_lcd(0xc8,"SHORT   \0");
	else if(error_type == 3)
	    send_command_lcd(0xc8,"OPEN    \0");
	else if(error_type == 4)
	    {send_command_lcd(0xc8,"FIRE    \0");dial();}
	  delay_ms1(70);
	//send_command_lcd(0xc0,"                \0");
	goto start; }
    }
}
While compiling this i found a complete compilation
warning 1.PNG

But when i just made a little change by replacing dial(); function with fire_alarm(); the compiler gives me error
warning2.PNG

Code:
void serial_IT(void) interrupt 4 
{
 char c;
 start:
  if (RI == 1) 
    {    
	 RI = 0; 
     c = SBUF;
     if(c <= 24)
	 {
	 buzzer=1;led_off=0;led=0;
     zone = c/10;
	 error_type = c%10;
	 send_command_lcd(0xc0,"                \0");
	 send_command_lcd(0xc0,"ZONE \0");
	 send_com_lcd8(0xc5,zone);
	//if(error_type == 1)
	//	tt[zone]=1;
	if(error_type == 2)
	    send_command_lcd(0xc8,"SHORT   \0");
	else if(error_type == 3)
	    send_command_lcd(0xc8,"OPEN    \0");
	else if(error_type == 4)
	    {send_command_lcd(0xc8,"FIRE    \0");fire_alarm();}
	  delay_ms1(70);
	//send_command_lcd(0xc0,"                \0");
	goto start; }
    }
}

Any suggestion why this error and how to come over from it???
 

where this functions define you not posted their code its error related for data or address overflow.
 

The code of fire_alarm() function....
PHP:
void fire_alarm() 
{
ht_temp=0;
init_lcd();

delay_ms1(800);
Hooter=1;

dial();

htr_time = htr_time - ht_temp;

init_lcd();
if(htr_time>0)
{
   send_command_lcd(0xc0,"FIRE ACTIVATED\0");//send_command_lcd();

for(i=0;i<htr_time;i++)
   delay_1min();
}}

- - - Updated - - -

Also the data size increases from 126 to 148 as you can show images.
 

Thanks to the compilier that he refuses to compile this code. Fix your interrupt routine. No cycles, no delays, no flag pooling in interrupts accepted.
 
  • Like
Reactions: Sudhp

    Sudhp

    Points: 2
    Helpful Answer Positive Rating
Interrupt should be performed as fast as possible. Read value, rise the flag. Nothing more. Then in main code you check that flag and do some stuff when needed.
 
  • Like
Reactions: Sudhp

    Sudhp

    Points: 2
    Helpful Answer Positive Rating
No cycles, no delays, no flag pooling in interrupts accepted.
Its working.... when i replace dial function with fire_alarm function ..it gives me error.....

- - - Updated - - -

Interrupt should be performed as fast as possible. Read value, rise the flag. Nothing more. Then in main code you check that flag and do some stuff when needed.
okk... Then i should use a flag and i can't do any thing in except rise a flag in service routine... Right??

- - - Updated - - -

Also In my code i used more than 130 bytes for variables..... When I convert them in "unsigned variable_type idata" format it compiles same code successfully.... But also increases warnings.....
 

you can use the code optimization approach or tools with your compiler for code space and do comment unnecessary things.what is your end application.

you can search for simple sample program available for serial communication.

As pointed out in earlier post that you wait approximate 2mins in your fire_alaram(); function.

You can use flag when you received true byte or data on serial port if this flag is set then you call your fire_alaram(); function.

for example


Code C - [expand]
1
if (received byte==True) {call your function }else {w8 for the true data.}

 
Last edited:
  • Like
Reactions: Sudhp

    Sudhp

    Points: 2
    Helpful Answer Positive Rating
You can use flag when you received true byte or data on serial port if this flag is set then you call your fire_alaram(); function.

for example


Code C - [expand]
1
if (received byte==True) {call your function }else {w8 for the true data.}

Yes this is how i am not getting error and its working fine....
Thanks Everyone...
 

This approach also pointless. UART receiver has RX buffer full flag which can be checked the same way without any interrupt.
Interrupt for uart needed when you need to receive whole string. You put data to memory and increase the pointer.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top