There are various ways of including your CONFIG settings into an 18F series PIC... here's one...
1. Go and find the 18F2680.INC file in your PBP subdirectory.
2. Make a COPY of it and file the copy away safely as the ORIGINAL in case you need to go back to it at some time in the future.
3. Use Notepad or some similar editor and REMOVE these three lines...
__CONFIG _CONFIG1H, _OSC_XT_1H
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
__CONFIG _CONFIG4L, _LVP_OFF_4L
4. Save the file.
Now, in your .BAS Source code, somewhere at the start of your program you can include lines like this (this is just an example and these settings may not be suitable for the P18F2680 or for your needs)...
Code:
'
' PIC Defines
' ===========
@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
' Oscillator Switch-over Disabled
' Set for XT Oscillator
@ __CONFIG _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_42_2L
' Brown-Out Reset Enabled
' Power-On Timer Enabled
' Brown-Out Trip set to 4.2v
@ __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
' WatchDog is ON
' Watchdog Postscaler set to 1:128
@ __CONFIG _CONFIG3H, _CCP2MX_ON_3H
' CCP2 is Multiplexed with PortC.1
@ __CONFIG _CONFIG4L, _LVP_OFF_4L
' Low-Voltage Programming is OFF
@ __CONFIG _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L & _CP2_ON_5L & _CP3_ON_5L
@ __CONFIG _CONFIG5H, _CPB_ON_5H & _CPD_ON_5H
There will be no errors and no clash with duplicate configurations which are not allowed with the MPASM compiler.
Where do you find a list of configuration definitions? Two places, cross reference BOTH... (a) The DATASHEET Section "Special Features of the CPU" and (b) the P18F2680.INC file in the MPASM Suite subdirectory of your MPLAB installation. Look towards the end of the file to find the Configuration Bits settings.
Bookmarks