samuel.sam77
Member
hi dear some one help me how to increment the count while inside the menu its very urgent any one plz
the count does not increment
complier ccs c
pic16f877a
this is my code
#include<lcd.c>
#bit m=0x05.2
#bit n=0x05.3
#bit o=0x05.4
#byte trisa=0x85
int i,j;
void counttime();
void counttime()
{
if(n==0)
{
j++;
if(j>59)
j=0;
printf(lcd_putc," %02d ",j);
delau_ms(10);
}
}
void main()
{
Trisa=0x3c;
m=n=o=0;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
//setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1)
;
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
// TODO: USER CODE!!
lcd_init();
Lcd_gotoxy(1,1);
printf(lcd_putc," welcome ");
delay_ms(100);
while(1)
{
if(m==0)
{
delay_ms(100);
i++;
if(i==1)
{
Lcd_gotoxy(1,1);
printf(lcd_putc,"\f menu 1 ");
delay_ms(100);
counttime():
}
if(i==2)
{
Lcd_gotoxy(1,1);
printf(lcd_putc,"\f menu2");
delay_ms(100);
}
if(i>3)
i=0;
}
}
the count does not increment
complier ccs c
pic16f877a
this is my code
#include<lcd.c>
#bit m=0x05.2
#bit n=0x05.3
#bit o=0x05.4
#byte trisa=0x85
int i,j;
void counttime();
void counttime()
{
if(n==0)
{
j++;
if(j>59)
j=0;
printf(lcd_putc," %02d ",j);
delau_ms(10);
}
}
void main()
{
Trisa=0x3c;
m=n=o=0;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
//setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1)
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
// TODO: USER CODE!!
lcd_init();
Lcd_gotoxy(1,1);
printf(lcd_putc," welcome ");
delay_ms(100);
while(1)
{
if(m==0)
{
delay_ms(100);
i++;
if(i==1)
{
Lcd_gotoxy(1,1);
printf(lcd_putc,"\f menu 1 ");
delay_ms(100);
counttime():
}
if(i==2)
{
Lcd_gotoxy(1,1);
printf(lcd_putc,"\f menu2");
delay_ms(100);
}
if(i>3)
i=0;
}
}
Last edited: