PDA

View Full Version : Need help converting 60-hour timer project for BS1 to BS2P



avm1
08-16-2005, 03:21 AM
In the Jan1996 issue of Nuts & Volts (Stamp App No.11 - Crystal Controlled Oscillator is Heartbeat of 60-Hour Timer), there is a very handy 60-hour timer project outlined for the BS1 utilizing a rotary encoder.· The·timer program is very useful for a variety of projects we have in the lab and the BS1 version works quite well.· However I think it would be·more using if converted to BS2P to take advantage of the features of the BS2P.· I converted the code from BS1 to BS2P.·Although there are a few "bugs" in the BS2P-code, it appears to·"work".· By "work", I mean that the·hours, minutes, and seconds can be set by the rotary encoder and the timing starts immediately after the seconds are set.

The major issue is the speed of the countdown - the BS1 version countdowns every second (as designed), whereas in the BS2P version, approximately 10-15 "seconds" on the timer will pass for every second - in other words, the BS2P version is counting down a great deal faster.· I know the execution speed of the BS2P is substantially faster than the BS1.· Can this discrepancy be handled programmatically or does the frequency in the oscillator circuit need to be changed to accommodate the faster execution speed of the BS2P?

Attached are 2 pdf files that may help in problem solving:· (1)·Stamp App. No. 11 containing the·circuit·and BS1 code, and (2) BS1 code converted for the BS2P.· I would greatly appreciate any help.· Thank you.

allanlane5
08-16-2005, 04:59 AM
It looks like the BS1 version is synchronized by an external 2 ticks per second clock. Thus they should both count at the same rate.

In the BS1, they're reading from an input port. In your BS2 version, you're reading from "DirectN" -- which is some variable, with "IF 1 = DirectN THEN DoTiming".

For this to work correctly, "DirectN" would have to be a VAR for IN0 (or whatever input you are using for your 'tick' source).