Dear Friend,
i am starting on PIC first time. here is my code for blinking LED using timer0 on Hi-tech compiler (free version)
My question:
--> LED is blinking when GPIO is not assign first time in code...
but
--> LED is not blinking when GPIO is assign first time in code...
Here is sample code when GPIO is assign first time (LED not blinking)
Code:-
#include<htc.c>
char tick_count;
int delay;
void main()
{ // int start....
CMCON=0x07;
ANSEL=0x00;
TRISIO=0x00;
OPTION=0x84;
INTCON=0xA0;
TMR0=0x00;
GPIO=0x00; //This line is problem for me...
//int end
while(1)
{
if(tick_count>=50)
{
tick_count=0;
delay++;
switch(delay)
{
case 1:
GPIO=0x00;
break;
case 2:
GPIO=0xff;
delay=0;
break;
}
}
}
}
void interrupt x(void)
{
if(TOIE && TOIF)
{
TOIF=0;
TMRO=0;
++tick_count;
}
}
Note:= above code not working for me because of I int. GPIO before while..
but if you lable it then this code working...
can you help me.. ??
any reg. i forgot then please tell me...
Regards,
Niraj