Real Time Clock on Professional Development Board?
jcpole
Posts: 92
Hi all...
I'm new to the Stamp, and to its interfaces, and I was wondering if anyone had some sample code to set the time & date, as well as to read the time & date from the embedded real time clock on the Professional Development Board? The Stamp itself is a BS2px. I'm also very curious as to the best way to actually connect to the clock hardware - all of the code I have seen so far reflects a 3-wire connection to the clock on the board that the PDB replaced. Unless I'm reading the datasheet wrong, I should only need 2 wires for the clock on the PDB. Is this incorrect?
Finally, is there an easy way to output the time from the clock to the 7-segment LEDs on the PDB? How about to a 2x16 LCD?
I'm researching security applications, so having access to the correct time & date is crucial.
Thanks in advance.
Jamie
--
Jamie C. Pole
Principal Consultant
J.C. Pole & Associates, Inc.
http://www.jcpa.com/
Post Edited (jcpole) : 8/31/2005 3:21:12 AM GMT
I'm new to the Stamp, and to its interfaces, and I was wondering if anyone had some sample code to set the time & date, as well as to read the time & date from the embedded real time clock on the Professional Development Board? The Stamp itself is a BS2px. I'm also very curious as to the best way to actually connect to the clock hardware - all of the code I have seen so far reflects a 3-wire connection to the clock on the board that the PDB replaced. Unless I'm reading the datasheet wrong, I should only need 2 wires for the clock on the PDB. Is this incorrect?
Finally, is there an easy way to output the time from the clock to the 7-segment LEDs on the PDB? How about to a 2x16 LCD?
I'm researching security applications, so having access to the correct time & date is crucial.
Thanks in advance.
Jamie
--
Jamie C. Pole
Principal Consultant
J.C. Pole & Associates, Inc.
http://www.jcpa.com/
Post Edited (jcpole) : 8/31/2005 3:21:12 AM GMT
Comments
·· Jon Williams recently uploaded some code for the BS2 and BS2p for the DS1307.· I have attached it since I cannot seem to find the thread.· I hope this helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
When I run either program, pressing either button to set the hours & minutes results in both values incrementing by 1. The wiring is pretty straightforward, so I'm kinda stumped about why both buttons increment both values.
Any ideas about that?
Jamie
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--
Jamie C. Pole
Principal Consultant
J.C. Pole & Associates, Inc.
http://www.jcpa.com/
Luckily, I just happened to have a BS2px plugged into my PDB today so I've updated the demo program that was posted earlier to work with I2CIN and I2COUT (available only on BS2p-family modules).· The program runs as expected.· Note that the seconds get reset when either the minutes or hours are updated; this is easy to "fix" by removing the line that sets secs to zero.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 8/31/2005 1:05:56 PM GMT
·· Can you confirm this by moving one of the button connections to another button?· Let me know if it still does this.· If it doesn't, then move it back to the original button and see if it happens again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Now that the clock is set properly, is there a fairly simple mechanism to display the time on the 7-segment LED block, or the LCD?
I'm starting to think that I'm going to need a BS2p40 just to get enough i/o pins...
Thanks for all of your help.
Jamie
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--
Jamie C. Pole
Principal Consultant
J.C. Pole & Associates, Inc.
http://www.jcpa.com/
·· There are a few chips which can drive the 7-Segment Display from only 3 I/O pins.· The two more common ones are the MC14489, and the more expensive MAX7219.· As for I/O pins, don't fret...The BASIC Stamp I/O can be expanded very easily using simple shift registers.
·· For example, you can add 24 outputs to the BASIC Stamp for about $4.00 using 3 74HC595 ICs, and only 3 I/O pins.· If you need inputs, you can use the 74HC165.· Often the Clock and data lines can be common, so you can have 24 inputs and 24 outputs using only about 4 I/O lines.· See the StampWorks Manual, a free download in PDF format from our website for examples of this.
http://www.parallax.com/detail.asp?product_id=27220
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I ordered the chips that Chris recommended, and I'll drop back in if I have any other questions.
You guys have been great - I sincerely appreciate the help and information.
Jamie
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
--
Jamie C. Pole
Principal Consultant
J.C. Pole & Associates, Inc.
http://www.jcpa.com/
·· Don't be so modest...I was using the MAX7219 until Jon told me about the MC14489.· Here is a screenshot of Jon's code running on a Prototype·we are working on using our PDB for development.· Note that the temperature is displayed with a degrees symbol and the F.· The leading digit, when zero is automatically blanked.
Jamie,
·· Good luck with your project!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Post Edited (Chris Savage (Parallax)) : 8/31/2005 9:46:47 PM GMT
Strictly speaking that is not quite right. While the above statement applies only to the Basic Stamp family, I2C is also available to the SX28/48/52 via SX/B ???? So since the PDB services the Sx28, it is available for that, though it really isn't a stamp in that form. Oh well I guess I'm arguing semantics. But its probably not a bad idea to be reminded from time to time that as primitive as the SX/B compiler is compared to full blown PBASIC, it does have some powerful constructs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
cheers ... brian riley, n1bq, underhill center, vermont
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax