Everybody is using while(1) in the main loop but to me it looks a poor substitute for goto.
If for some reason (its a constant) 1 is no longer a true condition, the program will stop working.
Code:
void main(void)
{
InitApp();
LCD_PWR=1;
mainloop:;
if(prg_flags&PRG_TIMER_FLAG)
{
led_ctr++;
prg_flags&=(0xff-PRG_TIMER_FLAG);
}
if(led_ctr==0x60)
{
led_ctr=0;
prg_flags^=PRG_LED_FLAG;
if(!(prg_flags&PRG_INIT_FLAG))
{
lcd_init();
lcd_locate(0);lcd_str("16F884\0");
prg_flags|=PRG_INIT_FLAG;
}
}
goto mainloop;
}