39 #error The DS1337 Library supports only PIC18 devices
51 OpenI2C(MASTER, SLEW_ON);
53 SSPADD = (((crystal_frequency_MHz *1000)/4)/baud_rate_KHz)-1;
72 unsigned char seconds;
77 seconds = seconds & 0b01111111;
99 unsigned char minutes;
103 minutes = minutes & 0b01111111;
126 hours = hours & 0b00111111;
136 static unsigned char time[9];
142 time[1] = (value & 0b00001111)+48;
143 time[0] = (value >> 4)+48;
148 time[4] = (value & 0b00001111)+48;
149 time[3] = (value >> 4)+48;
154 time[7] = (value & 0b00001111)+48;
155 time[6] = (value >> 4)+48;
169 static unsigned char time[6];
175 time[1] = (value & 0b00001111)+48;
176 time[0] = (value >> 4)+48;
181 time[4] = (value & 0b00001111)+48;
182 time[3] = (value >> 4)+48;
210 days = days & 0b00111111;
230 unsigned char months;
234 months = months & 0b00011111;
264 static unsigned char date[9];
270 date[1] = (value & 0b00001111)+48;
271 date[0] = (value >> 4)+48;
276 date[4] = (value & 0b00001111)+48;
277 date[3] = (value >> 4)+48;
283 date[7] = (value & 0b00001111)+48;
284 date[6] = (value >> 4)+48;
299 seconds = seconds + alarm_enable;
311 minutes = minutes + alarm_enable;
324 hours = hours + alarm_enable;
335 days = days + alarm_enable;
375 value = value & 0xFE;
393 unsigned char minutes;
404 if ((minutes&0x0F) > (
unsigned char) 9 ) {
439 if ((hours&0x0F) > (
unsigned char) 9 ) {
474 if ((years&0x0F) > (
unsigned char) 9 ) {
498 unsigned char months;
509 if ((months&0x0F) > (
unsigned char) 9 ) {
543 if ((days&0x0F) > (
unsigned char) 9 ) {