SDIO card
RTC
RTC
主要功能 由輸入的clock隨時計算現在的時間 設定時間之後,讀進控制元件的時間資料,輸出每一秒的正確時間 Frequency Divider clk_50KHz clk_1Hz rtc_in[19:0] reset rtc_out[19:0]
Clock Frequency Divider Clock clk_50KHz clk_1Hz rtc_in[19:0] reset rtc_out[19:0]
Clock RTC register 記住TH, H, TM, M, TS, S 的資訊 做進位判斷 Frequency Divider clk_50KHz clk_1Hz rtc_in[19:0] reset rtc_out[19:0] RTC register 記住TH, H, TM, M, TS, S 的資訊 做進位判斷 TH H TM M TS S [01] [1001] [101] [1000] [011] [0000] →19:58:30 19 17 13 10 6 3 0
Frequency Divider Clock Clock Frequency Divider Clock clk_50KHz clk_1Hz rtc_in[19:0] reset rtc_out[19:0] Clock Frequency Divider clk_50KHz clk_1Hz rtc_in[19:0] reset rtc_out[19:0]
Frequency Divider 將input clock除頻成1Hz Frequency Divider Clock clk_50KHz clk_1Hz rtc_in[19:0] reset rtc_out[19:0] 將input clock除頻成1Hz
Frequency Divider 在reset的時候,重新計算1Hz的計數器 RESET Frequency Divider Clock 25000 Frequency Divider Clock Frequency Divider clk_50KHz clk_1Hz rtc_in[19:0] reset rtc_out[19:0] 在reset的時候,重新計算1Hz的計數器 RESET
23:59:59 00:00:00 00:00:01
alarm
alarm
change change
切換時區
主要功能 提供切換時區的功能,將RTC和alarm output的時間做時區處理 將經過時區處理的time data加上欲顯示的時區代碼後傳送給LCD
設計要點 先挑選出一定數量的時區代表城市作為對換資料,判斷現在時間的城市時區,與要變換的城市時區做比較,將其作時差的加減對應而換算到新城市的時間 留意進位、退位和前後天(如超過24小時)的時間換算顯示 1 000001 UTC-11 Niue 2 000010 UTC-10 Hawaii 3 000011 UTC-9:30 POM 4 000100 UTC-9 Alaska 5 000101 UTC-8 PST 6 000110 UTC-7 Texas 7 000111 UTC-6 Florida 8 001000 UTC-5 New York 9 001001 UTC-4:30 Venezuela 10 001010 UTC-4 Paraguay 11 001011 UTC-3:30 Labrador 12 001100 UTC-3 Argentina 13 001101 UTC-2 SSI 14 001110 UTC-1 Praia 15 001111 UTC London 16 010000 UTC+1 Paris 17 010001 UTC+2 Alexandria 18 010010 UTC+3 Moscow 19 010011 UTC+3:30 Iran 20 010100 UTC+4 Baku 21 010101 UTC+4:30 Herat 22 010110 UTC+5 Pakistan 23 010111 UTC+5:30 India 24 011000 UTC+5:45 Nepal 25 011001 UTC+6 Bengal 26 011010 UTC+6:30 Myanmar 27 011011 UTC+7 Thailand 28 011100 UTC+8 Taiwan 29 011101 UTC+8:45 Caiguna 30 011110 UTC+9 Japan 31 011111 UTC+9:30 Broken Hill 32 100000 UTC+10 Guam 33 100001 UTC+10:30 LordHoweIsl. 34 100010 UTC+11 Solomon 35 100011 UTC+11:30 NorfolkIsl. 36 100100 UTC+12 New Zealand 37 100101 UTC+12:45 ChathamIsl. 38 100110 UTC+13 Tonga
簡單流程示意 Input reset time data Reset time New time data no reset change New city time data Original city time data no change reset Reset time no reset Change city change
testbench Input time data:UTC+4 Baku 7:49:38 Case 1:change to UTC-4:30 Venezuela Output time data1: 23:19:38 ----時區大換時區小(+ 24小時制變換) Case 2:change to UTC+12:45 Chathamlsl Output time data2: 16:34:38 ----時區小換時區大(+ 時、分的進退位)
Reset:city0 20 010100 UTC+4 Baku Output: City TH H TM M TS S [010100][000000] [00] [0111] [100] [1001] [011] [1000] 31 25 19 17 13 10 6 3 0 Reset 32’b0
Case 1:UTC+4 Baku UTC-4:30 Venezuela 7:49:38 23:19:38 Output: city1 TH H TM M TS S [001001] [000000] [10] [0011] [001] [1001] [011] [1000] 31 25 19 17 13 10 6 3 0 New minute New hour
Case 2:UTC+4 Baku UTC-4:30 Chathamlsl 7:49:38 16:34:38 Output: city1 TH H TM M TS S [100101] [000000] [01] [0110] [011] [0100] [011] [1000] 31 25 19 17 13 10 6 3 0 New minute New hour
(在此以80 us當成1 sec測試SDIO card) testbench (在此以80 us當成1 sec測試SDIO card)
in_data_rtc [01] [1001] [101] [1000] [011] [0000] 19 : 58 : 30 City0:001000 in_data_rtc [01] [1001] [101] [1000] [011] [0000] 19 : 58 : 30 in_data_alarm [01] [1001] [101] [1000] [100] [0000] 19 : 58 : 40 Reset Set alarm 19:58:31 19:58:30
Case 1: 001000 UTC-5 New York 000011 UTC-9:30 POM 19:58:32 15:28:32 Change Unchange 15:28:32 15:28:33 19:58:34 19:58:35
Case 2: 001000 UTC-5 New York 000000 UTC+8 Taiwan (dedault) 19:58:36 08:58:36 08:58:37 19:58:38 19:58:39 Change Unchange
in_data_alarm [01] [1001] [101] [1000] [100] [0000] 19 : 58 : 40 R_data_out [01] [1001] [101] [1000] [100] [0000] 19 : 58 : 40 → alarm pending show alarm alarm 19:58:40
Change city + show alarm time: 001000 UTC-5 New York 000000 UTC+8 Taiwan (dedault) 19:58:40 08:58:40 Change city Show alarm time 08:58:40
Cancel pending Rtc time : 19:58:43 show rtc time 19:58:43
在連接上host 或 host reset SDIO card 之前 ……
<sol> 加入內部軟體的reset模擬
在連接上host或host reset之前 RTC仍可以照常運作 00:00:00 00:00:01 00:00:02 19:58:30 19:58:31 reset
LCD