Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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? :confused:
 
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.

Latest threads

Back
Top