anuphr
Newbie level 6
im using 12f675 ..with internal clock.. i am just tring to blink the led
.. but im not getting the result..plzz help me if u have a DEMO code in c.i amusing hi tech c compiler,, source code is in c...
this is the code i have used ..but not giving the result....
#include <htc.h>
#define _XTAL_FREQ 4000000 // oscillator frequ
ency for _delay()
// Config: ext reset, no code protect, no brownout detect, no watchdog,
// power-up timer enabled, 4MHz int clock
__CONFIG(MCLREN & UNPROTECT & BORDIS & WDTDIS & PWRTEN & INTIO);
void delay_ms(long );
void main()
{
TRISIO = 0b001010; // configure GP1 (only) as an output
// Main loop
while(1)
{
// turn on LED on GP1
GPIO1 = 1;
delay_ms(1000);
delay_ms(1000);
// turn off LED on GP1
GPIO1 = 0;
delay_ms(1000);
}
} // repeat forever
}
void delay_ms(long ms)
{
long i;
while (ms--)
for (i=0; i < 330; i++)
;
}
.. but im not getting the result..plzz help me if u have a DEMO code in c.i amusing hi tech c compiler,, source code is in c...
this is the code i have used ..but not giving the result....
#include <htc.h>
#define _XTAL_FREQ 4000000 // oscillator frequ
ency for _delay()
// Config: ext reset, no code protect, no brownout detect, no watchdog,
// power-up timer enabled, 4MHz int clock
__CONFIG(MCLREN & UNPROTECT & BORDIS & WDTDIS & PWRTEN & INTIO);
void delay_ms(long );
void main()
{
TRISIO = 0b001010; // configure GP1 (only) as an output
// Main loop
while(1)
{
// turn on LED on GP1
GPIO1 = 1;
delay_ms(1000);
delay_ms(1000);
// turn off LED on GP1
GPIO1 = 0;
delay_ms(1000);
}
} // repeat forever
}
void delay_ms(long ms)
{
long i;
while (ms--)
for (i=0; i < 330; i++)
;
}