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.

16f877a EEPROM write, read and operation

Status
Not open for further replies.

jmlabuac

Newbie level 5
Joined
Jan 5, 2012
Messages
8
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,379
Hi guys...

I'm creating a program which is for a parking stall.... I wanted to count the number of pulses from the multicoin slot and then save it on the eeprom every second which we will define as p_amount... Also, this program increments around 3 every 5 minutes or every 300 pulses from the RTC which we will define as p_fee... Each pulse from the multicoin slot decrements the p_fee... If the system is suddenly experiences a power interruption, when it resumes operation, it will check the rtc values and compute accordingly, it will also check the p_amount and deduct it to the p_fee...

My problem is this... when I have generated pulses (let's say p_amount = 2 and p_fee = 4) from the microcontroller, after interrupting its power and resuming it... It seems that the value saved in the EEPROM is not what I expected... It should have a value of around p_fee = 2 since the p_amount should be subtracted from p_fee... But the value of p_fee becomes 4... It does not subtract but rather increases the value of p_fee... I'm confused. I tried it with type casting and without type casting...
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top