AnsweredAssumed Answered

Need help on programming a LCD to display a counter

Question asked by Guest on Mar 3, 2009
Latest reply on Mar 3, 2009 by Guest

Hi. Below is a code to display a string on a LCD. Please take note of the portion highlighted in red, as that is the part to display a string. I would like to know how to display a counter. For example, after a process has taken place, the LCD will countup from 0 to 1, and then from 1 to 2 for subsequent processes, and so on. An example on displaying a string is shown below the code. Thx

 

void lcd_string(byte line,byte *buffer)
  {
     byte i;
     __RESET_WATCHDOG();
      if(line==1)
      {
        lcd_write_cmd(0x40);
        Check_LCD_Busy();
        lcd_write_cmd(0x80);
        Check_LCD_Busy();
      }
      else
      {
        lcd_write_cmd(60);
        Check_LCD_Busy();
 
        lcd_write_cmd(0xc0);
        Check_LCD_Busy();
      }       
     for(i=0;i<16;i++)
     {
      if(buffer[i]!=0)
      {
        lcd_write_data(buffer[i]);
        Check_LCD_Busy();
      } else break;
  
     }   
  }

 

lcd_string(1, "Welcome to" );
lcd_string(2, "Dispenser System" );

Message Edited by Cryptical on 2009-03-03 01:42 AM

Outcomes