Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MPLAB C18 Problem

Status
Not open for further replies.

micr0man

Member
hello everyone,

I am having a unique problem with my C18 compiler. For unexplained reasons compiling a really simple program over half my data memory is used. Below is a snapshot of the problem:
lots-of-ram-png.52373


as you can see the very simple program is using 268 bytes of data ram without even any bytes defined.

I am using a PIC18F4220 with MPLAB v8.66. The C18 compiler is the most recent free version of the microchip. I can zip the whole project if you wish or submit individual files.

I hope you can help me with this problem and any help is appreciated,

Dave

Edit: Sorry about the size problem. is there any way to reduce the picture size?
 

Attachments

  • lots of RAM.png
    lots of RAM.png
    150.4 KB · Views: 1,319
Last edited:
Check out the linker file ....MCC18\lkr\18f4220.lkr

You will see that 0x0100 bytes (256 decimal) is reserved for the C18 stack.

Your program only "uses" 12 bytes.

Hope this helps
 
Last edited:
thank you very much. your help is greatly appreciated.

Is there a way to lower this or is it set permanently?
 
Is there a way to lower this or is it set permanently?

To change stack size you can-

1 edit ....MCC18\lkr\18f4220.lkr

or

2 copy the .lkr file to your project directory, add it to your project, then edit it.

or

3 leave everything as it is. When your program gets bigger, C18 might need the stack space
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top