Electronics > Microcontrollers

MPLAB X/xc8 first program not running

(1/4) > >>

Emil:
I'm using MPLAB X and the xc8 compiler for the first time and has run into a a problem. It looks like my program is not running. It does not turn on/blink the LEDs.

I have verified the code after programing the chip. I wrote a program in Jal to blink the LEDs and it runs fine, so there is no problem with the hardware or the programmer.

I'm using a 12F675. I have tried the code below and also the first example from the Gooligum mid-range tutorial. (http://www.gooligum.com.au/tut_midrange_C.html)

I suspect there is some setting in MPLAB that I'm missing but I can't think of what it may be..


--- Code: ---#include <xc.h>
#pragma config FOSC = INTRCIO
#pragma config WDTE = OFF
#pragma config PWRTE = OFF
#pragma config MCLRE = OFF
#pragma config BOREN = OFF
#pragma config CP = OFF
#pragma config CPD = OFF
#define _XTAL_FREQ 4000000

void main() {
    TRISIO = 0b101011;
    GPIObits.GP2 = 1;

    while (1){
       GPIObits.GP4 = 1;
       __delay_ms(500);
       GPIObits.GP4 = 0;
       __delay_ms(200);
    }
}


--- End code ---


The generated .hex file:

--- Code: ---:0A0000008316FF2390008312F62BF5
:1007EC008301F82BFD308316850083128514FD2BB5
:0207FC000028D3
:02400E00B431CB
:00000001FF

--- End code ---

notsob:
do you have the old mplab 8 installed on the same PC, if so did you use the MPLAB Switcher to change your saettings

Emil:

--- Quote from: notsob on November 15, 2012, 10:42:40 am ---do you have the old mplab 8 installed on the same PC, if so did you use the MPLAB Switcher to change your saettings

--- End quote ---

No, I don't have MPLAB 8 or any other old version installed.

Emil:
Any suggestions for settings to check? or config files?

I selected PIC12F675 when creating the project. Can't find other settings than that.

ElektroQuark:
In what pins have you connect the leds?

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod