How to make a precision timer in STAMP?
lee_hanc
Posts: 4
Hi,
I'm new in STAMP. I have a project that need a timer like a stopwatch and need to be precise as 0.1 ms. Like a timer, I set a time and then turn on. Whatever the program run, when the time is reaching the value that I set, I need to interrupt my program and know the time is out. Does anyone can help me for this? If I need another IC or stuff, what kind of stuff that I need to connect to STAMP? Thank u so much for the help
I'm new in STAMP. I have a project that need a timer like a stopwatch and need to be precise as 0.1 ms. Like a timer, I set a time and then turn on. Whatever the program run, when the time is reaching the value that I set, I need to interrupt my program and know the time is out. Does anyone can help me for this? If I need another IC or stuff, what kind of stuff that I need to connect to STAMP? Thank u so much for the help
Comments
The Propeller could do this easily though, just not a Stamp. Even if you had an external timer with the sort of accuracy you want, the Stamp couldn't react to the end of the time interval fast enough to be useful for you.
What are you trying to do?
for an example, I want to change my voltage (using DAC) every 10 ms without affected by the length of the programming code, just as below:
voltage_scan:
Timer = 1 ' starting the timer 10 ms
programming code ' there will be some code here
... ' which I don't need to know
... ' how long it will take,
... ' but surely less than 10ms
wait: ' wait for the timer to reach 10 ms
IF Timer =10ms THEN ' ex: if the code take 8ms, then
GOTO voltage_scan ' it just need to wait for 2 ms
ELSE
GOTO wait
ENDIF
does stamp able to do something like this? do you have any suggestion for my application like this? Btw, does propeller much more advanced than stamp could do? Thanks
The Propeller is much faster and has a very precise built-in clock that programs can use to create delays (resolution on the order of 10ns).