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 overflow in MPLAB run mode

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



Joined: 02 Sep 2005
Posts: 49
Location: Nottingham, UK

View user's profile Send private message

stack overflow in MPLAB run mode
PostPosted: Mon Oct 03, 2005 5:26 am     Reply with quote

Hi,

I'm using MPLAB V7.00 and the latest version of CCS. When I compile and then RUN my project in MPLAB I keep getting UART-W0006 warnings and stack overflow problems. I can't seem to put my finger on what is wrong. I've attached the code, it's fairly simple. If I don't setup the UART the problem goes away, it also occurs when using printf to an LCD. Any ideas?
Code:


#include <16F877A.h>
#fuses NOWDT,XT, PUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
#use delay(clock=4000000)
#use rs232(baud=2400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)


int M25P40_id();      // Prototype for reading the ID of M25P40.


#define HOLD_bar PIN_C0      // Used for the M25P40 flash routines
#define WR_bar   PIN_C1      // Used for the M25P40 flash routines
#define SYNC_bar PIN_B6      // Used for the M25P40 flash routines


void main()
{

int dataout;



    while (1)
    {
    dataout = M25P40_id();                 // Read the M25P40 ID into data
    }



}



int M25P40_id()      // Function for reading the ID of a M25P40 flash device.
{
    int data;
    setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_CLK_DIV_16 | SPI_XMIT_L_TO_H);
    output_high(SYNC_bar);                // Sync_bar line high
    output_low(SYNC_bar);                // Sync_bar line low
    spi_write(0b10101011);         // Read ID.
    spi_write(0x00);            // Dummy byte
    spi_write(0x00);            // Dummy byte
    spi_write(0x00);            // Dummy byte
    data = spi_read(0x00);                      // Read data
    output_high(SYNC_bar);               // Sync_bar line high
    setup_spi(SPI_SS_DISABLED);         // Disable the SPI bus
    return data;
}


WARNING MESSAGES GENERATED :-


UART-W0006: Receive file has no data or failed to attach
when UART receive mode Enabled.
 
CORE-E0001: Stack over flow error occurred from instruction at 0x000168

_________________
Tim
Ttelmah
Guest







PostPosted: Mon Oct 03, 2005 7:06 am     Reply with quote

Have you possibly got a stimulus file setup in the simulator?. I have seen similar behaviour, when I had the simulator set to receive characters, and had not included any code to handle them.

Best Wishes
TIMT



Joined: 02 Sep 2005
Posts: 49
Location: Nottingham, UK

View user's profile Send private message

PostPosted: Mon Oct 03, 2005 8:02 am     Reply with quote

Hello there, No I haven't a stimulus file set up, that may be the problem. I think I may need to have a look at creating one. Thanks

Tim.
_________________
Tim
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 03, 2005 10:53 am     Reply with quote

Quote:
I'm using MPLAB V7.00

Vs. 7.00 has problems with the UART1 simulator. Here is a thread
on the Microchip forum about it.
http://forum.microchip.com/tm.asp?m=64251&mpage=1&key=uart%2Dw0006&anchor#64251

You shouldn't be using 7.00. I know from my experience that it
has problems with UART1. Download vs. 7.21 or later. I know that
it works OK with UART1.
TIMT



Joined: 02 Sep 2005
Posts: 49
Location: Nottingham, UK

View user's profile Send private message

PostPosted: Tue Oct 04, 2005 2:29 am     Reply with quote

Thanks for your reply, I'll update MPLAB when I get chance.
_________________
Tim
TIMT



Joined: 02 Sep 2005
Posts: 49
Location: Nottingham, UK

View user's profile Send private message

PostPosted: Tue Oct 04, 2005 3:20 am     Reply with quote

Thanks for your help. I updated to V7.20 and all my warning messages to do with stack overflow and the UART seem to have vanished! touch wood.

Regards Tim.
_________________
Tim
TIMT



Joined: 02 Sep 2005
Posts: 49
Location: Nottingham, UK

View user's profile Send private message

PostPosted: Thu Oct 06, 2005 6:44 am     Reply with quote

Hi there, Confused

Having updated to MPLAB V7.20 then V7.21 which got rid of the UART problem, I've found that when I try to assemble previous assembly code projects I get a CONFIG directive error, so unfortunately I've had to go back to V7.00 until Microchip get back to me with an answer. I'm in the process of converting my old .asm projects to .c ones with ccs but until then I'll have to stick with v7.00 unless anyone here knows the answer?
_________________
Tim
TIMT



Joined: 02 Sep 2005
Posts: 49
Location: Nottingham, UK

View user's profile Send private message

PostPosted: Thu Oct 06, 2005 8:57 am     Reply with quote

Just for info, the problem was with the NEW directive in V7.20 called CONFIG - was __CONFIG. I had a label called CONFIG in my .asm code which it now thinks is a directive and through up an error. I renamed the label CONFIG to MYCONFIG and ok now. I don'f know if CCS would ever generate a label called CONFIG I hope not. Must be a lot of code out there with CONFIG as a label.
_________________
Tim
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