Could someone post some sample code using RTC_GetTicks? I can't figure out how to use it.
Are the programs in the archives not sufficient?
RTC Example by AHelper
Clock by AHelper probably has some code in it that could help.
Some of the games might have some stuff in there. Have you dug around in existing code samples?
RTC_GetTicks returns the value of the RTC counter. This counter is initialized every days at 00:00, and is incremented every 1/128 seconds.

If you want to do an action every 500ms, use a var to save the value of RTC_GetTicks when the action was did last time, and compare it with the actuel value. :

Code:
int main() {
   int time = 0; //initialization is important
   while(1) {
      if(RTC_GetTicks() - time >= 64) {
         //do something every half seconds
         time = RTC_GetTicks();
      }
   }
   return 1;
}
Thanks both of you. I didn't see the examples merth showed, but I just downloaded them and they are helpful.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement