DS1302 demo display is 00:00 00/00/00
skywaterblue
Posts: 3
A continual problem! I read through previous forums and they suggested it was a problem with the crystal getting heated during sauter - my professor and I agreed that was the most likely cause and I ordered a new pair. No such luck. After a thorough debugging, we can't figure out what's wrong with the DS1302 chip because with new chip and crystal and we're still getting the 00:00 00/00/00 error in the debug window. We've double and triple checked the ports.
This chip is going to a neon animation box - I am planning on making a menorah that lights up on the appropriate days by itself. What do you think I should do next? Order another crystal? (Are they often bad?) Is there an easier chip I can use with the basic stamp to keep track of time?
This chip is going to a neon animation box - I am planning on making a menorah that lights up on the appropriate days by itself. What do you think I should do next? Order another crystal? (Are they often bad?) Is there an easier chip I can use with the basic stamp to keep track of time?
Comments
Make sure your code initializes the Clock Halt bit to zero (see the datasheet for details). If the DS1302 powers up with with this bit set to one, the clock won't run.
I'm assuming that for my project purposes (lighting 'candles' at the pre-determined shabbat times) there's no real reason to choose a DS1302 over the DS1307? And both of these work with BS and not just Arduino? (Switching is not an option for this class and I have zero experience with Ardunio with three weeks until final crit.) I did not know there were pre-assembled kits and I think I would have saved a lot of time and effort had I just bought one. As you can see, I've made about three different mistakes here. Heh.
How do you have the DS1302 connected to your stamp? Can you attach a schematic? Can you attach a copy of the program you're using to test it?
Good eye Chris!
1. The ceramic capacitor is fine because we tested all the components for burnt out things yesterday.
2. The circuit I am using for the ds1302 is the basic one included in the ds1302 pdf file. It's possible there's something wrong with the way it is connected to the BasicStamp but I am not able to provide a circuit diagram for the neon animation kit since I was never give one.
3. The program I was using with the ds1302 was the demo program that can be found on this forum, since I just wanted to make sure the chip worked and could display an accurate time in the debug window. It does not.
Anyway. I may give it one last attempt, but my professor has pretty much give up on this since the neon animation box wasn't designed with too much interface in mind. Given the amount of time I have left this semester, classmates and I were discussing the possibility of writing a program that would have to be turned on during sundown of the first night of Haunkkah, left running and then the next light would go on after a Pause or Count duration of 24 hours. I think that's theoretically possible, although it doesn't have the conceptual thrill of programming it to go on at the right date every year for a hundred years.
If you can indeed reduce your project description so that a 24 hour (roughly) period is mostly what you have to keep track of, you could do that without the DS1302. The Stamp's PAUSE statement is pretty accurate, certainly over a few days. You could use a PAUSE 60000 as a one minute timer and keep track of the number of minutes that pass by. Once a minute, you can increment a variable from 0, check it against 60 and, if equal to 60, set it back to zero, then increment another variable from 1 and check it against 25. If equal to 25, you'd set it back to 1 and increment a day counter. Then you'd go back to the PAUSE again.
You'd have a time in days, hours, and minutes and could use that to turn the candle lights on and off. You'd start the program at midnight on the day of the first night. You could set a sundown and sunrise time for each day in a table or assume that it's not changed enough over the course of 8 days to bother ... whatever.
"Bit 7 of Register 0 is the clock halt (CH) bit. When this bit is set to 1, the oscillator is disabled. When cleared to 0, the oscillator is enabled. On first
application of power to the device the time and date registers are typically reset to 01/01/00 01 00:00:00 (MM/DD/YY DOW HH:MM:SS). The CH bit in the seconds register will be set to a 1. The clock can be halted whenever the timekeeping functions are not required, which minimizes current (IBATDR)."