Search the web
Sign In
New User? Sign Up
nsbasic-desktop · Forum for NS Basic/Desktop users
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Looking for improved Timer to use with NSbasic   Message List  
Reply | Forward Message #3091 of 3238 |
Hi,
I have sucessfully been using the NSbasic win32 timer to change the state of the
DTR pin on an RS232 port which is connected to a relay Im operating at an
interval of approx 300ms, with a delay (on time) of approx 20ms...

Sub MyTimer_Interval()
objport.DTR = True
Sleep 20
objport.DTR = False
End Sub

I have been measuring the timing using a scope. The sleep delay is quite
accurate to a ms (millisecond) (thats great!). But the timer accuracy between
events is about +/- 10ms or worse.

I've managed to get the timegettime function operating using
Declare "Function timeGetTime Lib ""winmm.dll"" () As Long"
And the time intervals Im measuring on my scope closely match the timegettime
difference Im calculating in the software between intervals indicating the
timegettime has pretty good accuracy.

Could someone advise me how I might use the timegettime function to trigger an
interval event?

Regards,
Justin






Mon Jul 20, 2009 9:21 am

justinanning
Offline Offline
Send Email Send Email

Forward
Message #3091 of 3238 |
Expand Messages Author Sort by Date

Hi, I have sucessfully been using the NSbasic win32 timer to change the state of the DTR pin on an RS232 port which is connected to a relay Im operating at an...
justinanning
Offline Send Email
Jul 20, 2009
9:21 am

Have you looked at the .Timer property of intrinsic controls? myLabel.Timer = 500 'send an event in half a second Sub myLabel_Timer 'This sub gets called when...
George Henne
ghenne
Offline Send Email
Jul 20, 2009
4:28 pm

Just tried the .timer intrinsic property with same +/-10ms result. Any other suggestions? Is there a neat trick way I could generate my own event using the...
justinanning
Offline Send Email
Jul 20, 2009
11:07 pm

I don't think Windows guarantees real time accuracy in its events - it takes a special kind of OS to do this....
George Henne
ghenne
Offline Send Email
Jul 21, 2009
6:53 am

Its actually the improved precision that I'm after before I get told off! I understand windows doesnt guarentee realtime accuracy - but from reading the gaming...
justinanning
Offline Send Email
Jul 21, 2009
8:35 am

Hello Justin, I think you're looking at 2 different things. In your example, you're checking the system clock after every cycle of your loop, so the accuracy...
Thomas Gruber
computerhusky
Offline Send Email
Jul 21, 2009
10:11 am

Hi Thomas et al, As I was measuring my timed trigger with an independent oscilliscope, I was operating independent of the computer clock and was only really...
justinanning
Offline Send Email
Jul 22, 2009
12:48 am

Would this GetRef help? It's built into NS Basic: <http://www.w3schools.com/vbScript/func_getref.asp>...
George Henne
ghenne
Offline Send Email
Jul 22, 2009
6:52 am

GetRef did not seem to work - Incidently I was wrong when I said I could not get the intrinsic timer to glitch when loading up the processor - The only thing...
justinanning
Offline Send Email
Jul 22, 2009
6:49 pm

Got it working on a CE device as an afterthought which apparently is a "realtime OS". Now getting timer event resolution with +/- 1ms error Thanks for your...
justinanning
Offline Send Email
Jul 22, 2009
9:51 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help