Esempio n. 1
0
void print_c(int c, int pos)
{
  chgline(pos);
  send_byte(c);
}
/*
***********************************************************************
 Main
***********************************************************************
*/
void main(void) {
  DisableInterrupts;
 initializations();               
 EnableInterrupts;
 
 //shiftout(0x01);
 

    
      while(flag == 0 && counter_pass < 3)
      {       
  
    chgline(0x80);
    pmsglcd("Enter Password");
      
    if(rghtpb == 0) 
    {
      chgline(0xc0 + counter_pass);

      tempo = atd_convert() ;
  
      print_c(tempo);

     
    }
    
    if(rghtpb == 1) 
    {
     rghtpb = 0;
     temp[counter_pass] = atd_convert() - 48;
     counter_pass++;
     
    }
    if(counter_pass == 3) {
      
    for(i = 0; i < 3; i++) 
    {
        if(our_pass[i] == temp[i]) 
        {
          if(flag2 != 1) 
          {
            flag = 1; 
          } 
        }
        else 
        {
          flag2 = 1;
          flag = 0;
          counter_pass = 0;
          temp[0] = 0;
          temp[1] = 0;
          temp[2] = 0;
          chgline(0xc0);
          send_i(LCDCLR);
        }
    }
    
    
    }
  }
send_i(LCDCLR);   
pmsglcd("Success");
TIE_C7I = 1;
    
    //print_c(tempo);

  for(;;) {

/* write your code here */

    

  }  
  
    
  

    

 /* loop forever */
  
}/* do not leave main */