// LCD module connections
sbit LCD_RS at RC6_bit;
sbit LCD_EN at RC7_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISC6_bit;
sbit LCD_EN_Direction at TRISC7_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
// End LCD module connections
//variables
char Num_txt[7];
unsigned char i =0 ;
unsigned char x =0 ;
void _Init()
{
trisd.f0=0;
trisb=1;
lcd_init();
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Cmd(_LCD_CLEAR);
}
void main()
{
unsigned int s_vector[8];
_Init();
for(;;)
{
if(portb.f0==1) {
for (i=0;i<8;i++){
s_vector[i]=2*i+1 ;
LongWordToStr(s_vector[i],Num_txt);
lcd_out(2,1, Num_txt);
delay_ms(500);
if (i==9) i==0;
}
}
else {
for(x=0;x<8;x++){
LongWordToStr(s_vector[x],Num_txt);
lcd_out(3,1, Num_txt);
delay_ms(400);
}
x=0;
}
}
}