ts-7000
[Top] [All Lists]

[ts-7000] Re:TS7250 ..RTC

To:
Subject: [ts-7000] Re:TS7250 ..RTC
From: "PeterElliot" <>
Date: Wed, 27 Dec 2006 14:28:27 -0000
Hi Laks,

I use the standard C time function to read the current time, and use 
a system call at the start of my program to sync the internal clock 
to the RTC.

printf("..Syncing time with RTC\n");
system("hwclock --hctosys");

An example of reading the time would be:

void TimeStampMenu(int Military) {
  int hour,min,month;
  char stringbuffer[32];

  time_t now;
  struct tm     *TimeNow;

  time(&now);
  TimeNow=localtime(&now);

  hour  = TimeNow->tm_hour;
  min   = TimeNow->tm_min;
  month = (TimeNow->tm_mon)+1;  
        
  if ((month<4) || (month>10)) hour-=5;
  else hour-=4;
        
  if (hour<0) hour+=24;
  if (Military) sprintf(stringbuffer,"%d:%02d",hour,min);
  else if (hour==0) sprintf(stringbuffer,"12:%02d AM",min);
  else if (hour==12) sprintf(stringbuffer,"12:%02d PM",min);
  else if (hour<12) sprintf(stringbuffer,"%d:%02d AM",hour,min);
  else sprintf(stringbuffer,"%d:%02d PM",(hour-12),min);
  
  while ((VGAregs[_vVIDCTRL] & 0x400)!=0);  // Wait for last BitBlt 
to finish.              
  Font_String(24,stringbuffer,VGAxy((_scrW-2),4),cWhite,_hTRight);
}                             
 
Hope this helps,

PJE


--- In  "Laks" <> wrote:
>
> Hi 
> how can i use the hwclock in my c source code?
> i need the time for my smart card reader which i am designing using 
the arm board
> 
> can i use the RTC base addr 0x1080_0000 as a pointer to access the 
rtc registers and its memory contents?
> being a memory mapped device will it work?
> 
> some of the sample codes i have seen mmap command to map the LCD / 
ADC etc.,
> 
> is it neceesary i have to use mmap to access the memory devices?
> 
> -laks




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU