#include "suryaa.h"
void setup()
{
  pin_configure();
  init_lcd();
}

/*void loop()  //display welcome in line 1 and suryaa in line 2
{
  
  out_data(0x00);
  lcd_control_write();
  write_string("welcome");
  lcd_control_write();
  out_data(0xc9);
  lcd_control_write();
  write_string("suryaa");
  lcd_control_write();
  delay1(1000);
 out_data(0x01);
 lcd_control_write();
 delay1(100);

}
*/

void loop() {           // 100 count display.
  volatile long i,j,k,l;
   out_data(0x80);
  lcd_control_write();
  write_string("just_100_count");
  lcd_control_write();
  for(j=0;j<2;j++)
  {
     out_data(0x1c);
  lcd_control_write();
  delay1(100);
  }
  for(k=0;k<2;k++)
  {
     out_data(0x18);
  lcd_control_write();
  delay1(100);
  }
 for (i =0; i <= 100; i++) {
    char str[8]; // Buffer to hold the converted string
    itoa(i, str, 10); // Convert integer to string
    if(i%2==1)
    {
     out_data(0xC0); // Set cursor to the beginning of the second line
     lcd_control_write();
     write_string(str); // Print the converted string
     lcd_control_write();
     delay1(500);
    }

    else
    {
      out_data(0xC8); // Set cursor to the beginning of the second line
     lcd_control_write();
     write_string(str); // Print the converted string
     lcd_control_write();
     delay1(500);
    }
   
  }
  delay1(100);
  out_data(0x01);
  lcd_control_write();
   delay1(100);
}




/*void loop() 
{
  volatile long i,j;
  out_data(0x8f);
   lcd_control_write();
  write_string("welcome"); 
  lcd_control_write();
  for(i=0;i<15;i++)
  {                           //this code is working correctly sir.
   out_data(0x18);
   lcd_control_write();
   delay1(20);
  }
 // delay1(10);
 // out_data(0x01);
 // lcd_control_write();
  //delay1(1000);

  
  out_data(0xc0);
  lcd_control_write();
  write_string("suryaa");
  delay1(10);
  lcd_control_write();          //this code is not working correctly sir.
  for(j=0;j<10;j++)
  {                      
    out_data(0x1C);
    lcd_control_write();
    delay1(20);
  }       

  delay1(10);
  out_data(0x01);
  lcd_control_write();
  delay1(10);
  
}*/

















/*void loop()  //to scroll the text right to left line1 and left justified;
{
  volatile long i;
  out_data(0x8f);
   lcd_control_write();
  write_string("welcome"); 
  lcd_control_write();
  for(i=0;i<15;i++)
  {                           //this code is working correctly sir.
   out_data(0x18);
   lcd_control_write();
   delay1(100);
  }
  delay1(1000);
  out_data(0x01);
  lcd_control_write();
  delay1(1000);
}*/

/*void loop()  //to scroll the text left to right line1 and right justified;
{
  volatile long i;
  out_data(0x80);
  lcd_control_write();
  write_string("welcome");
  delay1(100);
  lcd_control_write();          //this code is not working correctly sir.
  for(i=0;i<9;i++)
  {                      
    out_data(0x1C);
    lcd_control_write();
    delay1(100);
  }                         
  delay1(1000);
  out_data(0x01);
  lcd_control_write();
  delay1(1000);
  
}*/









/*void loop()   //scroll the text welcome right to left continuously
{
  out_data(0x8f);
   lcd_control_write();
  write_string("WELCOME..!"); 
  lcd_control_write();
  out_data(0x18);
   lcd_control_write();
   delay1(10);

}*/







/*void loop()    //to scroll the text welcome in line1 and suryaa in line 2 continuosly.
{
  volatile long i,j,x=2;
 out_data(0x80);
   lcd_control_write();
  write_string("welcome"); 
  lcd_control_write();

   out_data(0xc0);
   lcd_control_write();
  write_string("suryaa"); 
  lcd_control_write();

  while(x)
  {
    for(j=0;j<8;j++)
    {
    out_data(0x1c);
    lcd_control_write();
    delay1(80);
  }
  
    for(j=0;j<8;j++)
    {
    out_data(0x18);
    lcd_control_write();
    delay1(80);
    }
    x--;
  }
}*/


/*void loop() //display welcome suryaa by exchangine rows
{
 out_data(0x80);
   lcd_control_write();
  write_string("welcome"); 
  lcd_control_write();
  delay1(500);
  out_data(0xCA);
  lcd_control_write();
  write_string("suryaa");
   lcd_control_write();
   delay1(500);
   
 out_data(0x01);
 lcd_control_write();
 delay1(500);

out_data(0xC0);
  lcd_control_write();
  write_string("welcome");
   lcd_control_write();
   delay1(500);

 out_data(0x8A);
   lcd_control_write();
  write_string("suryaa"); 
  lcd_control_write();
  delay1(500);

  
   
 out_data(0x01);
 lcd_control_write();
 delay1(500);
   
}*/


/*void loop()//display welcome suryaa and again display it.
{
 out_data(0x80);
   lcd_control_write();
  write_string("welcome"); 
  lcd_control_write();

  out_data(0xCA);
  lcd_control_write();
  write_string("suryaa");
   lcd_control_write();
   delay1(1000);
   
 out_data(0x01);
 lcd_control_write();
 delay1(500);
   
}*/










/*void setup()
{
  pin_configure();
  init_lcd();
  //out_data(0x80);//configure display to first row and start from 3rd column
 // lcd_control_write();
  write_string("welcome");
  lcd_control_write();
  
  out_data(0xc0);//configure display to second row and start from 3rd column
  lcd_control_write();//enable to set the configuration
   write_string("suryaa");
   lcd_control_write();
}*/

      




/*void loop() //display welcome in first line and jeya suryaaks in seconf line a scroll.
{
  init_lcd();
  out_data(0x82);//configure display to first row and start from 3rd column
  write_string("welcome..!");
  lcd_control_write();

   
  
  out_data(0xc9);//configure display to second row and start from 3rd column
  lcd_control_write();//enable to set the configuration
   write_string("JEYASURYAA_KS.");

 while(1)
  {
  out_data(0x18);
  lcd_control_write();
  delay1(100);
} 
}*/



/*void loop()
{
  volatile char i=0;
  /*out_data(0x80);
  lcd_control_write();
  write_string("hello world");
*/
  /*for(i=0;i<9;i++)
  {
     out_data(0xc0);
    lcd_control_write();
    write_string(i);
     lcd_control_write();
     delay1(100);
  }
  
*/



/*void setup()
{
  pin_configure();
  init_lcd();

  out_data(0x80);
  lcd_control_write();
  write_string("welcome..!");
  lcd_control_write();

  out_data(0xc0);
  lcd_control_write();
  write_string("suryaa");
  lcd_control_write();
}

void loop() 
{          
  
  while(1)
  {
     out_data(0xc0);
  lcd_control_write();
  out_data(0x1c);
   lcd_control_write();
  write_string("suryaa");
  lcd_control_write();
}
}*/

/*void setup() {
  pin_configure();
  init_lcd();

  out_data(0x80);
  lcd_control_write();
  write_string("welcome..!");
  lcd_control_write();

  out_data(0xc0);
  lcd_control_write();
  write_string("suryaa..!!");
  lcd_control_write();
}


void loop() {
  // This loop is for scrolling the content of the second line
  while (1) {
    out_data(0x80);
    lcd_control_write();
    delay1(10);
    out_data(0xc0); // Set cursor to the top-left position of the second line
    lcd_control_write();
    out_data(0x1c); // Shift the display to the left by one position
    lcd_control_write();
    delay1(100);
  }
}*/


/*void setup() {
  pin_configure();
  init_lcd();

  out_data(0x80);  //set cursor to line 1 .
  lcd_control_write();
  write_string("welcome..!");
  lcd_control_write();

  out_data(0xc0);//se t cursor to line 2
  lcd_control_write();
  write_string("to ecen academy");
  lcd_control_write();
}

void loop() 
{
  out_data(0x80);//selecting only line1 to scroll.
  lcd_control_write();
  out_data(0x1c);
    lcd_control_write();
    delay1(100);
}*/


//two problems to finf in lcd

//1.display text from left to right ,not starting from first,instead show entire display and shift
//2.how to control 1 line at a time even though 2 display.
mega:SCL
mega:SDA
mega:AREF
mega:GND.1
mega:13
mega:12
mega:11
mega:10
mega:9
mega:8
mega:7
mega:6
mega:5
mega:4
mega:3
mega:2
mega:1
mega:0
mega:14
mega:15
mega:16
mega:17
mega:18
mega:19
mega:20
mega:21
mega:5V.1
mega:5V.2
mega:22
mega:23
mega:24
mega:25
mega:26
mega:27
mega:28
mega:29
mega:30
mega:31
mega:32
mega:33
mega:34
mega:35
mega:36
mega:37
mega:38
mega:39
mega:40
mega:41
mega:42
mega:43
mega:44
mega:45
mega:46
mega:47
mega:48
mega:49
mega:50
mega:51
mega:52
mega:53
mega:GND.4
mega:GND.5
mega:IOREF
mega:RESET
mega:3.3V
mega:5V
mega:GND.2
mega:GND.3
mega:VIN
mega:A0
mega:A1
mega:A2
mega:A3
mega:A4
mega:A5
mega:A6
mega:A7
mega:A8
mega:A9
mega:A10
mega:A11
mega:A12
mega:A13
mega:A14
mega:A15
lcd1:VSS
lcd1:VDD
lcd1:V0
lcd1:RS
lcd1:RW
lcd1:E
lcd1:D0
lcd1:D1
lcd1:D2
lcd1:D3
lcd1:D4
lcd1:D5
lcd1:D6
lcd1:D7
lcd1:A
lcd1:K