Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Tick Timer for ZBasic

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
zbasicandy



Joined: 26 Jan 2006
Posts: 193

Posted: 27 February 2006, 21:25 PM    Post subject: Tick Timer for ZBasic Reply with quote

I have some time critical software I need to know how long the task(s) takes - lets say in usec. Being a Rabbit user, they had a tick timer you set
between statements and it would indicate the cpu time it took process the instructions. Is that possible in ZBasic? Question
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 28 February 2006, 0:32 AM    Post subject: Reply with quote

Perhaps not as simply as with the Rabbit but you can do some timing. Depending on the duration of the instructions being timed you may be able to use Register.RTCStopWatch which has a resolution of 1.95mS. The nice thing about this register is that you can set it to zero and then read it later to determine the elapsed time without having to deal with RTC roll over.

If you need higher resolution, you can program Timer1 to get a resolution as low as 67.8nS. If you take that route, however, you'll have to avoid using the several System Library routines that need to use Timer1.

You can also get higher resolution by using Register.TCNT0 in conjunction with Register.RTCFastTick. Register.TCNT0 changes at the rate of 230.4KHz and rolls over from 224 to zero 1024 times per second. Each time it rolls over, Register.RTCFastTick is incremented and every two times, Register.RTCTick is incremented.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group