I'm a beginnner,·not yet received my DS1302 and I need some explanation: I think that if I download DS1302_Template.bs2 the clock can't run, I must download DS1302_Demo.bs2. In this code I see "Baud·· CON·· 32··' 19K2 bps", what does it mean 32 and 19K2? Thank you in advance.
@Whirlymark – Thanks for the feedback…there are several updates I have made over the last couple of years that haven’t quite found their way into the demo or template. I really need to keep these things updated.
@MichelB – Baud CON 32 ‘ 19K2 bps
That is the declaration for the constant ‘baud’ assigning it a value of 32 so that when you use the word baud in the program it is substituted with 32 in the program. 32 is the value required by a BS2 for the SERIN/SEROUT commands to generate a 19.2 Kbps serial stream.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Chris Savage Parallax Engineering
Chris · I was looking at the DS3234 in case you’re wondering what my next experiment will be on. Take care. ·
Do you have any updated on your experiment on the DS3234 chip
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ ··Thanks for any··that you may have and all of your time finding them
Got my DS1302 and crystal from my dealer in Belgium. Crystal is UMH instead of ECS (Parallax data sheet). I want to know if the 6 pF load capacitor is in the crystal cylinder? Thank you in advance.
Dear Chris, I built today the circuit according to instructions and I was a little disappointed with the result, i) 1 minute is covered in 20 seconds! - I'm 68 years old and I don't want to die soon!, ii) time is not displayed on the LCD, only "M·· V4v" on the top left and "=" or "{" on the low right.
For i), is it a problem with the crystal? see my message just before this one, for ii) I don't understand, the LCD ran very well with Smart Sensors activities. The code is DS1302_Demo_LCD.bs2, File DS1302_Demo.bs2 (without letters LCD) updated 10-09-2005 herewith attached.
Thank you in advance for your help and best regards.
There is nothing in the code that can make the clock run at 20 seconds per minute. Perhaps you have the wrong crystal or there is an issue with it or how it is connected. As for the LCD, definitely check Phil’s recommendation as this code has been out for years without any issues. There has to be something in the setup. Can you post a picture or schematic of your setup?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Chris Savage Parallax Engineering
Yes, Phil and Chris, your are right, it's a problem of Baud rate, I've forgotten to change the·Baud rate switches.·Thank you again.
P.S.: LCD display is correct now but ·frequency of crystal seems to be faster than 32768 kHz, can I measure it with my Parallax USB oscilloscope? If yes can somebody post the schematic for connections before I return it to my dealer?
Thank you in advance.
P.S.: LCD display is correct now but ·frequency of crystal seems to be faster than 32768 kHz, can I measure it with my Parallax USB oscilloscope? If yes can somebody post the schematic for connections before I return it to my dealer?
Thank you in advance.
Hi Phil, thank you for your reply. Why I think that is the crystal is that 1 minute is displayed in 20 seconds. I can't try with an other DS1302 nor an other crystal, I've only one piece of each and my dealer don't have stock for the moment.
I always try to have a replacement part on hand for problems
just like this. Without the means for isolating the problem, you
just have to take your best guess as to where the problem
lies.
It might be the crystal, the 6 pf cap may be marked wrong,
it might be the DS1302 or the power supply.
Replace one of these at a time.
Have you measured the voltage? Is the power supply filtered?
It's difficult for me to have replacement parts, not a price question but due to the fact that my Parallax dealer is in Belgium where price are cheaper that in France where I live and he don't have all parts in stock. If I place an order to him I must wait long time to get parts that will be delivered with other parts for other customers, and we can't place order directly to Parallax. An other example of difficulties is the following: the little pump from KidWind used in Applied Sensors costs about 10$ but the transport by UPS costs 58$!!!
My circuit is mounted on a Board of Education Rev. C,·power supply ·is an AC/DC adaptator 230 V 50 Hz - 9.5 V 550 mA from Parallax and I suppose that it's not filtered, voltage measured on the board is 5 V.
Thank you for your help and sorry for my poor English.
P.S.: my dealer is in· holyday for the moment and at its return I'll ask replacement parts and I'll inform you.
Since you are using a Board of Education and a Parallax wall supply,
the +5 volts is probably filtered well enough for the DS1302 to work.
Without a photo of your board, it is hard to tell what else might be
causing the problem.
I've found that the best way to attach the crystal and 6 pf cap to the
DS1302 is to gently bend pins 2 and 3 of the DS1302 up so that they do not plug into the solderless breadboard. Then solder the crystal
and 6 pf cap directly to pins 2 and 3 being careful to keep the leads
somewhat short.
The reason for not plugging everything into the solderless breadboard
is that the breadboard will add extra capacitance to pins 2 and 3. This
extra capacitance may be what is causing the DS1302 to run faster
than it should.
phil
Post Edited (phil kenny) : 7/30/2009 1:58:26 PM GMT
Dear Phil, reading your post I think that I begin to understand. When I bought DS1302 & crystal I asked the 6 pF·load capacitance and received only 2 parts, I thought that the cap was "inside" the crystal and to be sure I sent a message (see my question and the answer of Chris Savage 10 messages before your last one - Chris wrote "Yes".) and for me the cap was inside the cylinder crystal. Conclusion, even the breadboard adds extra capacitance the 6 pF lacks. Thank you again for your help, I learned something more today, best regards.
If Chris Savage is monitoring this thread, perhaps he can jump
in and clear up any confusion regarding the 6 pf load capacitance
and how to best mount the crystal.
@Phil, yes I have been monitoring this thread the whole time. You are correct that a breadboard can adversely affect the capacitance, some more than others. In some cases there isn’t even a solid connection to the crystal since the leads are typically too small for the metal tabs inside the breadboard.
@MichelB, if my answer indicated that the capacitor is included inside the crystal then I apologize. Perhaps I misunderstood your question. In any event the load capacitance of a crystal is the amount of capacitance across the terminals of the crystal. For series resonant crystals I don’t believe this is used or matters (I could be wrong, it’s been awhile). For parallel resonant crystals the value is usually provided and is important in that the oscillator circuit may contain reactive components and the load capacitance can affect this. The DS1302 is a very easy to use and powerful RTC but it does require the correct crystal for any accuracy.
I have attached pictures I found on the web using Google which demonstrate Serial and Parallel resonant circuits.
Also, Maxim has an AppNote that should be linked somewhere on the DS1302 page which describes the proper way to mount the crystal on a PCB. It also notes that signal lines in the vicinity of the crystal leads can cause extra clock pulses to appear to the RTC. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Chris Savage Parallax Engineering
Dear Chris, what it holds my attention after surfing on the web is that crystals are made (not with) but for a certain load capacitance, 6, 7, 9 and 12.5 pF for CITIZEN, 8 and 12.5 pF for ECS sold by Parallax (item #251-03230) -·please note 8 pF instead of 6 pF - and in other part, according to the DS1302 data sheet page 3 we can see: "The internal oscillator is designed for operation with a crystal having a specified load capacitance of 6 pF". So, you (and I) are nearly right when we say that the 6 pF CL is "in the small crystal cylinder". I think that my problem is that the capacitance of the crystal don't match with the capacitances of DS1302 on pins 2-3 (X1, X2) and this problem is greater than that encountered with the board.
P.S.: I tried a curious experience holding a small piece of paper like a post-it between two fingers and approaching the crystal, when the paper is in contact with the cylinder seconds on screen stop and when I draw gently my fingers (with paper) seconds start slowly and go faster.
Chris: A word of wisdom from your experience on the DS1302 would be very valuable for me: I am developing a system with the basic stamp 2 and this DS 1302. When I reach a certain date i.E: 2 months I need to use one of the time variables to trigger a certain device. The point is: I can use a 3 volt lithium battery to keep the data in the DS1302, but there will be times, many times specially during the nights that the 5V supply is not present since the equipment will not be in use. I want to ask you if during all these times the lithium battery will be able to hold the time data within the the DS1302?
what do you suggest?
Appreciate your comment on this matter
Yes, the 3V lithium battery will keep the internal clock going...the clock continues to maintain date/time updates from the lithium battery even when main power is lost. One thing that trips up some people who are trying to do what you are is that if the main power is off when the event happens it would be missed. So if the power goes off at 1:00PM and comes on at 3:00PM but your trigger was set for 2:00PM then you need to account for that in software and it wouldn't be detected until the main power was back on. I hope this answered your question. Best Regards,
Yes, Although the BS2 will NOT be running, the DS1302 will (with 3v backup) to pin 8 still be keeping exact time along with any DS1302 RAM DATA(BYTE'S 0 - 32). If you need to keep some of the Variables(DATA) you can save them/it in this area while the program was running(On the FLY/Real time). The BS2xx has free RAM space accessed by (PUT & GET) but all this DATA will be lost with the lost of power(5v). Seems as though you already know but connect your 3v to pin 8 of the DS1302 and Grd and when the 5v is lost the DS1302 will keep running with out a hitch from the 3v. Just so you will know, I had a unit sitting on my desk for over a year and plugged it in to check it out and it was working with out a problem, so I know they work.
1) Clock keeps running with lost of 5v
2) DS1302 RAM will be in tact if you need to save DATA to those locations
3) The DATA can be reloaded on Re-Boot
4) You could also program in Re-start time (if space allows)....BUT NOT power lost because no program will be running
5) There is a way to see if the DS1302 is already running and if so skip around to a Re-start routine with Re-Load of RAM DATA.
hope this helps
Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
I just received the Dallas DS3232s and also ordered a carrier from EZPrototypes that convert the SOP package to 20 pin through hole. This adaptor is really great and is only a little larger than the IC itself but is the same size as a 20 pin DIP. Big question though. You said: The problem with the DS1307 is that it is not nearly as flexible as the DS1302. Being an I2C chip means that the BASIC Stamp 2 has to bit-bang the protocol to some degree. · I don' understand why you said that the BS2 has to bit-bang the protocol? · I looked at the DS3232 and the 3234 but decided on the 3232 for a few reasons. The DS3234 uses the SPI interface and I thought the I2c would be easier to use with the BS2? Am I on the wrong path? ·
In all fairness though, I have actually been looking at some of the newer SPI offering for RTC chips from maxim. In particular the ones with integrated crystal that are listed as high-accuracy. These don’t tend to come in a DIP package, so we’ll see how far I get on that. I was looking at the DS3234 in case you’re wondering what my next experiment will be on. Take care.
I am looking forward for your next project.
Thank you,
Dave
I2C is not natively supported on the BS2, however it can be done, just not as elegantly as the BS2p which does support I2C. SPI can be done by any BASIC Stamp model.
I am looking at you code ds1302.bs2 and it load correctly but after i press 1 and go through setting time and it returns to the menu and i press 2 it reads 00:00:00 00/00/00
I am looking at you code ds1302.bs2 and it load correctly but after i press 1 and go through setting time and it returns to the menu and i press 2 it reads 00:00:00 00/00/00
thank you
Ryan
Ryan
Have you made sure that the pins called out in this portion of the code correspond with your wiring?
Comments
@MichelB – Baud CON 32 ‘ 19K2 bps
That is the declaration for the constant ‘baud’ assigning it a value of 32 so that when you use the word baud in the program it is substituted with 32 in the program. 32 is the value required by a BS2 for the SERIN/SEROUT commands to generate a 19.2 Kbps serial stream.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
I was looking at the DS3234 in case you’re wondering what my next experiment will be on. Take care.
·
Do you have any updated on your experiment on the DS3234 chip
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
For i), is it a problem with the crystal? see my message just before this one, for ii) I don't understand, the LCD ran very well with Smart Sensors activities. The code is DS1302_Demo_LCD.bs2, File DS1302_Demo.bs2 (without letters LCD) updated 10-09-2005 herewith attached.
Thank you in advance for your help and best regards.
the LCD are set for 19,200 baud?
The switch settings for the LCD used in the Smart Sensors
activities may have been different.
phil
There is nothing in the code that can make the clock run at 20 seconds per minute. Perhaps you have the wrong crystal or there is an issue with it or how it is connected. As for the LCD, definitely check Phil’s recommendation as this code has been out for years without any issues. There has to be something in the setup. Can you post a picture or schematic of your setup?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
P.S.: LCD display is correct now but ·frequency of crystal seems to be faster than 32768 kHz, can I measure it with my Parallax USB oscilloscope? If yes can somebody post the schematic for connections before I return it to my dealer?
Thank you in advance.
Post Edited (MichelB) : 7/28/2009 9:33:35 AM GMT
Thank you in advance.
I doubt that you could get any meaningful measurements using that
approach.
I'm pretty sure that the cable capacitance is quite a bit larger than 6 pf.
When you say that the crystal 'seems to be faster than 32768 hz',
can you give more details and how you determined this?
Have you tried another DS1302 with the same crystal?
phil
Post Edited (phil kenny) : 7/28/2009 6:39:16 PM GMT
Best regards.
just like this. Without the means for isolating the problem, you
just have to take your best guess as to where the problem
lies.
It might be the crystal, the 6 pf cap may be marked wrong,
it might be the DS1302 or the power supply.
Replace one of these at a time.
Have you measured the voltage? Is the power supply filtered?
phil
My circuit is mounted on a Board of Education Rev. C,·power supply ·is an AC/DC adaptator 230 V 50 Hz - 9.5 V 550 mA from Parallax and I suppose that it's not filtered, voltage measured on the board is 5 V.
Thank you for your help and sorry for my poor English.
P.S.: my dealer is in· holyday for the moment and at its return I'll ask replacement parts and I'll inform you.
the +5 volts is probably filtered well enough for the DS1302 to work.
Without a photo of your board, it is hard to tell what else might be
causing the problem.
I've found that the best way to attach the crystal and 6 pf cap to the
DS1302 is to gently bend pins 2 and 3 of the DS1302 up so that they
do not plug into the solderless breadboard. Then solder the crystal
and 6 pf cap directly to pins 2 and 3 being careful to keep the leads
somewhat short.
The reason for not plugging everything into the solderless breadboard
is that the breadboard will add extra capacitance to pins 2 and 3. This
extra capacitance may be what is causing the DS1302 to run faster
than it should.
phil
Post Edited (phil kenny) : 7/30/2009 1:58:26 PM GMT
If Chris Savage is monitoring this thread, perhaps he can jump
in and clear up any confusion regarding the 6 pf load capacitance
and how to best mount the crystal.
My advice may have been wrong.
phil
a 6 pf cap to the DS1302 pins, I have since found out that I was wrong.
Speaking to Parallax, I learned that the 6 pf load capacitance is
built into the crystal housing.
phil
@MichelB, if my answer indicated that the capacitor is included inside the crystal then I apologize. Perhaps I misunderstood your question. In any event the load capacitance of a crystal is the amount of capacitance across the terminals of the crystal. For series resonant crystals I don’t believe this is used or matters (I could be wrong, it’s been awhile). For parallel resonant crystals the value is usually provided and is important in that the oscillator circuit may contain reactive components and the load capacitance can affect this. The DS1302 is a very easy to use and powerful RTC but it does require the correct crystal for any accuracy.
I have attached pictures I found on the web using Google which demonstrate Serial and Parallel resonant circuits.
Also, Maxim has an AppNote that should be linked somewhere on the DS1302 page which describes the proper way to mount the crystal on a PCB. It also notes that signal lines in the vicinity of the crystal leads can cause extra clock pulses to appear to the RTC. I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
P.S.: I tried a curious experience holding a small piece of paper like a post-it between two fingers and approaching the crystal, when the paper is in contact with the cylinder seconds on screen stop and when I draw gently my fingers (with paper) seconds start slowly and go faster.
Best regards. MichelB
what do you suggest?
Appreciate your comment on this matter
Very Best Regards
Yes, the 3V lithium battery will keep the internal clock going...the clock continues to maintain date/time updates from the lithium battery even when main power is lost. One thing that trips up some people who are trying to do what you are is that if the main power is off when the event happens it would be missed. So if the power goes off at 1:00PM and comes on at 3:00PM but your trigger was set for 2:00PM then you need to account for that in software and it wouldn't be detected until the main power was back on. I hope this answered your question. Best Regards,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Check out the new Savage Circuits TV!
·
Yes, Although the BS2 will NOT be running, the DS1302 will (with 3v backup) to pin 8 still be keeping exact time along with any DS1302 RAM DATA(BYTE'S 0 - 32). If you need to keep some of the Variables(DATA) you can save them/it in this area while the program was running(On the FLY/Real time). The BS2xx has free RAM space accessed by (PUT & GET) but all this DATA will be lost with the lost of power(5v). Seems as though you already know but connect your 3v to pin 8 of the DS1302 and Grd and when the 5v is lost the DS1302 will keep running with out a hitch from the 3v. Just so you will know, I had a unit sitting on my desk for over a year and plugged it in to check it out and it was working with out a problem, so I know they work.
1) Clock keeps running with lost of 5v
2) DS1302 RAM will be in tact if you need to save DATA to those locations
3) The DATA can be reloaded on Re-Boot
4) You could also program in Re-start time (if space allows)....BUT NOT power lost because no program will be running
5) There is a way to see if the DS1302 is already running and if so skip around to a Re-start routine with Re-Load of RAM DATA.
hope this helps
Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
This adaptor is really great and is only a little larger than the IC itself but is the same size as a 20 pin DIP.
Big question though. You said:
The problem with the DS1307 is that it is not nearly as flexible as the DS1302. Being an I2C chip means that the BASIC Stamp 2 has to bit-bang the protocol to some degree.
·
I don' understand why you said that the BS2 has to bit-bang the protocol?
·
I looked at the DS3232 and the 3234 but decided on the 3232 for a few reasons. The DS3234 uses the SPI interface and I thought the I2c would be easier to use with the BS2? Am I on the wrong path?
·
In all fairness though, I have actually been looking at some of the newer SPI offering for RTC chips from maxim. In particular the ones with integrated crystal that are listed as high-accuracy. These don’t tend to come in a DIP package, so we’ll see how far I get on that. I was looking at the DS3234 in case you’re wondering what my next experiment will be on. Take care.
I am looking forward for your next project.
Thank you,
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave W.
I2C is not natively supported on the BS2, however it can be done, just not as elegantly as the BS2p which does support I2C. SPI can be done by any BASIC Stamp model.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
·
I am looking at you code ds1302.bs2 and it load correctly but after i press 1 and go through setting time and it returns to the menu and i press 2 it reads 00:00:00 00/00/00
thank you
Ryan
Ryan
Have you made sure that the pins called out in this portion of the code correspond with your wiring?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔