PDA

View Full Version : How to use MPASM 'INC' files?



circuitpro
- 28th January 2009, 00:28
Hi,

I am trying to compile a program for a PIC18F67J60, and need to set the
FOSC0 and FOSC1 bits. These are located in a CONFIG2L register. I was told that these could be set in the 'P18F67J60.INC' file that came with the MPASM compiler, but I don't have the slightest idea how to do it.

Can somebody please tell me how to use these INC files?

Thanks very much!

mackrackit
- 28th January 2009, 06:43
The file you need to modify is in the PBP directory. 18F67J60.inc

The P18F67J60.INC is in the MPASM directory. Near the end of this file is all of the options for the configs.

Have you seen this thread? Might find it handy.
http://www.picbasic.co.uk/forum/showthread.php?t=543

Fredrick
- 28th January 2009, 12:51
Try this...
http://www.picbasic.co.uk/forum/showthread.php?t=10443&highlight=18f2550

circuitpro
- 28th January 2009, 19:29
PERFECT! Thanks for your kind help.

circuitpro
- 30th January 2009, 02:37
When in include this line:

@ INCLUDE "P18F67J60.INC"

I get

"Message[310] c:\path...\p18f67j60.inc 3210: Superseding current RAM and RAM map"

What does this mean? (MPASM did report that the assembly was successful, however)

mackrackit
- 30th January 2009, 02:46
Do not include that line. The compiler has already taken care of all that.

circuitpro
- 30th January 2009, 03:25
Yeah, that was slowly dawning on me. All I'm trying to do is set the oscillator to EC (external oscillator). So, after looking at the .inc file, it says at the bottom that there's a bunch of settings that are valid, including FOSC=EC. (They all have ; in front

so I include this line in my PBP program...

@ CONFIG FOSC=EC

and I get the following:

Error[176] c:\path...\test.asm 75: CONFIG Directive Error: (multiple definitions found for setting "FOSC")

I have NOT removed any ; from in front of the settings (actually, I tried it both ways), so don't know what's wrong.

mackrackit
- 30th January 2009, 04:21
This thread will help
http://www.picbasic.co.uk/forum/showthread.php?t=543

In the PBP *.inc file you will need to comment out the config lines to set the configs in code space.

The default setting in the PBP *.inc file is for HS. An external OSC. So you really do not have to do anything.

The file you are looking at with ";" in front of each line is the MPASM inc file. You DO NOT want to change anything here. Just look at it to see the options.

I will bet HS is the setting you want. That is for an external resonator.
EC will give a clock out function.

circuitpro
- 30th January 2009, 05:12
Oh my gosh, you're right!!

I really AM confused! I see that the settings are actually set in the c:\pbp\18F67J60.INC file. When I want to change settings, should I just edit this c:\pbp\18F67J60.INC file manually, or put @ CONFIG lines in my source file??

Then what is the purpose of the c:\mpasm\mpasm suite\P18f67J60.INC file? Just to show what options are available?

mackrackit
- 30th January 2009, 05:22
CONFUSED! Hey , that means thing are going well:)

It is kind of a personal preference as to where you set the configs.

If you do not plan on changing them often then the inc file might be the way to go. If you like playing with things or have different applications using the same chip then setting the confis in your code might be better.

If you do set them in the code you will not have to remember how you have things setup when you do an upgrade or something like that.

The MPASM *.inc is also used by the compiler...or is it the assembler?
If you read through it you will see all of the lines that are not commented. Those are used for something somewhere.:)