PDA

View Full Version : Config Error message



sinoteq
- 12th July 2010, 04:32
I started to use a new MCU today 18F46J11 and of course I expect new problems. But I did not expect the DEFINE OSC 4 standard line to kill me. It did! I can not compile with any OSC setting IF I also set the configuration bits in the code. I do not understand why this does not work. I am on MPLAB v8.50 using PBP2.60a (yes I patched yesterday)

This works except I do not the config settings right

ASM
CONFIG WDTEN = OFF ; Watchdog Disabled - Controlled by SWDTEN bit
CONFIG STVREN = OFF ; Stack Overflow/Underflow Reset Disabled
CONFIG XINST = OFF ; Extended Instruction Set Disabled
CONFIG CP0 = ON ; Program memory is code-protected
; CONFIG OSC = INTOSCPLL ; Oscillator INTOSCPLL
CONFIG T1DIG = OFF ; Secondary Oscillator clock source may not be selected T1OSCEN Enforcement
CONFIG LPT1OSC = ON ; Low-power operation Low-Power Timer1 Oscillator
CONFIG FCMEN = OFF ; Disabled Fail-Safe Clock Monitor
CONFIG IESO = OFF ; Disabled Internal External Oscillator Switch Over Mode
CONFIG WDTPS = 1 ; 1:1 Watchdog Postscaler
CONFIG DSWDTOSC = T1OSCREF ; DSWDT uses T1OSC/T1CKIDSWDT Clock Select
CONFIG RTCOSC = INTOSCREF ; RTCC uses INTRCRTCC Clock Select
CONFIG DSBOREN = OFF ; DisabledDeep Sleep BOR
CONFIG DSWDTEN = OFF ; DisabledDeep Sleep Watchdog Timer
CONFIG DSWDTPS = 2 ; 1:2 (2.1 ms) Deep Sleep Watchdog Postscaler
CONFIG IOL1WAY = OFF ; The IOLOCK bit (PPSCON<0>) can be set and cleared as needed IOLOCK One-Way Set Enable bit
CONFIG MSSP7B_EN = MSK5 ; 5 Bit address masking modeMSSP address masking
CONFIG WPFP = PAGE_0 ; Write Protect Program Flash Page 0Write/Erase Protect Page Start/End Location
CONFIG WPEND = PAGE_WPFP ; Pages WPFP<5:0> to (Configuration Words page) write/erase protected Write/Erase Protect Region Select bit (valid when WPDIS = 0)
CONFIG WPCFG = ON ; Configuration Words page erase/write-protected Write/Erase Protect Configuration Region
CONFIG WPDIS = OFF ; WPFP[5:0], WPEND, and WPCFG bits ignoredWrite Protect Disable bit
ENDASM




OSCCON=%11101000
OSCTUNE.6=1
DEFINE OSC 4

This does not work

ASM
CONFIG WDTEN = OFF ; Watchdog Disabled - Controlled by SWDTEN bit
CONFIG STVREN = OFF ; Stack Overflow/Underflow Reset Disabled
CONFIG XINST = OFF ; Extended Instruction Set Disabled
CONFIG CP0 = ON ; Program memory is code-protected
CONFIG OSC = INTOSCPLL ; Oscillator INTOSCPLL
CONFIG T1DIG = OFF ; Secondary Oscillator clock source may not be selected T1OSCEN Enforcement
CONFIG LPT1OSC = ON ; Low-power operation Low-Power Timer1 Oscillator
CONFIG FCMEN = OFF ; Disabled Fail-Safe Clock Monitor
CONFIG IESO = OFF ; Disabled Internal External Oscillator Switch Over Mode
CONFIG WDTPS = 1 ; 1:1 Watchdog Postscaler
CONFIG DSWDTOSC = T1OSCREF ; DSWDT uses T1OSC/T1CKIDSWDT Clock Select
CONFIG RTCOSC = INTOSCREF ; RTCC uses INTRCRTCC Clock Select
CONFIG DSBOREN = OFF ; DisabledDeep Sleep BOR
CONFIG DSWDTEN = OFF ; DisabledDeep Sleep Watchdog Timer
CONFIG DSWDTPS = 2 ; 1:2 (2.1 ms) Deep Sleep Watchdog Postscaler
CONFIG IOL1WAY = OFF ; The IOLOCK bit (PPSCON<0>) can be set and cleared as needed IOLOCK One-Way Set Enable bit
CONFIG MSSP7B_EN = MSK5 ; 5 Bit address masking modeMSSP address masking
CONFIG WPFP = PAGE_0 ; Write Protect Program Flash Page 0Write/Erase Protect Page Start/End Location
CONFIG WPEND = PAGE_WPFP ; Pages WPFP<5:0> to (Configuration Words page) write/erase protected Write/Erase Protect Region Select bit (valid when WPDIS = 0)
CONFIG WPCFG = ON ; Configuration Words page erase/write-protected Write/Erase Protect Configuration Region
CONFIG WPDIS = OFF ; WPFP[5:0], WPEND, and WPCFG bits ignoredWrite Protect Disable bit
ENDASM




OSCCON=%11101000
OSCTUNE.6=1
DEFINE OSC 4

ScaleRobotics
- 12th July 2010, 05:55
There is a long explanation about it in general here: http://www.picbasic.co.uk/forum/showthread.php?t=543

But if you look at the last couple posts, you will see some talk about what you describe.

The newer chips use OSC in their .inc file, so when you say OSC = 4, it sort of breaks things. (If you really want OSC = 4, just leave that out, and it will default to 4mhz).

Take a look at the PIC18F46j11.inc file, and you will see:


; Oscillator:
; OSC = INTOSC INTOSC
; OSC = INTOSCO INTOSCO (CLKO-RA6)
; OSC = INTOSCPLL INTOSCPLL
; OSC = INTOSCPLLO INTOSCPLLO (CLKO-RA6)
; OSC = HS HS
; OSC = HSPLL HS+PLL
; OSC = EC EC (CLKO-RA6)
; OSC = ECPLL EC+PLL (CLKO-RA6)
One way around it is Bruce's suggestion. I have tried it, and it works. However, it will break other include files that use the OSC setting to set timer speeds, etc. But if you rename your modified code, you can always change it back.

I see this as Microchips problem of changing things on the fly. They seem to make it hard for their 3rd party vendors to try to keep up. In this case, it seems difficult for MeLabs to come up with a perfect solution, but we will see.

sinoteq
- 12th July 2010, 06:23
I see this as Microchips problem of changing things on the fly. They seem to make it hard for their 3rd party vendors to try to keep up. In this case, it seems difficult for MeLabs to come up with a perfect solution, but we will see.

So OSC is now a Microchip reserved word as well as a PBP reserved word? And how smart is that on a scale from 1 to minus something really big? :) I can not use the default setting of 4MHz I want faster.... and I want a standard installation of both MPLAB and PBP because of future upgrades... and I want config fuses set in the code.

ScaleRobotics
- 12th July 2010, 06:52
I can not use the default setting of 4MHz I want faster.... and I want a standard installation of both MPLAB and PBP because of future upgrades... and I want config fuses set in the code.

Me too! But it looks like we can't have it all.

Just give up one must-have, and you will be good ;) , or you might have to wait for PBP 2.70.

=4 mhz = good
configs in PBP inc file = good
edit pbp PBPPIC18.LIB file = good

sinoteq
- 12th July 2010, 11:08
Me too! But it looks like we can't have it all.


Maybe but these are things that makes PBP less fun to work with, already I can not use a standard combination with PBP and MPLAB just because the default directories are different in Windows with different regional settings. To pach from 2.60 to 2.60a I must re-install PBP because the .BAT file is different from the CD's. This of course also removes all other "specials" that I have made to make PBP work as I like it. I do understand the compexity in making PBP and the hard work put into it but if things like this exists what else is "broken"?

What is the difference between Jurasic Park and PBP?
One is a movie, the other is an adventure park :)