PIC12F629 Problem URGENT

Status
Not open for further replies.

amayilsamy

Advanced Member level 1
Joined
Feb 5, 2013
Messages
420
Helped
38
Reputation
76
Reaction score
34
Trophy points
1,308
Location
Chennai,India
Visit site
Activity points
3,370
I'm using PIC12f629 for my small function..

I give a power to uC but it is not power on reset..

how to solve this...
 

I post my code here. how to enable power on reset? And we give a power what happen in uC..

I don't have external Osc.


Code:
#include <htc.h>
#define _XTAL_FREQ 4000000
#define led1on GPIO0=1;
#define led1off GPIO0=0;

__CONFIG(FOSC_INTRCIO & WDTE_OFF & CP_OFF & MCLRE_OFF);


void main()
    {
         TRISIO = 0b111111;
         GPIO2=0;
         while(1)
         {
             if(GPIO2==1)
             {

                 GPIO0=1;
                 GPIO1=1;
             
                 GPIO3=1;
                 GPIO4=0;
                 GPIO5=0;
             }
        

         /////////for(int i=0;i<=99990;i++);
        ///////// GPIO0=1;

         ////////for(int i=0;i<=99990;i++);
        }

    }
 
Last edited:


Thanks for Correct my mistake. And I have one more doubt

I simulate the code in Proteus post output and code.

But it s not working in real time implement.

Code:
#include <htc.h>
#define _XTAL_FREQ 4000000
#define led1on GPIO0=1;
/////#define led1off GPIO0=0;

__CONFIG(FOSC_INTRCIO & WDTE_OFF & CP_OFF & MCLRE_OFF);


void main()
    {
         TRISIO = 0b000000;
         GPIO2=0;
         while(1)
         {
             
             {

                 GPIO0=1;
                 GPIO1=0;
             
             
                 GPIO4=0;
                 GPIO5=0;
             }
        

         /////////for(int i=0;i<=99990;i++);
        ///////// GPIO0=1;

         ////////for(int i=0;i<=99990;i++);
        }

    }
 

Now GPIO0 is always high but it is not working in real time implement..
How to I solve this..

I also used 3 uC's.
 

Post your real hardware circuit.

Try this code

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <htc.h>
#define _XTAL_FREQ 4000000
#define led GPIO0;
 
__CONFIG(FOSC_INTRCIO & WDTE_OFF & CP_OFF & MCLRE_OFF);
 
 
void main()
{
         TRISIO = 0b000000;
         GPIO=0b00000;
 
         while(1)
         {
             GPIO=0b00001;
          
         }
 
}

 

Try this code


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <htc.h>
#define _XTAL_FREQ 4000000
#define led GPIO0;
 
__CONFIG(FOSC_INTRCIO & WDTE_OFF & CP_OFF & MCLRE_OFF);
 
 
void main()
{
         TRISIO = 0b000000;
         ANSEL = 0x00;
         GPIO=0b00000;
 
         while(1)
         {
             GPIO=0b00001;
          
         }
 
}



Why have you connected 10k resistor to GPIO0? There is no current limiting resistor for LED. Maybe you LED is dead already.
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…