aboutsummaryrefslogtreecommitdiffstats
path: root/build/default/production/main.i
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2019-08-21 03:07:37 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2019-08-21 03:07:37 -0500
commit442b88a5b418a7cb7bec780800f9635e0c731cba (patch)
treefbf95f6553bf7f45d46269b22d15ff1c9396689a /build/default/production/main.i
parentbe9596ecf3b8ac7a6e320204e459c490a4cf356a (diff)
Okay then
Diffstat (limited to 'build/default/production/main.i')
-rwxr-xr-xbuild/default/production/main.i737
1 files changed, 452 insertions, 285 deletions
diff --git a/build/default/production/main.i b/build/default/production/main.i
index 037b4d1..9437bd6 100755
--- a/build/default/production/main.i
+++ b/build/default/production/main.i
@@ -7,108 +7,6 @@
# 1 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\language_support.h" 1 3
# 2 "<built-in>" 2
# 1 "main.c" 2
-# 1 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdio.h" 1 3
-
-
-
-# 1 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\__size_t.h" 1 3
-
-
-
-typedef unsigned size_t;
-# 4 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdio.h" 2 3
-
-# 1 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\__null.h" 1 3
-# 5 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdio.h" 2 3
-
-
-
-
-
-
-# 1 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdarg.h" 1 3
-
-
-
-
-
-
-typedef void * va_list[1];
-
-#pragma intrinsic(__va_start)
-extern void * __va_start(void);
-
-#pragma intrinsic(__va_arg)
-extern void * __va_arg(void *, ...);
-# 11 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdio.h" 2 3
-# 43 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdio.h" 3
-struct __prbuf
-{
- char * ptr;
- void (* func)(char);
-};
-# 85 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdio.h" 3
-# 1 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\conio.h" 1 3
-
-
-
-
-
-
-
-# 1 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\errno.h" 1 3
-# 29 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\errno.h" 3
-extern int errno;
-# 8 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\conio.h" 2 3
-
-
-
-
-extern void init_uart(void);
-
-extern char getch(void);
-extern char getche(void);
-extern void putch(char);
-extern void ungetch(char);
-
-extern __bit kbhit(void);
-
-
-
-extern char * cgets(char *);
-extern void cputs(const char *);
-# 85 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdio.h" 2 3
-
-
-
-extern int cprintf(char *, ...);
-#pragma printf_check(cprintf)
-
-
-
-extern int _doprnt(struct __prbuf *, const register char *, register va_list);
-# 180 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\c90\\stdio.h" 3
-#pragma printf_check(vprintf) const
-#pragma printf_check(vsprintf) const
-
-extern char * gets(char *);
-extern int puts(const char *);
-extern int scanf(const char *, ...) __attribute__((unsupported("scanf() is not supported by this compiler")));
-extern int sscanf(const char *, const char *, ...) __attribute__((unsupported("sscanf() is not supported by this compiler")));
-extern int vprintf(const char *, va_list) __attribute__((unsupported("vprintf() is not supported by this compiler")));
-extern int vsprintf(char *, const char *, va_list) __attribute__((unsupported("vsprintf() is not supported by this compiler")));
-extern int vscanf(const char *, va_list ap) __attribute__((unsupported("vscanf() is not supported by this compiler")));
-extern int vsscanf(const char *, const char *, va_list) __attribute__((unsupported("vsscanf() is not supported by this compiler")));
-
-#pragma printf_check(printf) const
-#pragma printf_check(sprintf) const
-extern int sprintf(char *, const char *, ...);
-extern int printf(const char *, ...);
-# 1 "main.c" 2
-
-
-
-
# 1 "./conf.h" 1
# 1 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\xc.h" 1 3
# 18 "C:\\Program Files (x86)\\Microchip\\xc8\\v2.05\\pic\\include\\xc.h" 3
@@ -1835,81 +1733,39 @@ extern __bank0 __bit __timeout;
#pragma config CPD = OFF
#pragma config WRT = OFF
#pragma config CP = OFF
-# 5 "main.c" 2
+# 1 "main.c" 2
# 1 "./main.h" 1
-
-unsigned int sec = 30;
-unsigned int min = 42;
-unsigned int hour = 21;
-unsigned int dayOfWeek = 7;
-unsigned int date = 27;
-unsigned int month = 7;
-unsigned int year = 19;
-unsigned int century = 20;
-unsigned int alarm1_sec, alarm1_min, alarm1_hour;
-unsigned int alarm2_min, alarm2_hour;
-unsigned int status_reg, alarm1_status, alarm2_status;
-unsigned int control_reg;
-
-
-unsigned int temperature_lsb = 0;
-int temperature_msb = 0;
-unsigned char temp_sign = ' ';
-
-
-char* weekday;
-
-
-unsigned int sec_chg = 0;
-
-
-unsigned char sec_0, sec_1;
-unsigned char min_0, min_1;
-unsigned char hour_0, hour_1;
-unsigned char day_0, day_1;
-unsigned char month_0, month_1;
-unsigned char year_0, year_1;
-unsigned char temp_0, temp_1, temp_2;
-unsigned char alarm1_sec_0, alarm1_sec_1, alarm1_min_0, alarm1_min_1,
- alarm1_hour_0, alarm1_hour_1;
-unsigned char alarm2_min_0, alarm2_min_1, alarm2_hour_0, alarm2_hour_1;
-
-
-char buf[40];
-
-
-void format_DateTimeChars(void);
-
-
-void format_Temperature(void);
-
-
-void getWeekDay(unsigned int);
+# 1 "./lcd.h" 1
+# 1 "./conf.h" 1
-void Get_Alarm_Status(void);
-void display_Intro(void);
-void display_Lcd_Layout(void);
+#pragma config FOSC = HS
+#pragma config WDTE = OFF
+#pragma config PWRTE = ON
+#pragma config BOREN = ON
+#pragma config LVP = OFF
+#pragma config CPD = OFF
+#pragma config WRT = OFF
+#pragma config CP = OFF
+# 1 "./lcd.h" 2
-void update_Display(void);
-# 6 "main.c" 2
-# 1 "./lcd.h" 1
void Lcd_Port(char);
void Lcd_Cmd(char);
-void Lcd_Clear();
+void Lcd_Clear(void);
void Lcd_Set_Cursor(char, char);
-void Lcd_Init();
+void Lcd_Init(void);
void Lcd_Write_Char(char);
void Lcd_Write_String(char *);
-void Lcd_Shift_Right();
-void Lcd_Shift_Left();
+void Lcd_Shift_Right(void);
+void Lcd_Shift_Left(void);
+
void Vfd_Set_Brightness(int);
-# 7 "main.c" 2
+# 1 "./main.h" 2
# 1 "./i2c.h" 1
void I2C_Master_Init(const unsigned long);
@@ -1919,7 +1775,7 @@ void I2C_Master_Repeated_Start(void);
void I2C_Master_Stop(void);
void I2C_Master_Write(unsigned);
unsigned short I2C_Master_Read(unsigned short);
-# 8 "main.c" 2
+# 2 "./main.h" 2
# 1 "./ds3231.h" 1
# 1 "./conf.h" 1
@@ -1937,16 +1793,50 @@ unsigned short I2C_Master_Read(unsigned short);
# 1 "./ds3231.h" 2
+char dayOfWeek[7][4];
+char monthOfYear[12][4];
+
int BCD_2_DEC(int);
int DEC_2_BCD(int);
+unsigned int Get_DayOfWeek(unsigned int, unsigned int, unsigned int);
+unsigned int Get_Days_In_Month(unsigned int, unsigned int);
+unsigned int Get_Is_Leap_Year(unsigned int);
+char* Get_WeekDay(unsigned int);
void Read_Alarms_Temp(void);
void Set_Date(void);
-void Set_DayOfWeek(void);
+void Set_DayOfWeek(int);
+void Set_Sqwe(int);
void Set_Time(void);
-void Set_Time_Date(void);
void Update_Current_Date_Time(void);
void Write_Alarms(void);
-# 9 "main.c" 2
+# 3 "./main.h" 2
+
+
+
+# 1 "./adc.h" 1
+# 1 "./conf.h" 1
+
+
+
+#pragma config FOSC = HS
+#pragma config WDTE = OFF
+#pragma config PWRTE = ON
+#pragma config BOREN = ON
+#pragma config LVP = OFF
+#pragma config CPD = OFF
+#pragma config WRT = OFF
+#pragma config CP = OFF
+# 1 "./adc.h" 2
+
+
+
+void Adc_Init(void);
+
+
+unsigned int Adc_Read(unsigned int);
+# 6 "./main.h" 2
+
+
# 1 "./beep.h" 1
# 1 "./conf.h" 1
@@ -1965,110 +1855,178 @@ void Write_Alarms(void);
void alarm(unsigned int);
-# 10 "main.c" 2
+# 9 "./main.h" 2
+# 18 "./main.h"
+unsigned int ldr;
+unsigned int brtlvl_chg;
+unsigned int update;
-int main() {
- TRISC = 0x00;
- PORTC = 0x00;
- TRISD = 0x00;
- PORTD = 0x00;
-# 33 "main.c"
- I2C_Master_Init(100000);
+unsigned int edit_datetime;
+extern unsigned int sec;
+extern unsigned int min;
+extern unsigned int hour;
+extern unsigned int day;
+extern unsigned int date;
+extern unsigned int month;
+extern unsigned int year;
+extern unsigned int century;
+extern unsigned int alarm1_sec, alarm1_min, alarm1_hour;
+extern unsigned int alarm2_min, alarm2_hour;
+extern unsigned int status_reg, alarm1_status, alarm2_status;
+extern unsigned int control_reg;
+extern unsigned int temperature_lsb;
+extern int temperature_msb;
+unsigned char temp_sign;
+# 60 "./main.h"
+void display_Digit(unsigned int);
+void display_Intro(void);
+void display_Lcd_Layout(void);
+void edit_Date_Time(void);
- Lcd_Init();
+void format_Temperature(void);
+void Get_Alarm_Status(void);
+void update_Display(void);
+# 2 "main.c" 2
- display_Intro();
- display_Lcd_Layout();
-# 68 "main.c"
- while (1) {
+unsigned int ldr = 0;
- Update_Current_Date_Time();
+unsigned int brtlvl_chg = 0;
- Read_Alarms_Temp();
+unsigned int update = 0;
- Get_Alarm_Status();
+unsigned int edit_datetime = 0;
+unsigned int sec = 0;
+unsigned int min = 0;
+unsigned int hour = 0;
+unsigned int day = 1;
+unsigned int date = 1;
+unsigned int month = 1;
+unsigned int year = 00;
+unsigned int century = 20;
+unsigned int alarm1_sec = 0;
+unsigned int alarm1_min = 0;
+unsigned int alarm1_hour = 0;
+unsigned int alarm2_min = 0;
+unsigned int alarm2_hour = 0;
+unsigned int status_reg = 0;
+unsigned int alarm1_status = 0;
+unsigned int alarm2_status = 0;
+unsigned int control_reg = 0;
- format_DateTimeChars();
+unsigned int temperature_lsb = 0;
+int temperature_msb = 0;
+unsigned char temp_sign = ' ';
+void main(void) {
- format_Temperature();
+ TRISA0 = 0x01;
+ TRISBbits.TRISB2 = 1;
+ TRISBbits.TRISB4 = 1;
+ TRISBbits.TRISB5 = 1;
+ GIE = 0;
+ OPTION_REGbits.nRBPU = 0;
+ INTE = 1;
+ GIE = 1;
- getWeekDay(dayOfWeek);
+ TRISC = 0x00;
+ PORTC = 0x00;
+ TRISD = 0x00;
+ PORTD = 0x00;
+# 71 "main.c"
+ I2C_Master_Init(100000);
+# 80 "main.c"
+ Adc_Init();
+# 89 "main.c"
+ Lcd_Init();
+# 98 "main.c"
+ Vfd_Set_Brightness(0);
- if (sec_chg != sec) {
- update_Display();
+ display_Intro();
+ display_Lcd_Layout();
+# 120 "main.c"
+ Set_Sqwe(0x40);
+
+
+ Vfd_Set_Brightness(3);
- sec_chg = sec;
-# 121 "main.c"
+
+ while (1) {
+# 137 "main.c"
+ if (update) {
+ Lcd_Set_Cursor(1, 3);
+ Lcd_Write_Char(':');
+ Lcd_Set_Cursor(1, 6);
+ Lcd_Write_Char(':');
+ Update_Current_Date_Time();
+ Read_Alarms_Temp();
+ Get_Alarm_Status();
+ format_Temperature();
+ update_Display();
+ update = 0;
+ _delay((unsigned long)((500)*(20000000/4000.0)));
+ } else {
+ Lcd_Set_Cursor(1, 3);
+ Lcd_Write_Char(' ');
+ Lcd_Set_Cursor(1, 6);
+ Lcd_Write_Char(' ');
}
- }
- return 0;
-}
-void format_DateTimeChars() {
- sec_0 = sec % 10 + '0';
- sec_1 = sec / 10 + '0';
- min_0 = min % 10 + '0';
- min_1 = min / 10 + '0';
- hour_0 = hour % 10 + '0';
- hour_1 = hour / 10 + '0';
- day_0 = date % 10 + '0';
- day_1 = date / 10 + '0';
- month_0 = month % 10 + '0';
- month_1 = month / 10 + '0';
- year_0 = year % 10 + '0';
- year_1 = year / 10 + '0';
- alarm1_sec_0 = alarm1_sec % 10 + '0';
- alarm1_sec_1 = alarm1_sec / 10 + '0';
- alarm1_min_0 = alarm1_min % 10 + '0';
- alarm1_min_1 = alarm1_min / 10 + '0';
- alarm1_hour_0 = alarm1_hour % 10 + '0';
- alarm1_hour_1 = alarm1_hour / 10 + '0';
- alarm2_min_0 = alarm2_min % 10 + '0';
- alarm2_min_1 = alarm2_min / 10 + '0';
- alarm2_hour_0 = alarm2_hour % 10 + '0';
- alarm2_hour_1 = alarm2_hour / 10 + '0';
-}
+ if (!RB2) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ edit_Date_Time();
+ }
+# 175 "main.c"
+ ldr = Adc_Read(0);
+ if (brtlvl_chg != ldr/256) {
+ Vfd_Set_Brightness(ldr/256);
+ brtlvl_chg = ldr/256;
+ }
+# 207 "main.c"
+ }
+}
+# 218 "main.c"
void format_Temperature() {
+
+
if (temperature_msb < 0) {
temperature_msb *= -1;
temp_sign = '-';
@@ -2081,72 +2039,36 @@ void format_Temperature() {
temperature_lsb *= 25;
+}
- if (temperature_lsb == 0) {
- temp_0 = '0';
- }
-
- if (temperature_lsb == 25) {
- temp_0 = '2';
- }
-
- if (temperature_lsb == 50) {
- temp_0 = '5';
- }
- if (temperature_lsb == 75) {
- temp_0 = '7';
- }
- temp_1 = temperature_msb % 10 + '0';
- temp_2 = temperature_msb / 10 + '0';
+void Get_Alarm_Status() {
+ alarm1_status = control_reg & 0x01;
+ alarm2_status = (control_reg >> 1) & 0x01;
}
-void getWeekDay(unsigned int dayOfWeek) {
- switch (dayOfWeek) {
- case 1:
- weekday = "Sun";
- break;
- case 2:
- weekday = "Mon";
- break;
- case 3:
- weekday = "Tue";
- break;
- case 4:
- weekday = "Wed";
- break;
- case 5:
- weekday = "Thu";
- break;
- case 6:
- weekday = "Fri";
- break;
- case 7:
- weekday = "Sat";
- break;
- }
+void display_Digit(unsigned int data) {
+ Lcd_Write_Char(((data / 10) + '0'));
+ Lcd_Write_Char(((data % 10) + '0'));
}
-void Get_Alarm_Status() {
- alarm1_status = control_reg & 0x01;
- alarm2_status = (control_reg >> 1) & 0x01;
-}
-
void display_Intro() {
Lcd_Clear();
- Lcd_Set_Cursor(1, 1);
- Lcd_Write_String("RTC/LCD with PIC");
- Lcd_Set_Cursor(2, 1);
- Lcd_Write_String(" Circuit Digest");
- _delay((unsigned long)((2000)*(20000000/4000.0)));
+ Lcd_Set_Cursor(1, 4);
+ Lcd_Write_String("Desk Clock");
+ Lcd_Set_Cursor(2, 15);
+ Lcd_Write_String("V1");
+ _delay((unsigned long)((1000)*(20000000/4000.0)));
}
+
+
void display_Lcd_Layout() {
Lcd_Clear();
@@ -2155,58 +2077,303 @@ void display_Lcd_Layout() {
Lcd_Write_Char(0xDF);
Lcd_Write_Char('C');
Lcd_Set_Cursor(2, 1);
- Lcd_Write_String("ddd, DD/MM/YY ");
- _delay((unsigned long)((2000)*(20000000/4000.0)));
+ Lcd_Write_String(" ddd DD/MM/CCYY ");
+
+ _delay((unsigned long)((1000)*(20000000/4000.0)));
}
+
+
void update_Display() {
Lcd_Set_Cursor(1, 1);
- Lcd_Write_Char(hour_1);
- Lcd_Write_Char(hour_0);
+ display_Digit(hour);
Lcd_Set_Cursor(1, 4);
- Lcd_Write_Char(min_1);
- Lcd_Write_Char(min_0);
+ display_Digit(min);
Lcd_Set_Cursor(1, 7);
- Lcd_Write_Char(sec_1);
- Lcd_Write_Char(sec_0);
+ display_Digit(sec);
Lcd_Set_Cursor(2, 6);
- Lcd_Write_Char(day_1);
- Lcd_Write_Char(day_0);
+ display_Digit(date);
Lcd_Set_Cursor(2, 9);
- Lcd_Write_Char(month_1);
- Lcd_Write_Char(month_0);
+ display_Digit(month);
Lcd_Set_Cursor(2, 12);
- Lcd_Write_Char(year_1);
- Lcd_Write_Char(year_0);
+ display_Digit(century);
- Lcd_Set_Cursor(2, 1);
- Lcd_Write_String(weekday);
+ Lcd_Set_Cursor(2, 14);
+ display_Digit(year);
+
+
+ Lcd_Set_Cursor(2, 2);
+ Lcd_Write_String(Get_WeekDay(day));
Lcd_Set_Cursor(1, 10);
Lcd_Write_Char(temp_sign);
- Lcd_Write_Char(temp_2);
- Lcd_Write_Char(temp_1);
+ display_Digit(temperature_msb);
Lcd_Set_Cursor(1, 14);
- Lcd_Write_Char(temp_0);
+ Lcd_Write_Char(((temperature_lsb / 10) + '0'));
+
if (min == 00 && sec == 00) {
alarm(2);
}
+
if (min == 30 && sec == 00) {
alarm(1);
}
}
+# 349 "main.c"
+void edit_Date_Time(void) {
+
+ int updateRTC = 0;
+
+
+
+ unsigned int hour_org = hour;
+ unsigned int min_org = min;
+ unsigned int sec_org = sec;
+ unsigned int year_org = year;
+ unsigned int month_org = month;
+ unsigned int date_org = date;
+
+ Lcd_Set_Cursor(2, 16);
+ Lcd_Write_Char('S');
+ edit_datetime++;
+ while (edit_datetime > 0 && edit_datetime < 7) {
+
+
+ Lcd_Set_Cursor(1, 3);
+ Lcd_Write_Char(':');
+ Lcd_Set_Cursor(1, 6);
+ Lcd_Write_Char(':');
+
+ switch (edit_datetime) {
+ case 1:
+ Lcd_Set_Cursor(2, 16);
+ Lcd_Write_Char('h');
+ if (!RB5) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (hour == 0) {
+ hour = 23;
+ } else {
+ hour -= 1;
+ }
+ Lcd_Set_Cursor(1, 1);
+ display_Digit(hour);
+
+ } else if (!RB4) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (hour + 1 > 23) {
+ hour = 0;
+ } else {
+ hour += 1;
+ }
+
+ Lcd_Set_Cursor(1, 1);
+ display_Digit(hour);
+ }
+
+ break;
+
+ case 2:
+ Lcd_Set_Cursor(2, 16);
+ Lcd_Write_Char('m');
+ if (!RB5) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (min == 0) {
+ min = 59;
+ } else {
+ min -= 1;
+ }
+ Lcd_Set_Cursor(1, 4);
+ display_Digit(min);
+
+ } else if (!RB4) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (min + 1 > 59) {
+ min = 0;
+ } else {
+ min += 1;
+ }
+
+ Lcd_Set_Cursor(1, 4);
+ display_Digit(min);
+ }
+
+ break;
+
+ case 3:
+ Lcd_Set_Cursor(2, 16);
+ Lcd_Write_Char('s');
+ if (!RB5) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (sec == 0) {
+ sec = 59;
+ } else {
+ sec -= 1;
+ }
+ Lcd_Set_Cursor(1, 7);
+ display_Digit(sec);
+ if (sec_org != sec) {
+ updateRTC = 1;
+ }
+
+ } else if (!RB4) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (sec + 1 > 59) {
+ sec = 0;
+ } else {
+ sec += 1;
+ }
+
+ Lcd_Set_Cursor(1, 7);
+ display_Digit(sec);
+ if (sec_org != sec) {
+ updateRTC = 1;
+ }
+ }
+
+ break;
+
+ case 6:
+ Lcd_Set_Cursor(2, 16);
+ Lcd_Write_Char('D');
+ if (!RB5) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (date - 1 == 0) {
+ date = Get_Days_In_Month(year, month);
+ } else {
+ date -= 1;
+ }
+
+ Lcd_Set_Cursor(2, 2);
+ Lcd_Write_String(Get_WeekDay(Get_DayOfWeek(year, month, date)));
+ Lcd_Set_Cursor(2, 6);
+ display_Digit(date);
+
+ } else if (!RB4) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+
+ if (date + 1 > Get_Days_In_Month(year, month)) {
+ date = 1;
+ } else {
+ date += 1;
+ }
+
+ Lcd_Set_Cursor(2, 2);
+ Lcd_Write_String(Get_WeekDay(Get_DayOfWeek(year, month, date)));
+ Lcd_Set_Cursor(2, 6);
+ display_Digit(date);
+ }
+
+ break;
+
+ case 5:
+ Lcd_Set_Cursor(2, 16);
+ Lcd_Write_Char('M');
+ if (!RB5) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (month - 1 == 0) {
+ month = 12;
+ } else {
+ month -= 1;
+ }
+ Lcd_Set_Cursor(2, 9);
+ display_Digit(month);
+
+ } else if (!RB4) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (month + 1 > 12) {
+ month = 1;
+ } else {
+ month += 1;
+ }
+
+ Lcd_Set_Cursor(2, 9);
+ display_Digit(month);
+ }
+
+ break;
+
+ case 4:
+ Lcd_Set_Cursor(2, 16);
+ Lcd_Write_Char('Y');
+ if (!RB5) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (year == 0) {
+ year = 99;
+ } else {
+ year -= 1;
+ }
+ Lcd_Set_Cursor(2, 14);
+ display_Digit(year);
+
+ } else if (!RB4) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ if (year + 1 > 99) {
+ year = 0;
+ } else {
+ year += 1;
+ }
+
+ Lcd_Set_Cursor(2, 14);
+ display_Digit(year);
+ }
+
+ break;
+
+
+
+ default:
+ break;
+ }
+
+ if (!RB2) {
+ _delay((unsigned long)((250)*(20000000/4000.0)));
+ edit_datetime++;
+ }
+ }
+# 567 "main.c"
+ if (edit_datetime > 6) {
+ Lcd_Set_Cursor(2, 16);
+ Lcd_Write_String(" ");
+ edit_datetime = 0;
+
+
+
+
+
+ if(hour_org != hour || min_org != min || sec_org != sec
+ || year_org != year || month_org != month || date_org != date) {
+ updateRTC = 0;
+ Set_Time();
+ Set_DayOfWeek(Get_DayOfWeek(year, month, date));
+ Set_Date();
+ }
+ }
+}
+
+
+
+
+
+
+
+void __attribute__((picinterrupt(("")))) isr(void) {
+ if (INTF == 1) {
+ update = 1;
+ INTF = 0;
+ }
+}