hello,
i am trying to compile a c code in mikroc and i am getting this error
C:/Users/pc/Documents/please.c:2: error: Can't open include file "htc.h"
my code is
please help
thanks
sankari
i am trying to compile a c code in mikroc and i am getting this error
C:/Users/pc/Documents/please.c:2: error: Can't open include file "htc.h"
my code is
Rich (BB code):
#define _XTAL_FREQ 0x3D0900
#include <htc.h>
__CONFIG(XT & WDTDIS & PWRTDIS & UNPROTECT);
unsigned int tmr_ticked = 0;
bit volatile switch_debounced;
void interrupt my_int(void)
{
if(T0IE && T0IF)
{
//debouncing routine
tmr_ticked++;
if(tmr_ticked>4000)
{
PORTB = 0b00000000;
tmr_ticked=0;
switch_debounced=1;
RBIF=0; // ensuring this change is not picked up as an interrupt
}
T0IF=0;
}
if (RBIE && RBIF)
{
// Here interrupt from motion detector is treated as the switch
if( switch_debounced == 1)
{
//figuring out which switch is pressed and turning the right LED on
if(PORTB & 0b00010000)
{
PORTB=0b00001111;
switch_debounced=0;
tmr_ticked=0;
}
}
RBIF=0;
}
return;
// process other interrupt sources here
}
void init(void)
{
switch_debounced=1;
T0CS =0;
RBIE=1; //enable portb interrupts
PSA = 0;//Set prescaler to 1:256
PS0 = 0;
PS1 = 0;
PS2 = 0;
T0IE = 1; //Enable timer 1 interrupts
ei(); // initialising interrupts
// port directions: 1=input, 0=output
TRISB = 0b11110000;
PORTB=0b00001111;
switch_debounced=1;
}
void main(void)
{
init();
while (1)
{
}
}
please help
thanks
sankari
Last edited by a moderator: