PDA

View Full Version : Sleeper: Serial Port and Timer (sleep or delay)



venkyhyd
08-21-2005, 07:47 PM
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

Jacob Hilderbrand
08-21-2005, 08:01 PM
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

venkyhyd
08-21-2005, 08:40 PM
One method.


Option Explicit


Thanx shall try this suggested method.

Thanks once again
venky

MOS MASTER
08-26-2005, 02:13 PM
Welcome to VBAX Venky. :hi:

I moved your question to the Excel Forum. :moosegrin

Killian
08-26-2005, 03:05 PM
Hi venky :hi:

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