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.

MPLAB - code stops working after 50.50% occupancy - version problem ?

Status
Not open for further replies.

prateek_k_chd

Member level 5
Joined
Sep 25, 2009
Messages
87
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
1,988
I'm using MPLAB 8.76 + PIC16F877a

I'm adding some new features to an existing product . Earlier the Output window in MPLAB displayed the Program space occupancy as 49.2%. The product ran fine.

But now,after tweaks, the code size is 52.3%. And the product doesn't work. Even the display doesn't work.


I've fiddled with the code and found that it stops working after the space crosses 50.5 % . To check this, i deleted the new modifications and added some redundant code - some simple loops and some other useless arithmetic calculations that do nothing but simply add to the code

The product works until this useless code doesn't bloat to more than 50.5% . But after that , even the display doesn't work.


The execution sequence is :


#include ...................

__CONFIG(0x1E32);


void main(void){

// Here goes the startup code
fnStartup();

// Let's proceed with the infinite loop

while(1)
{......................






So has anyone faced similar problem ? Any workarounds ??
Forgive me if this is a nOOb question - I'm relatively new to MPLAB.

P.S. - i've tried this with several pieces of 16f877a so it's not that my chip is bad.
The programmer I'm using is a clone of the USB programmer by PIC.I got it from here : eXtreme Electronics :: Programmers :: eXtreme Burner PIC
 

What compiler are you using with MPLAB, Hi-Tech?

What is the compiler version?

When you load the HEX file into the PIC, does it pass a verify test?

You've stated the level of FLASH usage.

What is the level of RAM usage? Are you using any large arrays or structures?

BigDog
 

Yes,I'm using HitTech v 9.82 Pro at level 9 optimization

This is what the output window says when the product is working :

Program space used 100Dh ( 4109) of 2000h words ( 50.2%)
Data space used 87h ( 135) of 170h bytes ( 36.7%)

The bloated code gives these values :

Program space used 110Ch ( 4364) of 2000h words ( 53.3%)
Data space used 8Ah ( 138) of 170h bytes ( 37.5%)

I'm not using any structures. I'm using a 4 byte array to hold the 8-bit display values for the 4 digit , 7-segment display

And if by " pass a verify test" you mean whether the programmer checks authenticity of the code it just burned , yes - it does verify that and no problems there.
 

Have you carefully examined the build message window for any indication of possible issues?

If you post your code, using the CODE tags (# button), or upload the zipped project directory.

I'll be happy to see if I can duplicate the issue here.

I have not personally experience any issues like you describe.

BigDog
 

Thanx bigdog.
I've uploaded the project folder.
Please note that it's a pretty juvenile piece of work.

If you compile it as such, it'll amount to 50.2 % (and this one works)

But If you go to ADC.C and

1) comment out line 357
2) de-comment lines 364 through 377

then the code goes up to 50.8 % and it stops working.

Please also note that the code to de-comment in 364-377 is also available in math.h and I've tried it,with the same result ( bloated code and stop working)

Thanks again.
 

Attachments

  • pHMeter.zip
    315.3 KB · Views: 39

I should be able to use one of the development boards I have here and simulate your design.

I'll post the results.

BigDog
 

Somewhere in the menus is a setting which goes something like "allow MPLAB to choose the memory ranges programmed" or "... Fix a manual range". I once had to work on a project started by someone else and a similar thing happened to me. I was adding code and suddenly everything stopped working. It took some finding but a fixed programming range had been previously selected. The final bit of code wasn't being programmed - it 'ran off the end'. With a compiler (mine was assembler) the code at the end may not be the last code you wrote.

Keith
 

Hey Folks...I found out the problem...my burner was problematic.

I had turned the code protection (the config word0 on...apparently the cheap PICKIT clones go bonkers if CP is on (or so happens with mine).

Sorry to have wasted your time on this ! And thanx again for the inputs.
 

I'm glad to here you figured it out.

So when you disabled code protection the your code performed as expected?

BigDog
 

Yes ,with the code protection off,the code executes exactly as expected !!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top