I don't know if you're up for it, but if you are, let's try one more thing:
Getting the config settings from the manual for your hardware, as you showed in your first example:
/** C O N F I G U R A T I O N B I T S ******************************/
#pragma config FOSC = INTIO67, FCMEN = OFF, IESO = OFF // CONFIG1H
#pragma config PWRT = OFF, BOREN = SBORDIS, BORV = 30 // CONFIG2L
#pragma config WDTEN = OFF, WDTPS = 32768 // CONFIG2H
#pragma config MCLRE = OFF, LPT1OSC = OFF, PBADEN = ON, CCP2MX = PORTC // CONFIG3H
#pragma config STVREN = ON, LVP = OFF, XINST = OFF // CONFIG4L
#pragma config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF // CONFIG5L
#pragma config CPB = OFF, CPD = OFF // CONFIG5H
#pragma config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF // CONFIG6L
#pragma config WRTB = OFF, WRTC = OFF, WRTD = OFF // CONFIG6H
#pragma config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF // CONFIG7L
#pragma config EBTRB = OFF // CONFIG7H
We can get those into the format needed by removing the #pragma's. Below is some code that hopefully should blink one of the LEDs
Code:
#CONFIG
config FOSC = INTIO67, FCMEN = OFF, IESO = OFF
config PWRT = OFF, BOREN = SBORDIS, BORV = 30
config WDTEN = OFF, WDTPS = 32768
config MCLRE = OFF, LPT1OSC = OFF, PBADEN = ON, CCP2MX = PORTC
config STVREN = ON, LVP = OFF, XINST = OFF
config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF
config CPB = OFF, CPD = OFF
config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF
config WRTB = OFF, WRTC = OFF, WRTD = OFF
config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF
config EBTRB = OFF
#ENDCONFIG
OSCCON.6 = 1 'default at reset for OSCCON is 1 mhz, we are changing it here to 16 mhz
DEFINE OSC 16
TRISD = %00000000 'set LED's to outputs
LED0 var portd.0 'set LED0 as PORTD bit 0
main:
pause 500
toggle LED0
goto main
end
Bookmarks