Hi Muddy,
Not those Mxxx inc files, these 16f886.inc files. Check here: C:\PBP\
![]()
Hi Muddy,
Not those Mxxx inc files, these 16f886.inc files. Check here: C:\PBP\
![]()
Last edited by ScaleRobotics; - 27th July 2011 at 17:47.
Ah, come on now Peter...Why did you go open the M16F88x.inc ? (I don't even have that file on my system.)If you wan't to see how they "work" and what they are simply open the .inc file for the specific target you're compiling for, it's located in the root of the PBP folder. For the 16F886 the fileneme is 16F866.INC and looks like this:
It's not THAT hard...but you have to actually read ;-)
Aah, there it is. I didn't look through the whole directory, did I?
So If I change
__config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
to
__config _CONFIG1, _XT_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
that should then make the default suit my preference? And I shouldn't need to do a config with any new programs, unless I want or need to change them?
Thanks Man.
Peter Moritz.
Up the bush, Western Plains,
New South Wales,
Australia.
after a bit more experimentation....should be
__config _CONFIG1, _XT_OSC & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
Peter Moritz.
Up the bush, Western Plains,
New South Wales,
Australia.
Yep, looks good to me. As you can see, the different configuration settings for the oscillator (and everything else) are at the bottom of the P16F886.inc file (the one in the MPASM folder):On the 16F886 there are two CONFIG words (on other chips there are more) so if you need to change something that resides in another CONFIG word you have to add a second line, likeCode:_LP_OSC EQU H'3FF8' _XT_OSC EQU H'3FF9' _HS_OSC EQU H'3FFA' _EC_OSC EQU H'3FFB' _INTRC_OSC_NOCLKOUT EQU H'3FFC' _INTRC_OSC_CLKOUT EQU H'3FFD' _EXTRC_OSC_NOCLKOUT EQU H'3FFE' _EXTRC_OSC_CLKOUT EQU H'3FFF' _INTOSCIO EQU H'3FFC' _INTOSC EQU H'3FFD' _EXTRCIO EQU H'3FFE' _EXTRC EQU H'3FFF'Then you have your defaults and it is what will be included in every program you compile for that particular target, no need to have them in your code if you don't want to.Code:__config _CONFIG2, WRT_HALF & _BOR21V
/Henrik.
Just throwing in my 10 cents here. Instead of changing the defaults in the PBP file, just make a seperate file with the configs you want. It can be a 1 line file with justthen "INCLUDE" the file in your programs. There are 2 reasons I suggest this. First is if you change the PBP file, then upgrade later, all your changes are lost. Second It is a simple matter to change your include file for different setups like now you want to use internal osc and so forth. Also it is much easier to understand for YOU in a year or 2 what the configs were doing without having to track down the .inc and read it.Code:__config yada yada yada
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bert, your idea of putting CONFIG statement in an include file is a great one that I want to implement in all of my codes. However, I tried it in one of my working application codes and the code stopped working afterwards. In hopes you can tell me why here is what I did:
1. I created a new .inc file by copying and pasting the following statements into a new code file and saving it as a .inc file in the PBP folder where all of my codes are in a subfolder to the PBP folder.
INCLUDE "18F2550_4550_CONFIGS.inc" ' Setup CONFIGS for MCU
;--- if you un-comment these, you must comment the ones in the .inc file--
;ASM ; 18F2550/4550, 8mhz crystal
;__CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
;__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
;__CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
;__CONFIG _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
;__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
;ENDASM
2. I then replaced the CONFIG statements in my application code with the follwoing statement in which I commented out all of the original CONFIG statements:
Include "18F2550_4550_CONFIGS.inc"
;--- if you un-comment these, you must comment the ones in the .inc file--
;ASM ; 18F2550/4550, 8mhz crystal
; __CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
; __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
; __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
; __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
; __CONFIG _CONFIG3H, _PBADEN_OFF_3H ; PortB resets as digital
; __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
;ENDASM
3. The modified application code compiles and assembles OK and appears to run, but it no longer works correctly and I can't see why.
4. If I comment out the new .inc statement and uncomment the _CONFIG statements it works OK again.
Can you tell me what I am doing wrong?
Thanks, John Ellis
Last edited by jellis00; - 7th August 2011 at 22:56.
Bookmarks