Jam Meja dengan Suhu, Kelembaban & Ukur Tingkat Cahaya

 // Bismillahirrahmanirrahim 
 #include  
 #include  
 #include  
 #include  <2465x.c>
 #include  
 #include  
 #include  
 #include  
 #include  
 termasuk  

 # INT_EXT0 
 batal    ext0_isr  ( batal )  
 {

} 

 #INT_RDA [19659020r] 19659013 ( batal )  
 {

} 

 # INT_RDA2 
 batal    rda2_isr  ( void )   =  0 ; 
    counterTemp  =  0 ; 
    izinToAttend  =  0 ;  // men-debug porttan veri varis ke mana-mana untuk melihat lebih lanjut tentang [Olimpir
    hiX  ( buzzer ); 
    lakukan  {
    
              ( CommDbg )) 
             {
                   counterData  =  fgetc [19659014] ( CommDbg ); 
                   jika  ( counterData   <  maxRda2Data )    // gelen veriler fazla z 250 250 
                   {
               
                      rda2Data  [ counterData ]  =  counterData ; 
                      counterData  ++ ; ; 19659014] [ counterData ]  =  ' 0' ; 
                     
                      // gsm_rda_data [counterData] = ' 0'; 
                      counterTemp  = [19659036] 0 ; 
                  } 
            } 
             counterTemp  ++ ; 
            
      }  sedangkan  ( counterTemp  < ] 2500 ); 
             // gsm_rda_data [counterData] = 0; 
            
            
            // fprintf (CommDbg, "Data:% s  r  n" rda2Data); 
       rda2IntActivity  = 19659036] 1 ; 
       loX  ( buzzer ); 
     
      
} 



} void   main  () 
 {
 {[19659122setup] ts  ( NO_ANALOGS   VSS_VDD ); 


    init_ext_eeprom  (); 
    bekle  ([196590]] 19659135] ds1307_init  ();   // saat init 
    bekle  ( tKisa ); 
    // enable_interrupts (INT_EXT0); // 1965914] INT_RDA); 
    enable_interrupts  ( INT_RDA2 ); 

   
    enable_interrupts  ( INTR_GLOBAL ); [19659152//PinuserLed
    output_drive  ( userLed ); 
    // buzzer 
    output_drive  ( buzzer ); [19659163////output_float ( buton1 ); 
    output_float  ( buton2 ); 
    output_float  ([1965901990] ] output_float  ( buton4 ); 
    output_float  ( buton 5 ); 
   
    // HMTRP RF pin konfigurasyon 
    output_drive  ( rfEnable ); 
    output_drive  ( rfConf [196590]] 19659193] // lcd ayarlama rutini 
    lcd_ayarla  (); 
    setBacklight  ( nonaktifkan ); 
   
    // HMTPRP rf modül ayarla [19659201hm] ( nonaktifkan ); 
    bekle  ( tSn ); 
    hmtrp  ( aktifkan );  bekle  ] ( tSn ); 
    bekle  ( tKisa ); 
   
   
   
    // Başlıyoruz 
    backlightVal  lH; 19659090] lH; 
    setBacklight  ( backlightVal ); 
    / * // Uji Backlight LCD rutini 
    untuk (genCounter = 0; genCounter <120; genCounter ++) 
    {
       backlightVal = genCounter * 500; 
       setBacklight (backlightVal); 
       alamat (1,1); 
       printf (lcd_yaz, "LCD Backlight Dimm:% lu" backlightVal) ; 
       bekle (tSn); 
   } 
    * / 
   
    fprintf  ( CommDbg  "FiDeNet   r  n " ); 
    fprintf  ( CommRf  "FiDeNet   r  n "  "
   
    genCounter )  0 ; 
   
    lcd_sil  (); 
    alamat  ( 1  1 ); 
    printf  ( lcd_yaz  "PCB Ref:% s"  deviceData  [ cHWID ].  hwStr ); 
    19659014] ( 1  2 ); 
    printf  ( lcd_yaz  "Sw Ver:% s"  deviceData  [ cSWVersion ].  hwStr [19659014]); 
    alamat  ( 1  3 ); 
    printf  ( lcd_yaz  "Hw Rev:% s " deviceData  [ cHWRev ].  hwStr ); 
    alamat  4 ); 
    printf  ( lcd_yaz  "Oleh:% s"  deviceData  [ mfc ].  ] hwStr ); 
   
    bekle  ( tSn ); 
    lcd_sil  (); 
    alamat  ( 1, 19659014]  1 ); 
    printf  ( lcd_yaz  "FiDeNet" );  
    alamat  ( 1 ] 3 ); 
    printf  ( lcd_yaz  "Jam Digital" ); 
   
    bip  (] 2  2 ); 
   
    bekle  ( tSn ); 
    lcd_sil  (); 
    // // saat ayarlama kısmı 
    / * 
    ds1307_set_time (10,48,30); // Saat ayarla 
    bekle (tKisa); 
    ds1307_set_date (10,9,18,2); // Tarih ayarla dow değeri önemli olmasa da ayrla belki ilerde kullanılır. 
    bekle (tKisa); 
   
    * / 
  
   
    / * // eeprom test rutini 
     fprintf (CommDb% Test  r  n "strGen1); 
    eepromWrTest (); 
    bekle (tMini); 
    eepromRdTest (); 
    * / 
     
    // read_dev_id (); [19659Remarang)] =  0 ;  jika  ( readDevId  ()  ==  1 ) 
    {
       fprintf [1965] ] ( CommDbg  "ID Dev:% s   r  n "  devId ); 
   
   } 
    lain 
    lain 
    {
       fprintf  ( CommDbg  "devId N / A   r  n " 

); 
   } 
   } 
   } 
   } 19659035] =  0 ; 
   
    sementara  ( TRUE ) 
      
       {
      
       enable_interrupts  ( 196590 [196590]] ] genCounter  ++ ; [19659435] bekle  ( tMicro ); 
       output_toggle  ( userLed ); 
      
      
      
       jika   ((19659049) genCounter [65]   500 )  ==  0 ) 
       {
          // myClock.year = tahun + 2000; 
          ds1307_get_time  ( .  jam  myClock .  min  myClock .  sec ); 19659014] ( 1  1 ); 
          printf  ( lcd_yaz  "Saat:% 2u:% 2u:% 2u] " myClock .  jam  myClock .  min  myClock .  dtk ; 
      } 
      
        jika   (( genCounter  %   500 )  ==  150 ) [19659501_{ ( myClock .  hari [19659049] myClock .  bulan  myClock .  tahun  myClock .  dow  ] ] alamat  ( 1  2 ); 
          printf  ( lcd_yaz  "Tarih:% 2u /% 2u" / 20% u " myClock .  hari  myClock .  bulan  tahun myClock .  tahun [19659014]);          
      } 
      
       jika   (( genCounter  %   500 ) )  ==  450 )  { 
          suhu   =   ds1820_read  (); 
          alamat  ( 1  3 ); 
          printf  ( lcd_yaz  "Hava% 3,1f% cC"  suhu  223 ); 
      }    
      
       jika  ([19659049] masukan  ( buton1 )  ==  0 [19659014]) 
       {
          fprintf  ( CommDbg  "buton1   r  n " ); ); ); ] jika  ( masukan  ( buton2 )  ==  0 ) 
       {
          fprintf  ( CommDbg  "buton2   r  n " );     
      }     
      } }  ( input  ( buton2 )  ==  0 ) 
       {
          fprintf  ( CommDbg  "[buton3] 19659244] ");     
      } 
       jika  ( masukan  ( buton4 )  ==  0  0 19659640] {
          fprintf  ( CommDbg  "buton4 
           r  n " );     
      )     
      } ] ( masukan  ( buton5 )  ==  0  0 ) 
       {
          fpr intf  ( CommDbg  "buton5   r  n " );     
      } 
      
      
       jika  ( rda  ==  1 ) 
          {
             // fprintf (CommDbg, "Data2:% s  r  n" rda2_data); 
             rda2IntActivity  = 19659036] =  0 ; 
            
                        
             strcpy  ( tempBuffer  myCmd  [ AT ] ]; ]; // AT 
             jika  ( strcmp  ( rda2Data  tempBuffer )  ==  0 ) ] {
                fprintf  ( CommDbg  "AT: OK   r  n " 
); 
            }; 
            } 
            } 19659014] ( tempBuffer  myCmd  [ ATI ].  str );  // GET device_id  jika [ ] ( strcmp  ( rda2Data  tempBuffer [19659014])  ==  0 ) 
             {
                fprintf  ( CommDbg  "ATI:% s   r  n  " devId ); 
            } 
           
             strcpy  ( tempBuffer   myCmd  [ ATH .  str );  // DAPATKAN cHW_id 
             jika  ( strcmp  ( rda2Data  tempBuffer [1965)19659035] ==  0 ) 
             {
                fprintf  ( CommDbg  "ATHW:% s   r  n [1965924] " deviceData  [ cHWId ].  hwStr ); 
            } 
            } 
            
             strcpy  ( tempBuffer [1965] myCmd  [ ATHWr ].  str );  // GET Hardware revizyon 
             // jika 19659014] ( strcmp  [] rda2Data  tempBuffer )  ==  0 [19659014]) 
             {
                fprintf  ( CommDbg  "ATHWr:% s   r  n "  device [data196590]] device [data1965]  cHWRev ].  hwStr ); 
            } 
            
             strcpy  ( tempBuffer   ATC 196590 [196590]] ].  str );  // GET Sofware revizyon 
             jika  ( strcmp  ( rda2Data [196590] )  ==  0 ) 
             {
                fprintf  ( CommDbg  "ATSW:% s   r  n  " deviceData  [ cSWVersion ].  hwStr ); 
            } 
            
             strcpy     ] myCmd  [ ATC ].  str );   // hapus perangkat_id 
             jika  ( strcmp [196590]] ( rda2Data  tempBuffer )  ==  0 ) 
             {
                untuk   ( counterTemp  =  0 ; ; 19659035] < 20 ;  counterTemp  ++ ) 
                devId  [ counterTemp ]  =  '0 0 '; 
                writeDevId  (); 
                fprintf  ( CommDbg  "ATC: OK   r  n 
         " 19659014]); 
            } 
            
             strcpy  ( tempBuffer  myCmd  [ ATR ].  str ];   // hapus device_id 
             jika  ( strcmp  ( rda2Data  tempBuffer )  01965 ]) 
             {
                fprintf  ( CommDbg  "ReBoot   r  n " ); 
                bekle  ( tOrta ); 
                reset_cpu  (); [19659948]} 
            
            
             strcpy  ( tempBuffer  myCmd  [ ATW ].  str ); ); tulis device_id 
             jika  ( strstr  ( rda2Data  tempBuffer )  13 ] ] 
                // fprintf (CommDbg, "ATW  r  n"); 
                counterGen2  =  strlen  ( rda2Data ); 
                jika  (( counterGen2  < 26 )  &&  ( counterGen2 >  20 )) 
                {
                untuk  ( counterData  =  0 ;  rda2Data  [ counterData ] ! =  ':' [1965];  counterData  ++ ) 
                   {} 
                   counterData  ++ ; 
                  
                   // fprintf (CommDbg, "str_len:% lu  r  n "strlen (rda2_data)); 
                  
                  counterGen2  =  co unterGen2  -  counterData  -  2 ; 
                   untuk  ( counterTemp  =  0 ;  19659035]! =  counterGen2 ;  counterTemp  ++ ) 
                   {
                      devId  [ counterTemp ]  19659049] rda2Data  [ counterTemp  +  counterData ]; 
                  } 
                  } 
                   devId  [   ] ] ' 0' ; 
                   writeDevId  (); 
                   fprintf  ( CommDbg  "ATW: OK   ATW: OK 19659244] "); 
                 
               } 
                lain 
                {
                   fprintf  ( CommDbg " ATW: ERROR   r   "); 
               } 
            } 
       
       
         } 
      
      
      
       // TODO: Kode Pengguna 
   } 

} 

} 

Leave a Reply

Your email address will not be published. Required fields are marked *