srikanthind
New Member
hi everyone, could someone help me out pls. I am new to pic c, am writing a small writing to check the delay and interrupts. but, it showing error for delay and interrupt is not working. i tried with for loop as well, but after for loop, the instruction is going to interrupt.
could some one tell me where have i done wrong.
the code is like below:
[MODNOTE]Please use the "#" code tag[/MODNOTE]
could some one tell me where have i done wrong.
the code is like below:
C:
#include<pic.h>
#include<htc.h>
//#include <delay.h>
int i;
void interrupt Isr(void)
{
if (GPIF)
{
if(GPIO3==0)
GPIO=0B001111111;
}
GPIF=0;
}
void main(void)
{
ANSEL = 0b00000000;
OPTION = 0b11010001;
CMCON = 0b00000000;
TRISIO= 0B00001000;
GIE = 1;
T0IE = 1;
T0IF = 0;
GPIF=0;
IOCB=GPIO3;
//GPIO=0B00000100;
Delay(50);
for(i=0; i<5000;i++)
{
}
for(i=0; i<50000;i++);
GPIO=GREEN;
while(1)
{}
}
Last edited by a moderator: