+ Reply to Thread
Results 1 to 2 of 2

Thread: MPLAB IDE C18 problem

  1. #1
    littletransistor Newbie
    Join Date
    Aug 2006
    Location
    Kuala Lumpur, Malaysia
    Posts
    223

    Default MPLAB IDE C18 problem

    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?


  2. #2
    AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent AtomSoft Excellent
    Join Date
    Feb 2008
    Location
    Brooklyn, NY US
    Posts
    3,738

    Default

    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 by AtomSoft; 5th December 2008 at 06:05 PM.
    AtomSofts eBay Store
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My BLOG | My YouTube Videos!
    My Favorite Store:
    dipmicro Electronics
    Trading and Selling...? Check out Dipmicro Trading/Selling Forum:
    Electronic Components & Tools Exchange

+ Reply to Thread

Similar Threads

  1. mplab problem
    By crys in forum Micro Controllers
    Replies: 6
    Latest: 16th January 2008, 02:41 PM
  2. Problem with MPLAB 8.00
    By PaulF in forum Micro Controllers
    Replies: 5
    Latest: 9th December 2007, 07:02 PM
  3. Mplab ICD2 problem
    By imhereithink in forum Micro Controllers
    Replies: 2
    Latest: 31st July 2007, 11:25 AM
  4. MPLAB problem
    By MrJammin in forum Micro Controllers
    Replies: 0
    Latest: 24th July 2007, 04:22 PM
  5. problem with MPLAB
    By 4electros in forum Micro Controllers
    Replies: 18
    Latest: 21st September 2005, 10:27 AM

Tags for this Thread