Let's Make Robots!

MPLAB IDE - The output window (Part 3)


Following on from my last post here

The Output Window

Ok once you have created your project with the project wizard you can actually build the project at this stage. Of course if you uploaded the code to your pic it won't do anything as it is just minimal code supplied by the template you selected earlier. But it will tell you if all the files necesary are there.
Assuming you have done the gooligum tutorials or read the datasheet for your device and understand the instruction set and registers you can now add some code into the template file. The one ending in .asm
Once you think you have your code complete and are ready to try it click the build button again and the compiler will got to work.
You should have the output window open(tick output under the view menu) and you will see the code being processed.
The output will then tell you whether the build was successful and if it wasn't what errors and warnings you have.
Starting with the benign but common warning message[302] as you will see in the image below(click here for better quality)

You will see I've drawn a red line and circled the 3 places where the warning occurs. Mplab nicely tells you on which line the error or warning occurs.
Because of the architecture of the pic the registers are organised in banks and this message is warning you that the registers you are addressing are in a bank other than 0. As you can see regardless of whether you have selected the correct bank before changing a register the code will still build. However you can expect odd behaviour if you have not kept track of which bank you are in.

Here's an example of an error that will not build.

You might see the pattern in the output window now.
Error message: File Name/Location: Line number: Description

I have created Error[113] by texting out the definition of Rx_STATUS in my variable declarations. You will see it is all in green. The same error will occur if you make a spelling mistake when referring to it or change case. Declarations are case sensitive.
Because this variable is referenced 11 times in the file and I hid the declaration we have an error at each line it is referenced. If you mispelt you may have only done it on one line so there will only be one error.
Mplab is so nice as to tell us the name we have used that it doesn't recognise(Rx_STATUS). You can see the third underline above.

Other error messages and warnings can be learnt about by using the MPLAB help and selecting mpasm assembler in topics. Type error in the search box and it will give a listing.
Or refer to DS33014(mpasm assembler User's Guide) I referenced in my first post on mplab.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
octospider's picture

Have you tried the MPLAB X IDE?

I have only used it a little bit, but I think that it works OK and makes it easier to program (C language)

merser's picture

I'm juggling space on my main pc at the moment.

It's on my to do list. I didn't want to try it when it first came out but it's well and truly matured now and from screenshots looks ok.
I think I'd still keep a copy of the older mplab like I kept my pickit2 for the nice extras it has in it and the simple way it works even though I have a pickit3.
But to program newer pics, in the end we'll be forced to upgrade to both mplabx and pickit3.
I have not done C on pics only on arduino and mbed but that could always change.

birdmun's picture

I might even try my hand at assembly for PICs. I know they only have a handful of instructions, and, that is supposed to make them easier to learn to program. I used to own a rather large tome by Myke Predko. I believe I currently have a pdf version of said tome.

Thanks for the effort you are putting in to this.

merser's picture

But I found that book very confusing birdmun. I tried to give it away when I sold a development board I no longer used but the guy already had it. The pseudo code used in it didn't do much to help understand what was going on.  I shudder whenever somebody suggests that book.
Without a doubt the best tutorials on pics are the gooligum tutorials. He covers some of what I am covering but my intention is only to inform about using MPLAB. As an IDE, it is the one I compare all others to.
At the moment I'm heavy with flu and forgot to cover the template file first before the output window. No harm done I'll adjust the link from each page when I do templates.