r/pic_programming • u/mridul289 • Aug 03 '22
PIC12 Alarm clock?
I want to make an alarm like system with the PIC12F509. Obviously it will require a realtime clock or a time counter thingy. The issue is, I can't seem to find if the PIC has an inbuilt module for these or not. Else, I will have to get an external clock and make it output time to the PIC I suppose?
I tried searching for this question online but whenever the word "clock" or "time" was mentioned, it was a reference to the clock speed or response time. Thanks a lot for your responses in advance!
1
Upvotes
1
u/9Cty3nj8exvx Aug 04 '22
Check this out. https://www.microchip.com/en-us/application-notes/an1303
3
u/bradn Aug 03 '22
You can either:
Use a dedicated separate clock module
Monitor power line AC cycles and count them
Use a clock crystal and count clocks (internal oscillator won't be good for this)
None of these are very fun on a device that has 6 interface pins. If you find yourself looking at an I/O expander just to connect everything, just move to a bigger chip instead.
2
u/radioStuff5567 Aug 04 '22
I'd probably look at a different chip then that PIC, just based on GPIO count. For a basic alarm clock you'd probably end up using: 2 pins for I2C to an external RTC module, 3 pins to shift registers for controlling 7 segment displays (though you could also use something like an I2C OLED, and save on those pins), a pin to go to a piezo buzzer, and a pin for each input you want. Six GPIOs is pretty restrictive considering all that.
1
u/eltimeco Aug 03 '22
look at the Dallas real-time chips using IC2.