Shop OBEX P1 Docs P2 Docs Learn Events
Timer with Rev. D — Parallax Forums

Timer with Rev. D

Dr.NoDr.No Posts: 60
edited 2008-03-31 17:42 in BASIC Stamp
Using the Basic Stamp Rev. D

For X = 1 to Y

process = do nothing

next


if Y = 1000, how long is that in seconds?
I'm trying to get close to 1 second but it doesn't have to be precise.
I'm not sure how large Y can be either. 65536?

Thanks

roll.gif

Comments

  • Dr.NoDr.No Posts: 60
    edited 2008-03-31 15:25
    Okay, I've read where a....

    Pause 5000

    equates to 5 seconds. Can I take it then that a
    pause would not cut power to the pins or will it?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-31 15:33
    1) Any word value in Stamp Basic can be up to 65535

    2) PAUSE does not change the I/O pins. The statements that cause problems with that are NAP and SLEEP

    3) You'll have to measure the loop time yourself. EME Systems' website (www.emesystems.com) has some information on Stamp statement execution time, but it depends on the details of the statements involved.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-03-31 17:02
    Brute Force:

    FOR I = 1 to 10
    Pause 100
    NEXT

    Since the "Pause" value is in milliseconds, doing 10 'pauses' of 100 milliseconds each gets you one second.
    You might "tweak" this a little -- the 'For' and the 'Next" take around 1/2 millisecond each.

    And I'll verify that a "pause" holds the output values of the pins, yes.
  • Dr.NoDr.No Posts: 60
    edited 2008-03-31 17:42
    Thanks Mike & Allan.

    I think the Pause statement should work just fine.
    I just need each routine to get the same shared time
    without the pins turning off.
    So if it's off by a millisecond it wouldn't matter.

    Thanks again.
Sign In or Register to comment.