DS1302 to activate an output
jcook23
Posts: 2
Hello, I am doing a project and part of my program is to simply make an output high at a certain time and then low at a certain time. Could it be as easy:
IF (hrs = 10) THEN GOSUB output
output:
DO
HIGH 7
LOOP UNTIL (hrs = 12)
RETURN
Or would the time have to be in hexadecimal?
or am i missing something?
Also. I only need the DS1302 to turn a pin HIGH for a while and then make the same pin go LOW i don't need to display the time at all so it would be nice to get rid of all the extra variables and commands and stuff i have that I'm not actually using from the demo code to free up space. Im planning on using the DEBUGIN demo code to program the time in separately and then running my own program. Its just really hard to tell what I do and do not need in my program. I really only need the current hour, (i dont need minutes, seconds, day, month or year) i would like military mode if it meant i could get rid of am/pm.
Thank you for reading i appreciate your time.
IF (hrs = 10) THEN GOSUB output
output:
DO
HIGH 7
LOOP UNTIL (hrs = 12)
RETURN
Or would the time have to be in hexadecimal?
or am i missing something?
Also. I only need the DS1302 to turn a pin HIGH for a while and then make the same pin go LOW i don't need to display the time at all so it would be nice to get rid of all the extra variables and commands and stuff i have that I'm not actually using from the demo code to free up space. Im planning on using the DEBUGIN demo code to program the time in separately and then running my own program. Its just really hard to tell what I do and do not need in my program. I really only need the current hour, (i dont need minutes, seconds, day, month or year) i would like military mode if it meant i could get rid of am/pm.
Thank you for reading i appreciate your time.
Comments
http://forums.parallax.com/showthread.php?77867-DS1302-Demo-Code-(Updated)
Hexadecimal is a display format for numbers which humans use. Internally numbers are always in binary, so if you read an integer from something it is held in binary within the stamp. When your source is translated to byte code constants like 12 are translated to binary for processing by the stamp. So use which ever radix you are comfortable with.
Did you or can you use a different device that has a built in alarm. Then just set it and let it change the pin.