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);
   }
}




Leave a Comment

*
= 3 + 0

Read previous post:
A battery small enough to be injected, energetic enough to track salmon

RICHLAND, Wash. – Scientists have created a microbattery that packs twice the energy compared to current microbatteries used to monitor...

Close
Scroll to top