Problem in progaming Pic12f675

Status
Not open for further replies.

deepa.malagi

New Member
Hi,

I am unabal to program the ic properly .In debug mode after programming when i press run it showing error message as

PK3Err0040: The target device is not ready for debugging.
Please check your configuration bit settings and program
the device before proceeding.

my configuration bits are

oscillator = internal rc on clk
master clear enable = external
rest all are off
and I am using HI-tech c compiler

and my code is

#include<pic.h>

#define OUTPUT_SIGNAL 0x00
#define INUPT_SIGNAL 0x02
#define GPIO_OUTPUT_SIGNAL (GPIO&0x01)
#define GPIO_INPUT_SIGNAL (GPIO&0x02)
#define LED GPIO4

unsigned char INTR_FLAG = 0;
void configuretion (void);
void interrupt slow_led (void);

main()
{
//configuretion();
//OPTION = 0b01000111;
TRISIO=0x00;
while(1)
{
GPIO=0x22;
}

}





void configuretion (void)
{
OPTION = 0b01000000;
ANSEL = 0; //adc off - digital in/out
CMCON = 7; //turns comparators off
GPIO = 0; //all outputs set to 0
TRISIO = 0b00000100; //all outputs except pin GPIO2
INTCON = 0b1001000; //external interrupt enabled on GP2
}

void interrupt slow_led (void)
{
if(INTF) //check external interrupt flag bit
{
INTF = 0;
LED = 1;
INTR_FLAG = 1;
while(INTR_FLAG)
if((GPIO & 0x04) != 1)
INTR_FLAG = 0;
}
}
please anybody help me.
 
problem in programing Pic12f675

thank you for reply
I am running my program in the program mode

but I am not getting proper answer by micro controller

my code is

#include<pic.h>

#define OUTPUT_SIGNAL 0x00
#define INUPT_SIGNAL 0x02
#define GPIO_OUTPUT_SIGNAL (GPIO&0x01)
#define GPIO_INPUT_SIGNAL (GPIO&0x02)
#define LED GPIO4

unsigned char INTR_FLAG = 0;
void configuretion (void);
void interrupt slow_led (void);

main()
{

ANSEL = 0; //adc off - digital in/out
CMCON = 7; //turns comparators off
TRISIO = 0x00;
TRISIO = 0x04;//GPIO.3 = input
GPIO1 = 1;
//IOC = 0x04;
//GPIE = 1;
//GIE = 1;
while(1)
{
//GPIO,GPIO0= 1;
GPIO = 0x01;
if((GPIO & 0x04) != 1)
{
GPIO = 0x03;
}
}

}
problem is I want GPIO 3 as input pin

if i comment the if statement then I am getting GPIO as 0x03.
But when i remove the comment on if I am getting GPIO as 0x0C.

why i am not getting the problem in my code.

please help me.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…