
iVIEW-100 Series user’s Manual, 2006, v2.0 ----- 125
WriteNVRAM()
Func.: Write data to NVRAM.
Syntax:
int WriteNVRAM(int addr, int data);
Header: #include ”iVIEW.h”
Description:
Write one byte data to NVRAM.
addr: 0-30.
data: One byte data (0-255).
If data>255, only the low byte will be write to NVRAM.
Return Value: On success return NoError. On fail return AddrError(-9).
Example: Please refer to “ReadNVRAM()” for detail information.
GetTime()
Func.: Get the system time from the RTC.
Syntax:
void GetTime(int *hour, int *minute, int *sec);
Header: #include ”iVIEW.h”
Description:
hour: The address to save hour(0-23).
minute: The address to save minute(0-59).
sec: The address to save second(0-59).
Example:
(rtc.c)
#include <iVIEW.H>
#include <mmi100.H>
void main()
{
int year, month, day, hour, min, sec, wday;
InitLib();
SetDate(2006,1,12); /*set the system date for RTC*/
SetTime(15,35,50); /*set the system time for RTC*/
SetWeekDay(4); /*set the system weekday for RTC*/
GetDate(&year,&month,&day); /*get the system date from RTC*/
GetTime(&hour,&min,&sec); /*get the system time from RTC*/
wday=GetWeekDay();
Print("Date=%02d/%02d/%04d(%d) Time=%02d:%02d:%02d\n\r",
month,day,year,wday,hour,min,sec);
}
SetTime()
Func.: Set the system time to the RTC
Syntax:
int SetTime(int hour,int minute,int sec);
Header: #include ”iVIEW.h”
Description:
hour: 0-23.
minute: 0-59.
sec: 0-59.
Return Value: On success return NoError. On fail return TimeError(-19).
Example: Please refer to “GetTime()” for detail information.
GetDate()