First, go to the 18F1320.inc file in the PBP directory and comment the comment the config lines so it looks like this. Now the configs can be played with in code space.
Now go to the MPASM directory and open the P18F1320.inc and near the EOF you will find all of the possible config options and in this one there is even a sample. Copy the sample to the top of your code.Code:NOLIST ifdef PM_USED LIST "Error: PM does not support this device. Use MPASM." NOLIST else LIST LIST p = 18F1320, r = dec, w = -311, w = -230, f = inhx32 INCLUDE "P18F1320.INC" ; MPASM Header ; __CONFIG _CONFIG1H, _XT_OSC_1H ; __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H ; __CONFIG _CONFIG4L, _LVP_OFF_4L NOLIST endif LIST EEPROM_START EQU 0F00000h BLOCK_SIZE EQU 8
For now change the CONFIG1H and CONFIG3H to match below. You can do other changes as needed.
Now if you want to run at 40MHz you will need an external crystal or resonator running at 10MHz.Code:'18F1320 INTERNAL OSC RUNNING AT 8MHZ - MCLR AS INPUT AND OSC PINS AS INPUTS @ __CONFIG _CONFIG1H, _INTIO2_OSC_1H & _FSCM_OFF_1H & _RC_OSC_1H @ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _BORV_27_2L @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32K_2H @ __CONFIG _CONFIG3H, _MCLRE_OFF_3H @ __CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_ON_4L & _STVR_ON_4L @ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L @ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H @ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L @ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H @ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L @ __CONFIG _CONFIG7H, _EBTRB_OFF_7H OSCCON=%01110000 DEFINE OSC 8
Changing the first line of the configs.
That should do it if I did not screw something up ....Code:'18F1320 EXTERNAL OSC RUNNING AT 10MHZ PLL TO 40MHZ - MCLR AS INPUT AND OSC PINS AS INPUTS @ __CONFIG _CONFIG1H, _HSPLL_OSC_1H & _FSCM_OFF_1H & _RC_OSC_1H @ __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _BORV_27_2L @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32K_2H @ __CONFIG _CONFIG3H, _MCLRE_OFF_3H @ __CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_ON_4L & _STVR_ON_4L @ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L @ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H @ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L @ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H @ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L @ __CONFIG _CONFIG7H, _EBTRB_OFF_7H DEFINE OSC 40





Bookmarks