Hello,
just a simple program that wud'nt work!!!
I would appreciate if someone would help me debug.
Thanks,
Rohit
My Code:
#include <htc.h>
#define _XTAL_FREQ 4000000 // oscillator frequency for _delay()
/***** CONFIGURATION *****/
// ext reset, no code or data protect, no brownout detect,
// no watchdog, power-up timer enabled, 4MHz int clock
__CONFIG(MCLRDIS & UNPROTECT & BORDIS & WDTDIS & PWRTEN & INTIO);
/***** MAIN PROGRAM *****/
void main()
{
TRISA = 0b00000010; // RA1 = Switch Input - Switch is pulled high externally to 5V
ANSEL = 0b00000000; // RA1 = Digital Input
TRISC = 0b00000000; // RC1 = Output
PORTC = 0b00000000; // Initially led off
for(;
{
if (RA1==1) //
PORTC = 0b00000010; // led on - RC1
}
}
Bookmarks