I2C bus for 24LC16 For CSS Compiler

 

#include <16F877.h>
#device adc=8
#FUSES NOWDT ,XT                                        
#use delay(clock=4000000)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)

#INCLUDE "LCD_4BIT.C"
#include "I2C_24LCxx.c "
int8  value,setpoint=112; 

void main(){
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1); 
   set_tris_c(0B10000000);      // 1000 0000    PortC
   set_tris_d(0B00000000);      // 0000 0000    Portd is Output
   lcd_init();
   Write_eeprom_24LCxx(0x01,setpoint);  
   lcd_init();
   lcd_ROW_COL(1,0);  // defind  ddram address for put string
   lcd_putc(" KCHI_MICRO.PIC");
   lcd_ROW_COL(2,0);
   lcd_putc("READ EEPROM 24LC");
   DELAY_MS(1000);
   LCD_CLear();
   LCD_INIT();
 while (TRUE){ 
      Lcd_row_col(1,0);   
      Lcd_putc("setpoint="); 
      value=Read_eeprom_24LCxx(0x01);
      hex_bcd(VALUE);
      lcd_row_col(1,9);
      sent_Lcd();
      delay_ms(100);
   }
}

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter