How can a person figure out a true second without using a external clock
Markdahplumber
Posts: 7
Hello I am using a 4 digit display and was wondering if there is a way to get my code to read as close to a second as possible with using only the BS2 and not any other source because it doesn't have to be perfect but would be nice to get somewhat close
and I am only counting seconds for now up to 9999
I know the BS2 has a certain time for a instruction but my question is how does a instruction work in a branch or gosub
example:
start:
gosub time
goto start
time:
debug cls
return <
the total loop for this code in my eyes is 6 instructions so will it be BS2 instruction time X 6 = time?
and I am only counting seconds for now up to 9999
I know the BS2 has a certain time for a instruction but my question is how does a instruction work in a branch or gosub
example:
start:
gosub time
goto start
time:
debug cls
return <
the total loop for this code in my eyes is 6 instructions so will it be BS2 instruction time X 6 = time?
Comments
Here's one RTC on a little breakout board that should be easy to interface to using the SHIFTOUT and SHIFTIN statements and 3 I/O pins.
I was doing trial and error but couldn't get it quite close enough and thought maybe you professionals would know a little trick but then again
it would seem impossible to get it with out external source but I have it down to only 12 seconds off in 3 hours so not bad for a rookie
plus this experiment is not going anywhere but just learning different things
thanks again
The Propeller has direct access to a count of the system clock which is usually 80MHz. It's pretty trivial to execute a section of code once a second with accuracy as good as the crystal.
Also see page 97 of:
http://www.parallax.com/Portals/0/Downloads/appnt/stamps/bs1Appnotes.pdf
cheers, David
I'm sure you can get "somewhat close" with nothing but a BS2 and a carefully calibrated loop. Might be voltage/temp dependant, but reasonable. Have you built your hardware displays yet, are they working?
I used this circuit as part of a frequency counter with a 4.194304 MHz crystal, worked fine.