PDA

View Full Version : Changing the Configuration Settings



kiwipiper
- 24th October 2007, 01:44
Greetings,

I am using MicroCode Studio to write my code and then click Project/Compile and Program. This then opens meProg and I click Ctrl-P to program the PIC. The PIC is connected using MeLabs U2 USB Programmer. I do all this but am not really totally sure of what is going on.

My problem is I want to increase the oscilation value from 4 to 20. It says in the manual that I need to open an .inc file with the same name as my PIC and change XT to HS.

First problem is where is this inc file. There are a bunch in C:\PBP and I am guessing these are the ones. But next problem is there is not one exactly the same name as my PIC (PIC18F4620). However, there is one 18F46K20.INC.

There is a line in this file with OSC and XT in it: __CONFIG _CONFIG1H, _FOSC_XT_1H
So I change XT for HS as mentioned in the manual: __CONFIG _CONFIG1H, _FOSC_HS_1H

I then change the define to: DEFINE OSC 20
I change my 4MHz Ceramic Resonator with a 20MHz Ceramic Resonator, and all should be good one would think.

But it isn't - my program output does not work.

All I am doing is sending simple SEROUT2 i.e. Serout2 0, 16468, [$1b, $52, 1, DEC test]
My program seems to be running slower than when I had it using 4MHz

Anyone got any ideas of what I am doing wrong.

mackrackit
- 24th October 2007, 04:27
Check the version of PBP. You are looking in the right place for the *.inc file. Not sure of the version support started for the 18F4620. It is in PBP 2.47 but not in PBP 2.43.

kiwipiper
- 24th October 2007, 05:14
This is where it all gets a bit confusing for us new at this. The MicroStudio version I am using is 3.0.0.5 and the melabs Programmer is version 4.21 these are the only two programs I am using. How these relate to PBP or the version number 2.47 or 2.43 I am not sure. The only reason I looked in the PBP directory is that I did a search for .inc files and noticed that directory. I am happy to spend time reading about this somewhere but finding that special somewhere, where it is explained well seems to be the trick.

Cheers Bruce

Archangel
- 24th October 2007, 06:25
In Microcode Studio, click Help, and click about, it will open a pretty blue box and will display the versions of Microcode Studio and PBP. FSOSC is an oscillator with a fail safe backup oscillator which runs at something like 31.25 Khz. I do not have experience with any 18f series chips, if you are a noobie, maybe you should start out with a simpler 16F series chip like 16F648A, it has 4K memory, an eeprom and plenty of features to confuse you but far less than what you are using. This chip, the 18F, has OSCON register, Methinks it has something to do with your problem.
JS
EDIT: this is copy and pasted from the 18f4620.inc file in MPASM.
_OSC_HS_1H ' no F in there

kiwipiper
- 24th October 2007, 07:33
Yes, I think that is good advice that I should start with a simpler PIC and learn the ropes a bit before jumping in the big pool. At least then I know it is not advanced features that might be mudding the waters and confusing me. By the way my version of PBP (I get it now PicBasicPro) is version 2.5. My problem is that I want to know it all right away, and I see that is not going to happen. Thanks for all the help it has been very useful.

Cheers Bruce