Logu KS
Member level 2
- Joined
- Jul 19, 2014
- Messages
- 43
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Location
- Chennai
- Activity points
- 372
I am trying to make a temperature data logger using rtc, lm35 and eeprom 24lc512. I did upto writing and reading the temperature value in eeprom. Now i want to write and read the time and date also. At some periodic intervals that is set using rtc the date, time and the tempertaure value to be written into the eeprom. Then using a button the written values should be read and display it hyperterminal and lcd.
I just added the writing and reading part of the code. rtc_bu[0] is for seconds buffer. If seconds becomes multilples of 5 (ie) 5,10,15,20,25..... the date, time and temperature value should be written into the eeprom and pressing a button the written values should be read and displayed in lcd and hyperterminal
Code:
if(rtc_buf[0]%5==0 && prev_value != rtc_buf[0])
{
prev_value = rtc_buf[0];
write_EEPROM(address,hour);
address++;
write_EEPROM(address,minute);
address++;
write_EEPROM(address,second);
address++;
write_EEPROM(address,m);
address++;
write_EEPROM(address,n);
address++;
if(address>60000)address=0;
}
RB7=0;
//read_address=0;
if(RB7==1)
{
//read_address =0;
p=read_EEPROM(read_address);
read_address++;
q=read_EEPROM(read_address);
read_address++;
r=read_EEPROM(read_address);
read_address++;
RxByte=read_EEPROM(read_address);
read_address++;
RxByte1=read_EEPROM(read_address);
txt1(p+0x30);
txt1(10);
txt1(13);
txt1(q+0x30);
txt1(10);
txt1(13);
txt1(r+0x30);
txt1(10);
txt1(13);
z=((RxByte<<8)|RxByte1);
// Converting sample value to temperature
T=(z*0.48876);
Temp1 = (unsigned int)((T/100)%10); // 1st digit
Temp2 = (unsigned int)((T/10)%10); // 2nd digit
Temp3 = (unsigned int)((T/1)%10); // 3rd digit
// Displaying temperature in lcd
lcdcommand(0xcd);
if(T<=99)
{
lcddata(' '); // displaying the 1st digit
lcddata(Temp2+0x30); // displaying the 2nd digit
lcddata(Temp3+0x30); // displaying the 3rd digit
}
lcdcommand(0xcd);
if(T>=100)
{
lcddata(Temp1+0x30); // displaying the 1st digit
lcddata(Temp2+0x30); // displaying the 2nd digit
lcddata(Temp3+0x30); // displaying the 3rd digit
// lcddata('C');
}
txt1(Temp1+0x30);
txt1(Temp2+0x30);
txt1(Temp3+0x30);
txt1(10);
txt1(13);
read_address++;
}