Hello friends, I am looking for helpo in a simple project, hope this forum can help solve my problems.. I am using PIC 12F675 because it is easy to find and low cost model , and programming with C code with PCH compiler... I just need to build a programm that blink a led when push a button.. it is easy so far.. but now we have to upgrade the code and use the memory eeprom from pic12f675. Now it is the problem.. The function is , press button and led blink, but have to record how many times you have pressed the button. Still a second button to read the memory and output results in the led.
Example: you pressed 3 times and led blinked 3 times. Than when power is off, and on again, when you press button 2, led blink 3 times. I may use the eeprom read and write function but this drive me crazy... Basically I am using (summarized):
Definition:
#define eeprom_write(addr, value)
#define eeprom_read(value)
int c1;
Main code:
c1== eeprom_read(0) // initialize the variable C1 with the value in the memory address 0
Some functions to blink led and count number os pressed button, in each press I do the following:
eeprom_write(0, c1); // write in the adress 0 the variable C1 value - this is because in the beggining of code I read C1
So when power is off, than on again, the C1 starts with a value (stocked in the memory), and can blink led accordinglly,
Please help me, let me know only about the memory how to read or write, maybe a simple example how can I do this please.. the other points about led and button I don´t need help.... just this *** memory.
Thanks, and sorry my bad English I am from Brazil.
Regards.
Example: you pressed 3 times and led blinked 3 times. Than when power is off, and on again, when you press button 2, led blink 3 times. I may use the eeprom read and write function but this drive me crazy... Basically I am using (summarized):
Definition:
#define eeprom_write(addr, value)
#define eeprom_read(value)
int c1;
Main code:
c1== eeprom_read(0) // initialize the variable C1 with the value in the memory address 0
Some functions to blink led and count number os pressed button, in each press I do the following:
eeprom_write(0, c1); // write in the adress 0 the variable C1 value - this is because in the beggining of code I read C1
So when power is off, than on again, the C1 starts with a value (stocked in the memory), and can blink led accordinglly,
Please help me, let me know only about the memory how to read or write, maybe a simple example how can I do this please.. the other points about led and button I don´t need help.... just this *** memory.
Thanks, and sorry my bad English I am from Brazil.
Regards.