void main(void) {
	clock_int_4MHz();
	habilita_canal_AD(AN0);
	
	lcd_ini();
	//Lcd_Cmd(LCD_CLEAR);
	Lcd_Cmd(LCD_CURSOR_OFF);
	tempo_ms(100);

        CGRAM_SanUSB(1,sino);//CGRAM_build(monta posicao do caractere especial,vetor do desenho);
        tempo_ms(300);
        Lcd_Chr(1, 2, 1); //Lcd_Chr(linha, coluna, posicao do caractere especial);
        
	tempo_ms(500);

        lcd_escreve(1, 3, "Microcontrol");
	tempo_ms(500);
	
	lcd_escreve(2, 1, "Converte");
	tempo_ms(500);
	
    while(1)
    {
		i= le_AD10bits(0);
                inverte_saida(pin_b7);inverte_saida(pin_d7);
		sprintf(buffer1,"%d  ",i);
		lcd_escreve2(2, 12, buffer1); //com buffer
		tempo_ms(300);

                //printf("a ");
       	}
}
Beispiel #2
0
void Draw_BG(unsigned char f, unsigned char r){
   unsigned char i;
   
   for (i = 1; i <= 16; i++)  {
      if (f >= i){
         if (r >= i) {
           Lcd_Chr(1, i, meterBoth);
         }
         else {
            Lcd_Chr(1, i, meterTop);
         }
      }
      else {
         Lcd_Chr(1, i, 32);
      }
   }
}
Beispiel #3
0
unsigned short obtenerNumero (unsigned short numeroMax) {
  unsigned short dig,numero,kp;
  volverObtenerNumero:
  dig = 0;
  numero=0;
  Lcd_chr(2, 5, ' '); Lcd_chr(2, 4, ' '); Lcd_chr(2, 3, ' '); Lcd_chr(2, 2, ' '); Lcd_chr(2, 1, ' ');
  
  leerNumero:
  do {
    kp = Keypad_Key_Click();             // Store key code in kp variable
    if (UART1_Data_Ready()){
      kp = UART1_Read();
      goto    bluetooth4;
    }
  }while (!kp);
  kp = teclado(kp);
  
  bluetooth4:
  if(kp == 'A' || kp== 'B' || kp == 'C' ||kp == 'D'){
    goto leerNumero;
  }else if (kp>=48 && kp<=57) {
    dig++;
    Lcd_chr_Cp(kp);
    numero = (kp-48)+(10*numero);
  }
  
  if(kp == '#'){
    goto volverObtenerNumero;
  }else if (kp == '*' ){
    Lcd_Chr (2,6,'G'); Lcd_Chr (2,7,'u'); Lcd_Chr (2,8,'a'); Lcd_Chr (2,9,'r');Lcd_Chr (2,10,'d');Lcd_Chr (2,11,'a'); Lcd_Chr (2,12,'d'); Lcd_Chr (2,13,'o');
    delay();
  }else if (numero >= numeroMax){
    //Lcd_Cmd(_LCD_CLEAR);
    Lcd_chr(2, 1,'M'); Lcd_chr(2, 2,'a'); Lcd_chr(2, 3,'x'); Lcd_chr(2, 5,'t');
    delay();
    delay();
    goto volverObtenerNumero;
  }else{
      goto leerNumero;
   }

   return (numero);
}
void main(void) {
	clock_int_48MHz();
	habilita_canal_AD(AN0);
	
	lcd_ini();
	//Lcd_Cmd(LCD_CLEAR);
	Lcd_Cmd(LCD_CURSOR_OFF);
	tempo_ms(100);

        CGRAM_SanUSB(1,abre1);//CGRAM_build(monta posicao do caractere especial,vetor do desenho);
        tempo_ms(100);
        CGRAM_SanUSB(2,fecha1);
        tempo_ms(100);
        CGRAM_SanUSB(3,abre2);
        tempo_ms(100);
        CGRAM_SanUSB(4,fecha2);
        tempo_ms(100);
        CGRAM_SanUSB(5,vazio);
        tempo_ms(100);
        CGRAM_SanUSB(6,b1);
        tempo_ms(100);

 while(1){
    lcd_escreve(1,1,"SanUSB pisca o");
    tempo_ms(500);
    lcd_escreve(2,1,"Led pra voce ");
    tempo_ms(500);

    Lcd_Chr(2, 14, 6); //Lcd_Chr(linha, coluna, posicao do caractere especial);
    tempo_ms(500);
    
    for (kl = 1; kl < 16; kl++) {
    Lcd_Chr(1, kl, 2);
    tempo_ms(300);
    Lcd_Chr(1, kl, 1);
    tempo_ms(300);
    Lcd_Chr(1, kl, 5);
    tempo_ms(100);
    inverte_saida(pin_b7);
    inverte_saida(pin_d7);
          }
    //*
    kl=16;
    for (kl = 16; kl > 0; kl--) {
    Lcd_Chr(2, kl, 4);
    tempo_ms(300);
    Lcd_Chr(2, kl, 3);
    tempo_ms(300);
    Lcd_Chr(2, kl, 5);
    tempo_ms(100);
    inverte_saida(pin_b7);
    inverte_saida(pin_d7);
                            }//*/
 }
}
void main() {
     /*
       Lcd_Init() to initialize the library
     */
     Lcd_Init();
     
     /*
       In order to print a string on a specific
       row, colum, use the following function.
       
       first number is the line number.
       second number is the column number.
     */
     Lcd_Out(1, 1, "Jontropati.com");
     
     Delay_ms(1000);      // delay- 1 sec
     
     
     /*
       THis function append some new string from
       previous string position
     */
     Lcd_Out_CP(" !!!");

     Delay_ms(1000);    // delay 1 sec
     
     /*
       Clear the LCD display
     */
     Lcd_Cmd(_LCD_CLEAR);
     

     /*
       Below funciton, prints a charecter
       on specific line, column
     */
     Lcd_Chr(1, 1, 'A');
     
     Delay_ms(1000);
     
     /*
       This function appends a new charecter
       from previous position.
     */
     Lcd_Chr_CP('B');

     while (1) {

     }
}
Beispiel #6
0
unsigned short qtama () {
  unsigned short kp;
  qtama:
  
    do {
      kp = Keypad_Key_Click();
      if (UART1_Data_Ready()){
         kp = UART1_Read();
         goto    bluetooth1;
         }
    }while (!kp);
    kp = teclado(kp);
   
    bluetooth1:
    if(kp == 'A' ||kp== 'B' ||kp== 'C'||kp== 'D'){
      Lcd_chr(2, 4, kp);
      do {
        kp = Keypad_Key_Click();             // Store key code in kp variable
        if (UART1_Data_Ready()){
          kp = UART1_Read();
          goto    bluetooth2;
        }
      }while (!kp);
      kp = teclado(kp);
      
      bluetooth2:
      if(kp == '#'){
        goto qtama;
      }
      if(kp == '*'){
        Lcd_Chr (2,6,'G'); Lcd_Chr (2,7,'u'); Lcd_Chr (2,8,'a'); Lcd_Chr (2,9,'r');Lcd_Chr (2,10,'d');Lcd_Chr (2,11,'a'); Lcd_Chr (2,12,'d'); Lcd_Chr (2,13,'o');
      }
   }else {
     goto qtama;
   }
   return (kp);
 }
void CustomChar(char pos_row, char pos_char) {
  char i;
    Lcd_Cmd(64);
    for (i = 0; i<=7; i++) Lcd_Chr_CP(character[i]);
    Lcd_Cmd(_LCD_RETURN_HOME);
    Lcd_Chr(pos_row, pos_char, 0);}