MPLAB IDE C18 problem

Status
Not open for further replies.
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?
 
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:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…