Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Relay switching counter and Display on LCD using 8051

Status
Not open for further replies.

prabhakar06447

Newbie level 6
Joined
Nov 20, 2010
Messages
12
Helped
11
Reputation
22
Reaction score
11
Trophy points
1,283
Location
Hyderabad
Activity points
1,346
I am designing a digital counter using 89c2051 or 89c51 and 16x2 LCD Display and relay for switching purpose.

How to get the previous counter value of microcontroller when there is a sudden power-cutoff or power failure to the device.

I want the count value present at the time of power failure..

Anyone help in designing this counter.

Thanks......:)
 

best way to do this wirite your counter values to some external memory like EPROM and on power up or power -down read correponding values.....I am considering your using same supply voltage to power up the 89c51 only the thing is that you need write some I2C or some alike interface
 
yes i am using only one power supply for muc.
I would like to use EEPROM 24c02, how to interface it to microcontroller.
please provide C code to read and write the data from EEPROM 24C02.
 
For short duration power failure, a battery backup is the easiest solution, capabilities of microcontroller allow sizable durations.
 
battery backup is good solution but i want to use this with eeprom..
what are the command to store and retrieve the data from eeprom...

any suggestions please..
 
Hello,

I am struck with my coding to store the data into the 24c02 and reading it.

Using this code i am only able to read and store the first digit (i.e k= a[0]), and getting random numbers for other digits like l=a[1].......

I am using proteus and HI-Tech compiler
for(i=0; i<4; i++)
{
a=ReadBYTE(0x01);
}
k=a[0]; tmpd1 = k; ///a[] is char type
l=a[1]; tmpd2 = l;
.......

while(1)
{
for(j=0;j<10;j++)
{ //units
if(!SW1)
{ delay(500);
while(!SW1){delay(10);}
k++;
commandsend(0xCF);
tmpd1++;
delay(10);
sendcount(str[k]);
WriteBYTE(0x001, k);
commandsend(0x8F);
}
}
//Tens place
if(tmpd1 >=10)
{
tmpd1 =0; k=0; l++, tmpd2++;
delay(10);
commandsend(0xCE);
delay(10);
sendcount(str[l]);
WriteBYTE(0x002, l);
commandsend(0x8E);
}
......................
}
 

Attachments

  • at24c02.h.txt
    1.9 KB · Views: 88
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top