From de66400caa11c407d661671d083a9781c284198d Mon Sep 17 00:00:00 2001 From: cyp0633 Date: Mon, 22 Aug 2022 16:24:26 +0800 Subject: [PATCH] Problem 4: problematic implementation --- 4/4.uvopt | 197 ++++++++++++++++++++++++++ 4/4.uvproj | 395 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4/main.c | 43 ++++++ 3 files changed, 635 insertions(+) create mode 100644 4/4.uvopt create mode 100644 4/4.uvproj create mode 100644 4/main.c diff --git a/4/4.uvopt b/4/4.uvopt new file mode 100644 index 0000000..a99d45e --- /dev/null +++ b/4/4.uvopt @@ -0,0 +1,197 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + Target 1 + 0x0 + MCS-51 + + 35000000 + + 1 + 1 + 1 + 0 + 0 + + + 0 + 65535 + 0 + 0 + 0 + + + 120 + 65 + 8 + .\Listings\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 1 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + -1 + + + + + + + + + + + + + + + 0 + + + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + + + + + + Source Group 1 + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + .\main.c + main.c + 0 + 0 + + + 1 + 2 + 4 + 0 + 0 + 0 + .\STCBSP_V3.6.LIB + STCBSP_V3.6.LIB + 0 + 0 + + + +
diff --git a/4/4.uvproj b/4/4.uvproj new file mode 100644 index 0000000..7763960 --- /dev/null +++ b/4/4.uvproj @@ -0,0 +1,395 @@ + + + + 1.1 + +
### uVision Project, (C) Keil Software
+ + + + Target 1 + 0x0 + MCS-51 + 0 + + + STC15F2K60S2 Series + STC + IRAM(0-0xFF) XRAM(0-0x6FF) IROM(0-0xEFF8) CLOCK(35000000) MODP2 + + "LIB\STARTUP.A51" ("Standard 8051 Startup Code") + + 62472 + STC15F2K60S2.H + + + + + + + + + + + 0 + 0 + + + + STC\ + STC\ + + 0 + 0 + 0 + 0 + 1 + + .\Objects\ + 4 + 1 + 0 + 1 + 1 + 1 + .\Listings\ + 0 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + 65535 + + + S8051.DLL + + DP51.DLL + -pDP8051 + S8051.DLL + + TP51.DLL + -p51 + + + + 0 + 0 + 0 + 0 + 16 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 0 + 1 + 0 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + -1 + + + + + + + + + + + + + + + + + + + 0 + 0 + 0 + 0 + 0 + -1 + + 0 + + + + + + + 0 + + + + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + 0 + 0x0 + 0x10000 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0xeff9 + + + 0 + 0x0 + 0x100 + + + 0 + 0x0 + 0x700 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + + + 0 + 0 + 1 + 0 + 1 + 3 + 8 + 2 + 1 + 1 + 0 + 0 + + + + + ..\inc + + + + 0 + 1 + 0 + 0 + + + + + + + + + 0 + 0 + 1 + 0 + 2 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Source Group 1 + + + main.c + 1 + .\main.c + + + STCBSP_V3.6.LIB + 4 + .\STCBSP_V3.6.LIB + + + + + + + +
diff --git a/4/main.c b/4/main.c new file mode 100644 index 0000000..1216db9 --- /dev/null +++ b/4/main.c @@ -0,0 +1,43 @@ +#include "DS1302.h" +#include "STC15F2K60S2.H" +#include "displayer.h" +#include "sys.h" +#include "universal_decode_table.h" + +code unsigned long SysClock = 11059200; //必须。定义系统工作时钟频率(Hz),用户必须修改成与实际工作频率(下载时选择的)一致 +struct_DS1302_RTC time,temp; +unsigned char display[8]; + +void changeClock() +{ + temp = RTC_Read(); + display[0] = temp.second & 0x0f; + display[1] = (temp.second >> 4) & 0x0f; + display[2] = temp.minute & 0x0f; + display[3] = (temp.minute >> 4) & 0x0f; + display[4] = temp.hour & 0x0f; + display[5] = (temp.hour >> 4) & 0x0f; + display[6] = temp.day & 0x0f; + display[7] = (temp.day >> 4) & 0x0f; + Seg7Print(display[7], display[6], display[5], display[4], display[3], display[2], display[1], display[0]); +} + +void main() +{ + time.year = 0x22; + time.day = 0x22; + time.month = 0x8; + time.hour = 0x15; + time.minute = 0x33; + time.second = 0x22; + DS1302Init(time); + DisplayerInit(); + SetDisplayerArea(0, 7); + LedPrint(0); + SetEventCallBack(enumEventSys10mS, changeClock); + MySTC_Init(); + while (1) + { + MySTC_OS(); + } +}