943,668 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 5700
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Nov 13th, 2008
0

Real time clock

Expand Post »
Hello everyone,
I know there is a build in real time clock inside the computer
and I know it's possible to use this clock when you write a program on Assembler(using an interupt that I don't remember at the moment),is there a way to use the real time clock
while programing on VC++ ?
(I use VC++ 6.0 with the 6th service pack instaled)


Andrei
Similar Threads
Reputation Points: 15
Solved Threads: 1
Light Poster
Arctic wolf is offline Offline
47 posts
since Jul 2007
Nov 13th, 2008
0

Re: Real time clock

Yes, you get clock functionality from library <ctime> (or maybe it's still <time.h> in VC++ 6)
See here for a quick reference.

Check your MSDN help information in VC++ for what's actually supported in that compiler.

Consider moving into the 21st century with newer versions. VC++ 2008 Express is a freebie.
Reputation Points: 1268
Solved Threads: 228
Posting Virtuoso
vmanes is offline Offline
1,895 posts
since Aug 2007
Nov 14th, 2008
0

Re: Real time clock

Regrettably, all <ctime/time.h> stuff does not bear a relation to the computer Real Time Clock device. Moreover, you can't directly access RTC in standard Windows user mode.
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Nov 14th, 2008
0

Re: Real time clock

In what modes can I acces it?
Reputation Points: 15
Solved Threads: 1
Light Poster
Arctic wolf is offline Offline
47 posts
since Jul 2007
Nov 14th, 2008
0

Re: Real time clock

In what modes can I acces it?
I think partially on device driver level or lower (HAL).

Did you need so low level really? The Windows without (as usually third-party and commercial) special software is not a real-time system. Your programs have no direct access to ALL hardware (except CPU in user mode ) on Windows installations. Didn't you know that?

Why you need RTC direct access? May be Windows API or even RTL stuff is enough for your task?..
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Nov 14th, 2008
0

Re: Real time clock

Well, ofcourse I know that from win 2000 and upwards the acces to the ports is blocked,
but I have a driver that opens the access(and I already tested it many times while working with the parallel port),so I do have access to the hardware.
I need a real time clock to generate accurate PWM for a robot...
Reputation Points: 15
Solved Threads: 1
Light Poster
Arctic wolf is offline Offline
47 posts
since Jul 2007
Nov 14th, 2008
0

Re: Real time clock

It's not a true RTC access (even with RTC driver) because Windows threads sheduling adds unpredictable delays for your robot control process irrespective of its priority.
That's why Windows is not RT system...
Last edited by ArkM; Nov 14th, 2008 at 5:15 pm.
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Nov 14th, 2008
0

Re: Real time clock

For hi-res timers, you may want to have a look at the following (100us timer period):
http://www.codeproject.com/KB/system...imeModule.aspx

I need a real time clock to generate accurate PWM for a robot...
What's the frequency of the PWM? Are you interfacing to RC servos?
Reputation Points: 85
Solved Threads: 45
Posting Whiz in Training
dougy83 is offline Offline
275 posts
since Jun 2007
Nov 15th, 2008
0

Re: Real time clock

Ok,first of all I want to thank everyone for their help,thanks everyone!

Now,dougey83, thank you for the program,did you try it? How accurate is it?
How much windows distortes the timers accuracy?(oh,and this time I use an H-bridge and regular DC motors,not servos,if it's possible I want to generate PWM with frequancies of 1 to few Khz).
ArkM,you didn't pay attention,I said a driver that gives me access to ports(in other words,it allows me to access hardware),not a RTC driver...
Reputation Points: 15
Solved Threads: 1
Light Poster
Arctic wolf is offline Offline
47 posts
since Jul 2007
Nov 15th, 2008
0

Re: Real time clock

could you not use a Hardware clock to do the timing for you?

Chris
Reputation Points: 325
Solved Threads: 118
Master Poster
Freaky_Chris is offline Offline
702 posts
since Apr 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Homework - Array/Functions
Next Thread in C++ Forum Timeline: Matrix of string





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC