Im trying to figure out how to have the user specify a time delay and the PIC remember that time for use later. As of now I have a circuit built that has 8 LEDs that represent 8 seperate time modes. Pressing button 1 cycles through the 8 time modes (LEDS) and selecting button 2 activates a relay for that particular time mode selected. I would like to add the capability for the user to calibrate and store each time mode to their liking. I have seen in examples how to read and write the EEPROM but the timing thing has got me stumped. How do you keep track of seconds and parts of a second?
PIC16f628
4MHz 2 buttons Port A,2-3 1 relay Port A,0 8 LEDS PORT BExample:
User enters calibration mode by pushing 2 buttons at same time. While in calibration mode user holds down button 1, for 2 seconds. user releases button. User then holds down button 1 again for 2.4 seconds. This is added to 1st time and now have accumlated 4.4 seconds. And so on. Now user pushes button 2 which exits calibration mode and stores the
4.4 seconds in EEPROM. When they press button 1 the relay activates for the time stored in the EEPROM. Id like to have at least 1/8 second resolution. Ive looked allover PIClist and the net and can only find simple countdown timers.Has anyone done this before and could share, or can point me to an example of some code that is similar to this?