L littletransistor New Member Dec 5, 2008 #1 Hey there, I'm using the MPLAB IDE C18, but there's a very strange problem with my test program: Code: #pragma config OSC=INTIO2, WDT=OFF, LVP=OFF, DEBUG=ON #include <p18f1320.h> void main(void) { TRISB = 0; PORTBbits.RB0 = 1; while(1); } The thing is, the LED in the PORTB didn't light up or whatever it is. Then I checked using PIC Kit 2 programmer software, and it says something like th e "Configuration Bits not present". I thought I included that in the code already?
Hey there, I'm using the MPLAB IDE C18, but there's a very strange problem with my test program: Code: #pragma config OSC=INTIO2, WDT=OFF, LVP=OFF, DEBUG=ON #include <p18f1320.h> void main(void) { TRISB = 0; PORTBbits.RB0 = 1; while(1); } The thing is, the LED in the PORTB didn't light up or whatever it is. Then I checked using PIC Kit 2 programmer software, and it says something like th e "Configuration Bits not present". I thought I included that in the code already?
AtomSoft Well-Known Member Dec 5, 2008 #2 Try adding this before TRISB = 0; ADCON1 = 0x0F; and LATB not PORTB since PORTB is used to read really. Its best to use LATB when setting pins. Code: #pragma config OSC=INTIO2, WDT=OFF, LVP=OFF, DEBUG=ON #include <p18f1320.h> void main(void) { ADCON1 = 0x0F; TRISB = 0; LATBbits.LATB0 = 1; while(1); } Last edited: Dec 5, 2008
Try adding this before TRISB = 0; ADCON1 = 0x0F; and LATB not PORTB since PORTB is used to read really. Its best to use LATB when setting pins. Code: #pragma config OSC=INTIO2, WDT=OFF, LVP=OFF, DEBUG=ON #include <p18f1320.h> void main(void) { ADCON1 = 0x0F; TRISB = 0; LATBbits.LATB0 = 1; while(1); }