Hello All,
I am a non coder who wrote some horrible code the other day for my PICAXE 28X & serial LCD project which needed to roughly know when 2 minutes and 10 minutes expired according to a “high” on some of the inputs. I noticed that the old PICAXE 28X I have, has no timer function.(?) Timing is really not that critical so I just incremented a counter every 250 milliseconds with PAUSE 250. Example, it went something like this.... (you all know this!)
Start:
Counter = Counter + 1
Pause 250
(other code)
Goto Start
So, 4 counts per second. Then at 480 counts (2min) and 2400 counts (10min) the program goes and does what it needs to do. In the end I timed the program verses a stop watch and to my surprise, it appears the program executed about 30 seconds short of 2 minutes and 2.5 minutes short of 10 minutes! Well well! I’m not a math wiz but there possibly seems to be some sort of ratio here. Anyway, I started to adjust the “count” figures but decided not to as 480 & 2400 represented the “seconds”. So I changed the “timebase” or “clock” as you might say??? Anyway, I had to adjust the PAUSE to 264 (milliseconds) for the program to pretty much execute spot on 2 minutes and 10 minutes. I would of thought I would have had to adjust the PAUSE below 250. Possibly to 240 or 245 to compensate for execution times, overhead processing or somethig there of etc. etc. I guess not?
All this dribbling on to ask a couple question.
Question: Why is this? Is the problem (not really a problem for me) with the onboard internal 4Mhz. oscillator? If so, then the frequency might be higher then 4Mhz.??? Is the frequency way out or just a few cycles?
All in all, it's not raeally a problem. Just curiosity.
"The Addict"
I am a non coder who wrote some horrible code the other day for my PICAXE 28X & serial LCD project which needed to roughly know when 2 minutes and 10 minutes expired according to a “high” on some of the inputs. I noticed that the old PICAXE 28X I have, has no timer function.(?) Timing is really not that critical so I just incremented a counter every 250 milliseconds with PAUSE 250. Example, it went something like this.... (you all know this!)
Start:
Counter = Counter + 1
Pause 250
(other code)
Goto Start
So, 4 counts per second. Then at 480 counts (2min) and 2400 counts (10min) the program goes and does what it needs to do. In the end I timed the program verses a stop watch and to my surprise, it appears the program executed about 30 seconds short of 2 minutes and 2.5 minutes short of 10 minutes! Well well! I’m not a math wiz but there possibly seems to be some sort of ratio here. Anyway, I started to adjust the “count” figures but decided not to as 480 & 2400 represented the “seconds”. So I changed the “timebase” or “clock” as you might say??? Anyway, I had to adjust the PAUSE to 264 (milliseconds) for the program to pretty much execute spot on 2 minutes and 10 minutes. I would of thought I would have had to adjust the PAUSE below 250. Possibly to 240 or 245 to compensate for execution times, overhead processing or somethig there of etc. etc. I guess not?
All this dribbling on to ask a couple question.
Question: Why is this? Is the problem (not really a problem for me) with the onboard internal 4Mhz. oscillator? If so, then the frequency might be higher then 4Mhz.??? Is the frequency way out or just a few cycles?
All in all, it's not raeally a problem. Just curiosity.
"The Addict"