• 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.

Bizarre MPLab 8.92 Problem (SOLVED)

Not open for further replies.


Well-Known Member
Most Helpful Member
Working on a program that was working prior to an MPLab fail. Now program will not build and lots of #113 (Symbol no previously defined) and #126 (Argument out of range ) errors.
Language: MPASM
Assembler: MPLab 8.92
MCU: PIC16F1829 @ 5V
Programmer: ICD3

Sequence of events:
Project involves controlling the AS3935 lightning detector. I typically work with a single project folder. As I develop various versions of the program, they go in the same project folder and are added or removed from the project tree as needed. When changing the active/working .asm file, I go to build options and disable case sensitivity. This particular project now has about 6 versions of the assembly file.

Each program version has the same set of macros. They include a delay macro and stack-based print macro from Mike -- K8LH. There are a couple of other macros that I wrote. The macros work in every version of this program.

As I was doing hardware debugging of the current program MPLab stopped and gave an message that source code had changed and gave me the option of "rebuilding now." Source code hadn't changed, but I agreed to the rebuild. All hell then broke loose.

Cannot get the program to build. There are a slew of #113 and #126 errors. All of which point to calls from the macros.

The Watch window is a complete mess:

Those missing registers are all defined:

     CBLOCK 0x70     ;registers 0x70 to 0x7F accessible on from all banks
delayhi                  ;used in DelayCy macro
;txbyte                  ;input to Put232
temp                     ;generic temp register
Reg7                     ;AS3935 distance reg


     #define   SCK       PORTB,6 ;SPI clock
     #define   SDO       PORTC,7 ;MOSI
     #define   SDI       PORTB,4 ;MISO                  
     #define   CSn       LATC,6  ;!SS or chip select, pin7
     #define   Ser_out   LATC,4  ;serial output pin              only used in LCD initialization CHECK PUT232&&&&&&&&&&&
     #define   TxOut     4       ;RC4,output pin bit number 
     #define   SW1       5       ;RB5  
     #define   SW2       7       ;RB7
What I have tried:
1) Turned everything off, disconnected, exited and reopened MPLab a few times. Same result.
2) Removed current version of program from the project tree and re-installed most recent previous version. Version has same macros . That version built fine. Reversed that process and re-installed current version -- still fails.
3) Tried going to release mode and programmer. Still doesn't work.


MPLab acts as if it has inserted some flag or block that is preventing it from loading/reading the entire code. Is there any way to look at what it may have done and forcibly make it read the whole code?



Well-Known Member
Most Helpful Member
I've had this happen in the past and the only way I found to get everything working again was to make a new project and copy and paste the source files into it. It's like you say, it's as if a flag has been set or a path changed but I could never find it.


Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Agreed! The project file has become corrupt... I also have had this happen!! The last time I either deleted the MCP file or the MCW file and it winged but rebuilt a new one.... I think it was the latter!

Before you try... Rebuild the project rather than build... Rebuilding renews the project...


Well-Known Member
Most Helpful Member
Thanks, Ian.

By the time I went to bed, I had some plans, but as I get up at 0400 local, they had to wait. I will try your suggestion of deleting a file first. My idea was to install one of the programs that works. Then copy past the bad code to a text file (Notebook), save, and then re-open it in a fresh window in MPLab and save as .asm. If those fail, I will try copying the body of the code to a working head (everything above "start") or visa versa.

Will let you know what happens.



Well-Known Member
Most Helpful Member

Deleting MPLab files and a lot of other failed tries didn't work. Of course, the errors were a bit too cryptic to help, and I am too damn dyslexic to recognize correctly every character in a statement.

After whittling the "failed" program down to its bare essentials, I noticed something in the delay subroutine:

I don't have a clue how it got there, but that was the issue. I did not consciously mess with any of my regular routines. No more two pages of errors. Original compiles just fine . Conclusion: "+" is not always better.:)

When we installed new software in our labs, IT could do a character by character comparison of results (many thousands) to find errors. Is there anyway to do that within MPLab or in a text file using Office or other software?

EDIT: As much as I hate Word, it does have a document compare, and it was able to find the error in a test:


Didn't even have to change the extension from .asm to a more conventional text extension.

Last edited:

Mike - K8LH

Well-Known Member
Ouch! Man, my cat has done that to me before (added a character to a source file). Unfortunately, that extra character you finally found doesn't really look out-of-place in that rather cryptic macro code (sorry)...

Happy to hear you found it and got it working again.

Cheerful regards, Mike
Not open for further replies.

Latest threads

EE World Online Articles