Real time clock

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2007
Posts: 47
Reputation: Arctic wolf is an unknown quantity at this point 
Solved Threads: 1
Arctic wolf Arctic wolf is offline Offline
Light Poster

Real time clock

 
0
  #1
Nov 13th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,678
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 193
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: Real time clock

 
0
  #2
Nov 13th, 2008
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.
"We Americans got so tired of being thought of as dumb by the rest of the world that we went to the polls last November and removed all doubt."
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: Real time clock

 
0
  #3
Nov 14th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 47
Reputation: Arctic wolf is an unknown quantity at this point 
Solved Threads: 1
Arctic wolf Arctic wolf is offline Offline
Light Poster

Re: Real time clock

 
0
  #4
Nov 14th, 2008
In what modes can I acces it?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: Real time clock

 
0
  #5
Nov 14th, 2008
Originally Posted by Arctic wolf View Post
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?..
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 47
Reputation: Arctic wolf is an unknown quantity at this point 
Solved Threads: 1
Arctic wolf Arctic wolf is offline Offline
Light Poster

Re: Real time clock

 
0
  #6
Nov 14th, 2008
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...
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: Real time clock

 
0
  #7
Nov 14th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 275
Reputation: dougy83 is on a distinguished road 
Solved Threads: 45
dougy83 dougy83 is offline Offline
Posting Whiz in Training

Re: Real time clock

 
0
  #8
Nov 14th, 2008
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

Originally Posted by Arctic wolf View Post
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?
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 47
Reputation: Arctic wolf is an unknown quantity at this point 
Solved Threads: 1
Arctic wolf Arctic wolf is offline Offline
Light Poster

Re: Real time clock

 
0
  #9
Nov 15th, 2008
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...
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 670
Reputation: Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough 
Solved Threads: 113
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Practically a Master Poster

Re: Real time clock

 
0
  #10
Nov 15th, 2008
could you not use a Hardware clock to do the timing for you?

Chris
Knowledge is power -- But experience is everything
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC