My first P1 code: PST Clock with Date and Time
Ludis
Posts: 69
in Propeller 1
Hey. I'm new to the P1. About half way through the P1 Education Kit pdf. I wrote my first P1 code which is attached. I have basic programming skills.
This is a PST clock that shows the Date and Time in 24 hour format. You will need to hook PINS 0-5 up to 6 momentary push buttons that pull the input low. I'm doing this on the PPDB. Holding PIN 5 low for 2 seconds will enter a mode to adjust the date and time. PINs 0-4 adjust the date and time. Momentary press or hold the push button. Holding Pin 5 low for 2 seconds will exit the adjust mode. Two pictures of the PST clock display are attached. The first is the normal display. The second is "adjust" mode, where "Clock Adjust Enabled" flashes. Two cogs are used in this code, to allow the clock adjust without needing the waitcnt to finish.
I plan to learn how to drive segmented LEDs next with this code.
Thanks for looking. Feel to use, discard, or comment on. It seems to be working well.
Macho Man Randy Savage (AKA Nick AKA Ludis)
This is a PST clock that shows the Date and Time in 24 hour format. You will need to hook PINS 0-5 up to 6 momentary push buttons that pull the input low. I'm doing this on the PPDB. Holding PIN 5 low for 2 seconds will enter a mode to adjust the date and time. PINs 0-4 adjust the date and time. Momentary press or hold the push button. Holding Pin 5 low for 2 seconds will exit the adjust mode. Two pictures of the PST clock display are attached. The first is the normal display. The second is "adjust" mode, where "Clock Adjust Enabled" flashes. Two cogs are used in this code, to allow the clock adjust without needing the waitcnt to finish.
I plan to learn how to drive segmented LEDs next with this code.
Thanks for looking. Feel to use, discard, or comment on. It seems to be working well.
Macho Man Randy Savage (AKA Nick AKA Ludis)
Comments
thank you! Will do. Might be a while lol
Writing a 7 segment display driver could also be a fun projects as you need to map each segment to a pin and drive the right pin at the right time. Parallax has one of these here. It looks like it comes with examples.
The other option is to program a set like this which I believe was featured recently.
Mike
This would be much more difficult with discrete circuits! thanks for the links, I purchased both. The next jonnymac forum with that segmented LED is next week! I signed up. Great timing!