User`s manual

PK220050 s Software Reference
Software Drivers
Drivers are functions that simplify accessing PK2200 hardware and I/O.
For the following reasons, Z-World drivers make writing software easier:
Provide commonly needed functionality.
Eliminate the need to know all of the details of operation.
Previously tested.
Simplify source code by replacing multiple lines of code with one
function call.
Refer to the Dynamic C Technical Reference Manual for
more information on using drivers.
Real Time Clock (RTC)
The RTC keeps the date and the time of day with a resolution of one
second. The worst case error is 50ppm (4.3 seconds) per day. Leap years
and variances in the number of days in a month are automatically tracked.
The following structure holds the time and date:
struct tm {
char tm
_
sec; // 0-59
char tm
_
min; // 0-59
char tm
_
hour; // 0-23
char tm
_
mday; // 1-31
char tm
_
mon; // 1-12
char tm
_
year; // 0-150 (1900-2050)
char tm
_
wday; // 0-6 where 0 means Sunday
};
The following routines read and write to the real-time clock:
int tm
_
wr( struct tm *x )
Sets the system time to the values in the structure pointed to by *x.
PARAMETER1: Pointer to the structure holding the system time
information to be written.
RETURN VALUE: 0 if successful; -1 if clock failing or not installed.
int tm
_
rd( struct tm *t )
Reads the current system time into the structure t.
PARAMETER1: Pointer to the structure used to store the system time.
RETURN VALUE: 0 if successful; -1 if clock failing or not installed.
$