Consulting

Results 1 to 5 of 5

Thread: Sleeper: Serial Port and Timer (sleep or delay)

  1. #1
    VBAX Newbie
    Joined
    Aug 2005
    Posts
    5
    Location

    Sleeper: Serial Port and Timer (sleep or delay)

    Hi ! ! !

    I am new to VBA and to this forum as well. I am stuck with some probs in my VBA with Excel based application. Here I have got a requirement where in should open a serial port and keep sending the data continuously, for every 1 sec or more. I am able to open the port but unable to find proper help on sending data in intervals, like setting the Sleep or delay times. Hope I can get some guidance in achieving my task.

    Thanks in advance
    venky

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    One method.

    Option Explicit
     
    Sub Macro1()
    Dim MyTimer         As Double
    MsgBox "Step 1"
        MyTimer = Timer
        Do
        Loop Until Timer - MyTimer > 1
    MsgBox "Step 2"
        MyTimer = Timer
        Do
        Loop Until Timer - MyTimer > 1
    MsgBox "Step 3"
        MyTimer = Timer
        Do
        Loop Until Timer - MyTimer > 1
    End Sub

  3. #3
    VBAX Newbie
    Joined
    Aug 2005
    Posts
    5
    Location
    Quote Originally Posted by DRJ
    One method.

    Option Explicit
    Thanx shall try this suggested method.

    Thanks once again
    venky

  4. #4
    Administrator
    VP-Knowledge Base VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Welcome to VBAX Venky.

    I moved your question to the Excel Forum.
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  5. #5
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Hi venky

    I did a similar thing once to read in data from a GPS using a couple of WinAPI functions to set up an accutare timer. I've attached a file with the basis of the code I used for it. Hope it helps
    K :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •