[SOLVED] PIC12F629 Delay help [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
Activity points
3,370
Here I posted my code

Code:
#include <xc.h>
#define _XTAL_FREQ 4000000 // oscillator frequency for _delay()
//***** CONFIGURATION *****/
// ext reset, no code protect, no brownout detect, no watchdog,
// power-up timer enabled, int RC clock

/***** MAIN PROGRAM *****/
void main()
{
//*** Initialisation
// configure port
TRISIO = 0b111101; // configure GP1 (only) as an output
//*** Main loop
for (;;)
{
GPIO = 0b000010; // turn on LED on GP1 (bit 1)
__delay_ms(200); // stay on for 200 ms
GPIO = 0; // turn off LED (clearing GPIO clears GP1)
__delay_ms(800); // stay off for 800 ms
} // repeat forever
}

Here _delay_ms(200); & __delay_ms(800);

Shows error "unable to resolve the identifier"

And "__CONFIG(MCLRE_ON & CP_OFF & CPD_OFF & BOREN_OFF & WDTE_OFF & PWRTE_OFF & FOSC_INTRCIO);"

shows"unexpected token"

How to solve this.

I'm using XC8 compiler.
 

"_CONFIG()"; and " __delay_ms();" supported by htc compiler ...download the hi tech C compiler to enable these function..


or u can make delay function by yourself.
 

Add


Code C - [expand]
1
#include <delays.h>


Again I'm facing same problem. And "#include <delays.h>" shows Cannot find include file <delays.h>

- - - Updated - - -

"_CONFIG()"; and " __delay_ms();" supported by htc compiler ...download the hi tech C compiler to enable these function..


or u can make delay function by yourself.

I already use in Hi Tech C compiler. The same error occurring.
 

by running in hitech compiler you shd include <htc.h> and also for trial version of htc it will support upto 33ms for more you have activate it.....
 

Here I attached my file using Hi Tech C Compiler. I same problem in this compiler
 

Attachments

  • osctest.c.X.zip
    48 KB · Views: 35

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…