Elapsed Timer Demo ..Need help.. Clock dose not always restart after removing p
Here is where I start this post
I want to Thank Beau Schwabe·for helping with idea and getting this project off the ground
http://forums.parallax.com/showthread.php?p=737243
Here is what I have so far and it work but what happen is that when you put power to pin # 2 the clock stop like it should
But the clock dose not alway restart·when you remove··power·from pin # 2 if you power pin again and remove· then it will restart
The second stay where they left off but when it dose not restart you will see 89 , 99 or something like that
I have a 10k ohm rest from pin 2 to vss and from pin 2 a 220· ohm rest to vdd when powering pin 2
What do I need to add to·fix this problem
main:
DO· WHILE· IN2 = 0
· GOSUB Get_Time
· DEBUG HOME, HEX2 mins, ":", HEX2 secs
· LOOP
· DO WHILE IN2 = 1
· reg = $81·········································· ·' Point to register 81h
GOSUB RTC_In····································· ·' Receive Command
ioByte = ioByte - 128····························· ' Clear Clock Halt Bit
secs = ioByte········································' Store elapsed Seconds value
reg = $80··········································· ·' Point to register 80h
GOSUB RTC_Out·································· ·' Send Command
reg = $82··········································· ·' Point to register 82h
GOSUB RTC_In···································· ·' Receive Command
mins = ioByte······································ ' Store elapsed Minutes value
reg = $84········································· ·' Point to register 84h
GOSUB RTC_In·································· ·' Receive Command
hrs = ioByte·······································' Store elapsed Hours value
LOOP
·reg = $80······································· ' Point to register 80h
ioByte = secs + 128·························· ' Set Clock Halt Bit
GOSUB RTC_Out······························· ' Send Command
GOSUB· main
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 7/15/2008 6:44:14 PM GMT
I want to Thank Beau Schwabe·for helping with idea and getting this project off the ground
http://forums.parallax.com/showthread.php?p=737243
Here is what I have so far and it work but what happen is that when you put power to pin # 2 the clock stop like it should
But the clock dose not alway restart·when you remove··power·from pin # 2 if you power pin again and remove· then it will restart
The second stay where they left off but when it dose not restart you will see 89 , 99 or something like that
I have a 10k ohm rest from pin 2 to vss and from pin 2 a 220· ohm rest to vdd when powering pin 2
What do I need to add to·fix this problem
main:
DO· WHILE· IN2 = 0
· GOSUB Get_Time
· DEBUG HOME, HEX2 mins, ":", HEX2 secs
· LOOP
· DO WHILE IN2 = 1
· reg = $81·········································· ·' Point to register 81h
GOSUB RTC_In····································· ·' Receive Command
ioByte = ioByte - 128····························· ' Clear Clock Halt Bit
secs = ioByte········································' Store elapsed Seconds value
reg = $80··········································· ·' Point to register 80h
GOSUB RTC_Out·································· ·' Send Command
reg = $82··········································· ·' Point to register 82h
GOSUB RTC_In···································· ·' Receive Command
mins = ioByte······································ ' Store elapsed Minutes value
reg = $84········································· ·' Point to register 84h
GOSUB RTC_In·································· ·' Receive Command
hrs = ioByte·······································' Store elapsed Hours value
LOOP
·reg = $80······································· ' Point to register 80h
ioByte = secs + 128·························· ' Set Clock Halt Bit
GOSUB RTC_Out······························· ' Send Command
GOSUB· main
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·

·
·
·
·
Sam
Post Edited (sam_sam_sam) : 7/15/2008 6:44:14 PM GMT
Comments
·
By adding any additional circuitry to X1 and X2·assigned to the crystal, you negate any kind of accuracy the crystal was able to provide.· The connection to the crystal is very particular and any added capacitance can slow down or kill the oscillator.
·
That said, I don't think that is what you are experiencing...· by placing power on the X1 pin you force the internal oscillator inverter to stay in one state, thus stopping the clock.· When you remove that condition, the oscillator will sometimes start,·most likely because of a noisy condition on your reset switch.· If the noise on the switch is relatively clean however, the oscillator won't start, because the crystal has lost it energy momentum and it can't override the 10k pull-down that's still on the input (X1)·of the oscillator.
·
If·you must "gate" the crystal input like this, I would get rid of the resistor divider scheme, and use an open-collector transistor configuration that pulls X1 to ground and keep the leads as short as·possible from the transistor collector to X1.
·
·
Edit:
sam_sam_sam,
I think I completely misread your post... I thought you were putting power to pin #2 on the RTC.
I can't offer any advice, other than are you sure you are connected to the 3rd input on the BS2 and not the 2nd ... IN0, IN1, IN2
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 7/15/2008 4:15:58 PM GMT
·
I I can't offer any advice, other than are you sure you are connected to the 3rd input on the BS2 and not the 2nd ... IN0, IN1, IN2
I should have made it more clear than·I did·
I am using·IN2 on the Basic Stamp
I have a 10k ohm rest from··I\O pin 2 to vss and from· ·I\O·2 pin·a 220· ohm rest to vdd when powering·I\O pin on # 2 on the Basic Stamp
·Now if i do not use this part in the routine them the clock will start every time·with·no problem except the second start over·
Now I could use that way and just have a counter that counts how many starts there are but this would be my second choice
·
·reg = $80······································· ' Point to register 80h
ioByte = secs + 128·························· ' Set Clock Halt Bit
GOSUB RTC_Out······························· ' Send Command
Is there a way to fix this part of the routine or add some thing to it ··
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Ahhh! Try OR'ing the 'secs' with 128... if the seconds already have 128 added (i.e. the bit set), then you don't want to do it again...
Likewise for similar reasons, where you have this...
...use this instead...
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 7/15/2008 4:52:49 PM GMT
By adding this· secs = 30
reg = $80·················· ·' Point to register 80h
ioByte = %0110000····· ·' starts the clock by clearing the Clock Halt bit
·································' and·sets the·Seconds to "30"
GOSUB RTC_Out·········· ·' Send Command
·······························instead of· %0000000 which·resets· seconds· to = 00
DO
· GOSUB Get_Time
·· DEBUG HOME, HEX2 day, " DAY···· ",· HEX2 hrs, " HRs····· ",
························· HEX2 mins, " MINs····· ", HEX2 secs, " secs "
· INPUT 2····································· ·' Make P2 an input
· DEBUG· CR, CR, "State of P2: ",
······· BIN1 IN2, CR
·LOOP UNTIL IN2 = 1
·DO
·reg = $80··································· ·' Point to register 80h
ioByte = %10000000····················· ·' Set Clock Halt Bit
GOSUB RTC_Out·························· · ' Send Command
LOOP UNTIL IN2 = 0
reg = $80··································· ·' Point to register 80h
ioByte = %0110000······················ ·'·starts the clock by clearing·
················································· '·the·Clock·Halt bit and clears
··················································'·the·Second to"00"
GOSUB RTC_Out························· ·' Send Command
GOTO· main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 7/16/2008 11:29:36 AM GMT