Time counter with basic stamp.
tilemachos
Posts: 2
hello!!
I want to use my basic stamp to make a counter-clock with nanosec accuracy. Without an lcd, in a debug home. Can i have this accuracy? What about the code? Should i use "rctime"; What about pulsout and freqout? Is there a way to take nanosecond-measurements?
Any ideas?
Thanks a lot.
I want to use my basic stamp to make a counter-clock with nanosec accuracy. Without an lcd, in a debug home. Can i have this accuracy? What about the code? Should i use "rctime"; What about pulsout and freqout? Is there a way to take nanosecond-measurements?
Any ideas?
Thanks a lot.
Comments
That's not fast enough by a couple of orders of magnitude. I think you're going to need to use some other controller.
1 nanosecond = 1/1,000,000,000 seconds = .000000001 seconds, right?
1/32,000,000 = .00000003125 seconds, or 32 nanoseconds. Even if your instructions took only a single clock cycle and you only needed one instruction to make the count*, 32 nanoseconds would pass between counts.
Now since I said that, someone else will probably show up with a way to do it.
* Neither of which is even remotely reasonable to assume. Each PBasic instruction (with the possible exceptions of WAIT and maybe a couple others) compiles to several machine-level instructions, and I think that each machine-level instruction takes several clock cycles to perform. As I understand it, that's why a chip running at 32 MHz only performs something like 19,000 instructions/second.
Post Edited (sylvie369) : 1/11/2009 3:50:08 PM GMT
Both of them are very helpful.
To be honest with you, its possible that an accuracy of 10^-8 will be fine for my experiment so i would like to try it.
Propably i ll use another microcontroller in the end, but now i would like to make some experiments with my bs2.
I know that there is not so fast but i want to do it just for the experience, and to know how to continue with the others.
So, can you give me some advice about the code i need to do something like this? Should i use the "pulsout" ? How?
thanks again.
Post Edited (tilemachos) : 1/11/2009 6:41:12 PM GMT