PIC18 LaurTec Library
3.1
Open Source C Library for PIC18 Microcontrollers based on C18 - XC8 Compilers
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
PCF8563.h
Go to the documentation of this file.
1
2
/*******************************************************************************
3
4
Author : Mauro Laurenti
5
Version : 1.1
6
Created on Date : 4/9/2006
7
Last update : 25/01/2013
8
9
CopyRight 2006-2013 all rights are reserved
10
11
********************************************************
12
SOFTWARE LICENSE AGREEMENT
13
********************************************************
14
15
The usage of the supplied software imply the acceptance of the following license.
16
17
The software supplied herewith by Mauro Laurenti (the Author) is intended for
18
use solely and exclusively on Microchip PIC Microcontroller (registered mark).
19
The software is owned by the Author, and is protected under applicable
20
copyright laws. All rights are reserved.
21
Any use in violation of the foregoing restrictions may subject the
22
user to criminal sanctions under applicable laws, as well as to civil liability
23
for the breach of the terms and conditions of this license.
24
Commercial use is forbidden without a written acknowledgment with the Author.
25
Personal or educational use is allowed if the application containing the
26
following software doesn't aim to commercial use or monetary earning of any kind.
27
28
THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
29
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
30
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
31
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE AUTHOR SHALL NOT,
32
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
33
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
34
35
********************************************************
36
PURPOSES
37
********************************************************
38
39
This libary supports the Real Time Clock Calendar PCF8563 or compatible
40
devices
41
42
******************************************************************************/
43
44
45
46
#ifndef PCF8563_H
47
#define PCF8563_H
48
49
#ifdef __XC8
50
#include <xc.h>
51
#ifndef _PIC18
52
#error "The PCF8563 Library supports only PIC18 devices"
53
#endif
54
#endif
55
56
#ifdef __18CXX
57
#include <i2c.h>
58
#endif
59
60
61
//**************************************************
62
// you must change this address if
63
// you change the device.
64
//**************************************************
65
66
#define WRITE_ADD 0xA2
67
68
//**************************************************
69
// Definition of Day constants (Italian, English)
70
//**************************************************
71
72
// Italian
73
#define DO 0x00
74
#define LU 0x01
75
#define MA 0x02
76
#define ME 0x03
77
#define GI 0x04
78
#define VE 0x05
79
#define SA 0x06
80
81
// English
82
#define SU 0x00
83
#define MO 0x01
84
#define TU 0x02
85
#define WE 0x03
86
#define TR 0x04
87
#define FR 0x05
88
#define SA 0x06
89
90
91
92
//**************************************************
93
// Standard Constant
94
// enable value for the allarm bit (day,month,dayweek)
95
//**************************************************
96
97
#define ENABLE_ON 0b00000000
98
#define ENABLE_OFF 0b10000000
99
100
101
//**************************************************
102
// Address constants
103
//**************************************************
104
105
#define CONTROL_REG_2_ADDR 0x01
106
#define SECONDS_ADDR 0x02
107
#define MINUTES_ADDR 0x03
108
#define HOURS_ADDR 0x04
109
#define DAYS_ADDR 0x05
110
#define DAY_WEEK_ADDR 0x06
111
#define MONTHS_ADDR 0x07
112
#define YEARS_ADDR 0x08
113
#define MINUTS_ALARM_ADDR 0x09
114
#define HOURS_ALARM_ADDR 0x0A
115
#define DAYS_ALARM_ADDR 0x0B
116
#define DAY_WEEK_ALARM_ADDR 0x0C
117
118
119
//**************************************************
120
// Limits constants
121
//**************************************************
122
#define MAX_MINUTES 0x60
123
#define MAX_HOURS 0x24
124
#define MAX_YEARS 0xA0
125
#define MAX_MONTHS 0x13
126
#define MAX_DAYS 0x32
127
128
141
signed
char
set_seconds_RTCC
(
unsigned
char
seconds);
142
143
151
unsigned
char
get_seconds_RTCC
(
void
);
152
153
166
signed
char
set_minutes_RTCC
(
unsigned
char
minutes);
167
168
176
unsigned
char
get_minutes_RTCC
(
void
);
177
178
191
signed
char
set_hours_RTCC
(
unsigned
char
hours);
192
193
201
unsigned
char
get_hours_RTCC
(
void
);
202
203
210
unsigned
char
*
get_time_seconds_RTCC
(
void
);
211
212
219
unsigned
char
*
get_time_RTCC
(
void
);
220
221
234
signed
char
set_days_RTCC
(
unsigned
char
days);
235
236
244
unsigned
char
get_days_RTCC
(
void
);
245
246
260
signed
char
set_day_of_the_week_RTCC
(
unsigned
char
day_of_the_week);
261
262
271
signed
char
get_day_of_the_week_RTCC
(
void
);
272
273
286
signed
char
set_months_RTCC
(
unsigned
char
months);
287
288
296
unsigned
char
get_months_RTCC
(
void
);
297
298
312
signed
char
set_years_RTCC
(
unsigned
char
years);
313
314
322
unsigned
char
get_years_RTCC
(
void
);
323
324
325
332
unsigned
char
*
get_date_RTCC
(
void
);
333
334
351
signed
char
set_minutes_alarm_RTCC
(
unsigned
char
minutes,
unsigned
char
alarm_enable);
352
353
370
signed
char
set_hours_alarm_RTCC
(
unsigned
char
hours,
unsigned
char
alarm_enable);
371
372
389
signed
char
set_days_alarm_RTCC
(
unsigned
char
days,
unsigned
char
alarm_enable);
390
391
409
signed
char
set_day_of_the_week_alarm_RTCC
(
unsigned
char
day_of_the_week,
unsigned
char
alarm_enable);
410
411
422
signed
char
enable_alarm_interrupt_RTCC
(
void
);
423
424
435
signed
char
disable_alarm_interrupt_RTCC
(
void
);
436
437
446
unsigned
char
is_alarm_ON_RTCC
(
void
);
447
448
460
signed
char
increment_minutes_RTCC
(
void
);
461
462
474
signed
char
increment_hours_RTCC
(
void
);
475
476
488
signed
char
increment_years_RTCC
(
void
);
489
490
502
signed
char
increment_months_RTCC
(
void
);
503
504
517
signed
char
increment_days_RTCC
(
void
);
518
519
520
#endif
521
LaurTec_PIC_libraries_v_3.1
inc
PCF8563.h
Generated on Tue Apr 30 2013 20:06:10 for PIC18 LaurTec Library by
1.8.3.1