PDA

View Full Version : Cannot compile for 40MHz 4 x pll



passion1
- 20th October 2007, 11:24
I have a PIC18F2320 and PIC18F242 and would like to run either one @ 40MHz with 4 x pll using a 10MHz crystal.

I cannot get my PBP program to compile.
I am using:
MicroCode Studio Plus V3.0.0.0.
PicBasic Pro 2.47
Asembler = MPASM


The first two lines of my pbp program is:

@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H
' Oscillator switch OFF
' Use HSPLL (fosc X 4) oscillator (10mhz)

DEFINE OSC 40


If I try to compile my program for the PIC18F2320, I get the following error message:

'Symbol not previously define (_OSCS_OFF_1H)'

If I try to compile my program for the PIC18F242, I get the following error message:

'Overwriting previous address contents'


I noticed that the .inc file for the 18f2320 differs from the .inc file for the 18f242 as follow:

18f2320: __CONFIG _CONFIG1H, _XT_OSC_1H
18f242 : __CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H

I also tried to change the inc file for the 18f2320 to

__CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H

but then I get one additional compiler error for the 18f2320.inc file:

Symbol not previously defined (_OSCS_OFF_1H)


Please help!!
Thank you.

passion1
- 20th October 2007, 11:34
I'm using MPASM v5.03

Any help is appreciated!

BigWumpus
- 20th October 2007, 21:52
It's a non-stopping-mess with this CONFIGs...

1. For the 18F-Devices you must use MPASM.
2. The 18F2320.INC-file in PBP looks nice - but is useless IMHO. The many fuses which can be used are ignored, but if you use your own __CONFIGs, you get an error (overwriting ...).
3. There are many similar threads and Mel has written the answer...
4. For me - I comment the CONFIG-lines inside the PBP-inc-files and write my own __CONFIG-directives in my code ... the hole xx bytes long. What to write is hidden in the P18F2320.INC-file inside MPASM ! (the last part of the file).
5. Using this, you will get a warning out of MPASM to use the new CONFIG-directive.
6. Using this, you will get further errors, because MPASM is not compatible to the writing inside its own INC-files!

passion1
- 20th October 2007, 22:44
BigWumpus

Thank you for your reply.
I have searched this forum and looked at the other threads in this regard before I posted my question, and the code I am using is the code suggested by Mel?
I must be missing something because I cannot figure out the fix from those other threads.
Please excuse my ignorance but I do not fully understand what you are suggesting.
Are you saying there is no solution to the problem? (refer point 5 and 6)
Thank you for taking the time to help me!

BigWumpus
- 20th October 2007, 23:15
Go inside your 18F2320.INC inside the PBP-directory.
Comment out all CONFIG__-lines by a ";".
Look inside the P18F2320.INC-file in your MPASM-directory and get the possible settings.

f.e.:

@ __CONFIG _CONFIG1H, _HSPLL_OSC_1H
...

passion1
- 21st October 2007, 14:01
BigWumpus

Thank you!
I did what you suggested and using the following setting for the PIC 18F2320, my pbp program compiles!

@ __CONFIG _CONFIG1H, _HSPLL_OSC_1H

However, now my pic18f2320 resets continuously?
This is the first time I am using a pic18f.
Up to now I have been using a pic16f73 without any problems.
I have used the same circuit which worked fine for my pic16f73 (similar to the one on page 9 of the pbp manual, showing the basic setup).
Does anyone know of any specific issues that one should be aware of when changing from pic16f to a pic18f. Should my circuit be modified in any way? (both the pic16f73 and pic18f2320 is 28 pin pics with an almost identical pin layout)
Can it be that the pic 18f is more sensitive to voltage changes?

passion1
- 21st October 2007, 14:10
Trying to track the reason for the continuous reset I display the values for
Power-on-reset (POR), Brown-out reset (BOR) , stack full reset (STKFUL) and stack underflow reset (STKUNF) bits, but all are showing to be zero after each reset, so that does not seem to be the problem?

BigWumpus
- 21st October 2007, 14:29
Trying to track the reason for the continuous reset I display the values for
Power-on-reset (POR), Brown-out reset (BOR) , stack full reset (STKFUL) and stack underflow reset (STKUNF) bits, but all are showing to be zero after each reset, so that does not seem to be the problem?

WDT ?

Missing Loop ?


You have to write down all the CONFIG-Lines for all Config-registers !
You have to read the other lines inside the files too !

passion1
- 21st October 2007, 17:50
BigWumpus

Thank you for the advice! :)
Everything is working now!!