CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Stack under flow error when write timer ISR.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dev39



Joined: 01 Jan 2010
Posts: 3

View user's profile Send private message

Stack under flow error when write timer ISR.
PostPosted: Fri Jan 08, 2010 5:51 am     Reply with quote

I am trying to create ISR for timer0. But if I get uncomment the ISR it gives me following error

CORE-E0002: Stack under flow error occurred from instruction at 0x00009c

If I comment that part, the program runs fine. I am trying to run this program on MPLAB SIM. MPLAB version is 8.33. The ccsc compiler version is 4.31. The reason I want ISR is I was to check if 1 sec time is elapsed between some instructions. Let me if there is some other way to do that.

I am new to micro controller programming. Any help is appreciated.

Code:


#include <18F46K20.h>

#use delay(clock=64M)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,stream=DEV)


#INT_RTCC
clock_isr() {                               
   int8 i=0;
}

void main() {
   int16 i=0,j=0;
   putc('r');
    setup_timer_0( RTCC_INTERNAL | RTCC_DIV_256 );
    set_timer0(0);
    enable_interrupts(INT_RTCC);
    enable_interrupts(GLOBAL);
   

   for(i=0;i<6550;i++);
    j=get_timer0();
   while(1){
//      delay_ms(100);
      putc('h');
   }
}

ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Jan 08, 2010 9:29 am     Reply with quote

Quote:
The ccsc compiler version is 4.31
This is an invalid version number. CCS version numbers always are in the format x.yyy

If your version number is 4.031 then this is the cause of your problems. The first releases of the v4 compiler were of bad quality and only for people willing to test the new features. Around version v4.070 the compiler because usable for the PIC18 again.
Revert to the older but stable v3.249 that was also available at time of your download, or upgrade to a newer version.
mkuang



Joined: 14 Dec 2007
Posts: 257

View user's profile Send private message Send e-mail

PostPosted: Fri Jan 08, 2010 12:14 pm     Reply with quote

I have version 4.064 and the above compiled without errors. However, you are missing fuse settings and you have to check the datasheet to make sure the default internal clock will be able to support 64M clock rate.
dev39



Joined: 01 Jan 2010
Posts: 3

View user's profile Send private message

the compiler version is 4.081
PostPosted: Fri Jan 08, 2010 8:13 pm     Reply with quote

the compiler version is 4.081
Ttelmah
Guest







PostPosted: Sat Jan 09, 2010 11:11 am     Reply with quote

Post the fuses you are using.
It does compile and run OK, on 4.081, with the fuses set correctly.
One thing that sometimes generates a stack fault like this, would be having the XINST fuse set.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group