Complete Spin Code for DS1302 RTC
SEL
Posts: 80
This all started when I reported that the DS1302 was gaining time.
Well, the problem turn out to be the crystal Parallax sent me. They got a wrong order from their supplier.
The CL on those crystals was not 6pf.
Chris S. gave us a Digi-Key Part Number and I ordered the correct crystal from them and all is WELL! (Part Num: SER3205-ND)
The discussion we all had lead to some great coding and I wish to share my project with you.
The code has been tested and it's good to go!
Many thanks to BR, Chris and Beau.
Enjoy the attached code file.
SEL
Well, the problem turn out to be the crystal Parallax sent me. They got a wrong order from their supplier.
The CL on those crystals was not 6pf.
Chris S. gave us a Digi-Key Part Number and I ordered the correct crystal from them and all is WELL! (Part Num: SER3205-ND)
The discussion we all had lead to some great coding and I wish to share my project with you.
The code has been tested and it's good to go!
Many thanks to BR, Chris and Beau.
Enjoy the attached code file.
SEL
Comments
I suspect it is on your end. I just clicked on the link below and opened it up. It seems to be alright.
SEL
@SEL: glad this worked out for you. I learned a few things in the process, too. Good stuff.
@anyoneInterested: if you're following along at home, here's the genesis of this thread:
DS1302 learnings
LCD menu system learnings
I am glad you liked the code. You are a big part of it!!
SEL
I thought that I would need to learn assembly to interface serially with the DS1302 because of timing. From looking at your code, it looks like the exact timing isn't really important? You simply modulate the clock signal when you are ready to send or receive a bit, and you can do that at any speed? Or even a speed that isn't deterministic and changes during communication? Am I right about this?
Also, I notice you do something like this:
outa[x] := %01010101
What would pin x's output state be in this case? 0 or 1? Looks like it would be 1 if I am reading the intention of your code correctly. This isn't documented in the propeller manual but it seems pretty useful in cases similar to how you used it... for using a repeat loop to send a single bit out of a byte and them moving on to the next one.
Thanks,
Shaun
Am I right about this?
Yes. I wrote my own driver for the DS1302 and the timing is sloppy but it still works. I believe that I stayed within the specs on the data sheet.
What would pin x's output state be in this case? 0 or 1?
I stopped being lazy and tested this. The answer is 1.
-Shaun