Bonjour, cliquez-ici pour vous inscrire et participer au forum.
  • Login:



+ Répondre à la discussion
Page 2 sur 2 PremièrePremière 2
Affichage des résultats 16 à 16 sur 16

Lcd 16*2 affiche un seul ligne

  1. hahamoh

    Date d'inscription
    octobre 2011
    Messages
    19

    Re : Lcd 16*2 affiche un seul ligne

    Voila le code :
    Code:
    int temp_res;
    char temp[12];
    unsigned int rtemp=10;
    char ntemp[10];
    
    sbit LCD_RS at RB2_bit;
    sbit LCD_EN at RB3_bit;
    sbit LCD_D4 at RB4_bit;
    sbit LCD_D5 at RB5_bit;
    sbit LCD_D6 at RB6_bit;
    sbit LCD_D7 at RB7_bit;
    
    sbit LCD_RS_Direction at TRISB2_bit;
    sbit LCD_EN_Direction at TRISB3_bit;
    sbit LCD_D4_Direction at TRISB4_bit;
    sbit LCD_D5_Direction at TRISB5_bit;
    sbit LCD_D6_Direction at TRISB6_bit;
    sbit LCD_D7_Direction at TRISB7_bit;
      Lcd_Cmd(_LCD_FIRST_ROW);
      void adc()
      {
      temp_res = ADC_Read(2);   // Get 10-bit results of AD conversion
      temp_res =  (temp_res *5)/10;
      IntToStr(temp_res,temp);
      }
      void print()
      {
      delay_ms(5);
      Lcd_Cmd(_LCD_CLEAR);
      delay_ms(5);
      lcd_out(1,1,"Temp Reel") ;
      delay_ms(5);
      lcd_out(2,1,"Cons temp") ;
       delay_ms(5);
      }
      void test()
      {
      if(temp_res>rtemp)
      {
      PORTC=0b00000101; //cool
      }
      if(temp_res<rtemp)
      {
     PORTC=0b00001010;//hot
      }
     if(temp_res==rtemp)
      {
     PORTC=0x00;
      }
      }
    
      void main()
      {
    
      TRISA =0b10;
      TRISD =0x11;
      TRISC =0x00;
    
      Lcd_Init();
      delay_ms(50);
      Lcd_Cmd(_LCD_CURSOR_OFF);
      delay_ms(50);
      ////////////////////////////////
      lcd_out(1,4,"Controle") ;
      delay_ms(50);
      lcd_out(2,1,"de Temperature") ;
      delay_ms(1500);
      Lcd_Cmd(_LCD_CLEAR);
      lcd_out(1,4,"Realise par") ;
      delay_ms(50);
      lcd_out(2,4,"Hadoudi") ;
      delay_ms(1500);
      Lcd_Cmd(_LCD_CLEAR);
      lcd_out(1,4,"Chouklati") ;
      delay_ms(50);
      lcd_out(2,4,"Farissi") ;
      delay_ms(1500);
      Lcd_Cmd(_LCD_CLEAR);
      lcd_out(1,4,"Encadre Par:") ;
      delay_ms(50);
      lcd_out(2,4,"Benboujemaa") ;
      delay_ms(1500);
      Lcd_Cmd(_LCD_CLEAR);
      lcd_out(1,4,"Souhane") ;
      delay_ms(50);
      lcd_out(2,4,"2011/2012") ;
      delay_ms(1500);
      print();
      do
        {
        IntToStr(rtemp,ntemp);
        lcd_out(2,10,ntemp);
        delay_ms(200);
        lcd_out(1,10,temp) ;
        delay_ms(200);
        test();
        if(portd.f1==0 && rtemp>0)
        {
             rtemp--;
    
             delay_ms(200);
         }
         if(portd.f0==0&&rtemp<=100)
         {
            rtemp++;
    
            delay_ms(200);
    
           }
            adc();
           }
        while(1);
    
         return;
        }
     


    • Publicité




Poursuivez votre recherche :




Sur le même thème :




 

Discussions similaires

  1. [Brun] TV LCD Samsung LE32S86BD 82 cm : s'arrête seul...
    Par rouki dans le forum Dépannage
    Réponses: 3
    Dernier message: 01/10/2011, 19h32
  2. [Brun] TV LCD LG model:37LF66-ZE : affiche signal faible !
    Par jeannot95 dans le forum Dépannage
    Réponses: 7
    Dernier message: 15/01/2011, 21h13
  3. [Brun] TV Funay LCD-C2007 : affiche une partie d'image !
    Par arcosetis dans le forum Dépannage
    Réponses: 3
    Dernier message: 01/02/2010, 09h49
  4. Réponses: 2
    Dernier message: 22/10/2009, 07h40
  5. écran LCD s'éteint tout seul
    Par leoland dans le forum Matériel - Hardware
    Réponses: 15
    Dernier message: 12/01/2007, 01h17


Les tags pour cette discussion