Confused about PIC configuration

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
J. van Stijn
Posts: 8
Joined: Sun Oct 03, 2010 12:17 pm
Location: Arnhem, The Netherlands
Has thanked: 1 time
Contact:

Confused about PIC configuration

Post by J. van Stijn »

I'm a bit confused about the configuration of the PIC controller in general.

When looking at the exercises they all start with certain types of config flags which determine the clock source (crystal or capacitor), the frequency and so on..

However.. in the SourceBoost IDE enviroment you also have the options to set these kind of things (in conjunction with the PPP tool).
This seems kind of ambiguous doesn't it?

What is leading? What is required? What is best practice?

I would greatly appreciate any and all advice in this matter.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Confused about PIC configuration

Post by Benj »

Hello,

All the configuration settings are covered in the device datasheet.

Rule of thumb is that you do not want the watchdog timer enabled or the low voltage programming.

Crystals over 4MHz should use the HS setting whereas 4MHz or under should use XT.

J. van Stijn
Posts: 8
Joined: Sun Oct 03, 2010 12:17 pm
Location: Arnhem, The Netherlands
Has thanked: 1 time
Contact:

Re: Confused about PIC configuration

Post by J. van Stijn »

Benj wrote:Hello,

All the configuration settings are covered in the device datasheet.

Rule of thumb is that you do not want the watchdog timer enabled or the low voltage programming.

Crystals over 4MHz should use the HS setting whereas 4MHz or under should use XT.
Hi Benj,

Thanks for the response. However this was not quite the point I was asking making.
The point was the ambiguity in the several configuration options.

1 - In the sources using #pragma statements
2 - In the Sourceboost enviroment
3 - In the PPPv3 tool itself

I'm quite sure one of the two first configurations gets pushed into the PPPv3 tool, but what's the deal with the first two configurations?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Confused about PIC configuration

Post by Benj »

Hello,

Everyone seems to do configurations a different way. For example Microchip have a way of using assembler directives. However how do you know which directives are available and which will work together on a particular device. I've never understood why they did their config examples like this.

The #pragma directive is a way of assigning config data directly to the memory location by passing a value for the config register.

PPP and Sourceboost do a similar thing but the pragma is hidden and added during the compile process.

In my opinion PPP is literally the best tool out there as not only can you see the registers and the bits in the registers for each device but unlike MPLAB's config tool you are not limited to any particular dev environment.

Using PPP stand alone or as part of a compiler you can take a hex file and add config data for any PIC device :mrgreen:

Post Reply