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.

[51] Non volatile DC Pulse counter

Status
Not open for further replies.

hardik.patel

Member level 5
Joined
Aug 15, 2012
Messages
94
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
2,008
Hi all,

I need to count that how many times the limit switch activated?(O/P of limit switch = 5V)

also i want to make it non-volatile. so for this purpose i want to use 89c51 or with PIC also no problem.

so here my basic query is that how to store that count in MCU's RAM for temperory purpose, even i dont want to use more space of RAM...just need to store present count and will be erased as a new count occured. so same RAM location will be erased and again write with new data.

Does it possible without using extra memory?

Regards,

- - - Updated - - -

here i forgot to add that...i had idea about simple counter and display it. just confuse about to use of internal memory for such task.
 

even i dont want to use more space of RAM...just need to store present count and will be erased as a new count occured.
It doesnt matter for RAM, you can do whatever when there is power. it will forget everything after power gone.
 

ok...agree with you Venkadesh, that RAM will fortget as power gone.

Then how can i fullfill my task...i need the count position after the power come back.
so for this according to you i need to store that data in ROM.

Now give me idea that how can i use the internal ROM for such purpose??
(As far as possible i dont want to use external ROM...untill we can use internal)
 

If you use PIC then it has internal EEPROM which can be used to store the data. Your data can be 1 byte, 2 byte or 4 byte depending upon char, int or long the counter value. So, you may need 1, 2 or 4 bytes of EEPROM. You can also store data in Flash ROM. For that you can use Flash read/write routines which comes with some Compilers. Interface the o/p of limit switch to T0CKI pin or INTx pin of PIC and use interrupts to increment the counter whenever there is a trigger. At frequent duration of time you can save this counter value to Flash ROM or Internal EEPROM. Provide your circuit and I will help in a mikroC Code.
 
Yeah, EEPROM, thats the gift for you..

some controllers have internal EEPROM memory, and some controllers dont but you can connect externally.

you want to store the count every time you got the pulse and you have to read it when the power comers Thats all.

https://bharatbalar.wordpress.com/2...-operations-in-internal-eeprom-of-pic16f877a/

- - - Updated - - -

I forgot to mention the read write cycles of EEPROM is limited like around a million, after that it will damage, so if you use a external memory(24LC64) you can change it easily but you will lose the data.

For that you can use a mechanism for storing the data only when the power is going by sensing the power voltage, if you need.
 
Milan & venkadesh,

BUT it IS NOT also possible in case of 89c51 ?
 

Yes, it is possible with 89C51 using INTx pin but you have to use external I2C or SPI eeprom and write software i2c or spi routines to communicate with the eeprom. Even 89C2051 is enough.
 
Milan & venkadesh,

I want to stick with '51 because i can achieve my task at low price.

and milan..can we dont use 89c2051's internal ROM??
(btw for external ROM i had idea of it. but as i had above tell that if the case is solved using internal ROM..then dont want to go towards external ROM)
 

Most of the controllers will not allow you to alter code space when execution, even there will not be a provision for that. so the external EEPROM is the best option.

The internal EEPROM and Program memory are totally different.
 
ok....now let me concentrate on that ...n if there is still any problem, i will be back.

N milan, i had referred that blog many times...really good examples are given there, really its a perfect guide for begineers

anyhow thanks to both of you for what you had shared with me.
 

I want to stick with '51 because i can achieve my task at low price.
If you use any 8 pin PIC 12Fs then you can achieve it for low cost.

You can use PIC12F683. It has 256B EEPROM.
 
Last edited:

@milan

almost i need 15 to 16 i/o pins ....so i think as per my need its best if i use 89c2051 (20pin) + External EEPROM

n in case of EEPROM which chip is cheap..? (even i dont need more memory,,as per my task)

What u say??
 

24LC01 will be enough for your requirement. Please keep in mind the no. of times eeprom location (byte) can be written/erased and the frequency of data write.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top