|
TFTLCD顯示-電子鐘-萬年歷-完整版
單片機(jī)源程序如下:
- #include "sys.h"
- #include "usart.h"
- #include "delay.h"
- #include "led.h"
- #include "beep.h"
- #include "key.h"
- #include "exti.h"
- #include "wdg.h"
- #include "timer.h"
- #include "lcd.h"
- #include "tu1.h" //圖片1
- #include "tu.h" //圖片2
- #include "tu3.h" //圖片3
- #include "rtc.h" //時(shí)鐘初始化
- #include "lcd_ziti.h"
- #include "lcd_rtc.h"
- #include "lcd_2.h"
- #include "timer_jx.h" //設(shè)置時(shí)間
-
- #include "24c02_chushihua.h" //24c02初始化---
- #include "24c02.h" //24c02讀寫操作
- /*************************************************
- 時(shí)間通過串口2校準(zhǔn)
-
- *************************************************/
- float n1=6,k_1=6,n2=0,k_2=6; //表針角度變量
- volatile unsigned int sum1=2014,sum2=11,sum3=01,sum4=12,sum5=14,sum6=18, sum7=2018,sum8=11,sum9=12,sum10=13,sum11=14,sum12=15;
- //時(shí)間-鬧鐘存儲(chǔ)變量 sum1--sum6是時(shí)間校準(zhǔn)臨時(shí)變量 剩下的為鬧鐘校準(zhǔn)變量
- u8 t;
- u8 shijianshuzu[100]; //時(shí)間存儲(chǔ)數(shù)組
- volatile int count_cukou=0; //計(jì)數(shù)器
- int data_x=1; //判斷進(jìn)入中斷的序號(hào) //
- u16 BACK_COLOR=0xFFFF; //背景顏色
- u16 POINT_COLOR=0xf800; //畫筆顏色
- int main(void) //LCD分辨率最大是240*320 寬240 高320 //LCD屏操作時(shí)序與內(nèi)存時(shí)序基本相同//在嵌入式中都為16位來表達(dá)顏色
- {
- Stm32_Clock_Init(9); //系統(tǒng)時(shí)鐘設(shè)置
- delay_init(72); //延時(shí)初始化
- LED_Init(); //初始化與LED連接的硬件接口
- LCD_Init(); //LCD 初始化
- POINT_COLOR=0xf800; //畫筆顏色,默認(rèn)紅色
- EXTIX_Init(); //中斷初始化
- usart2_init(36,9600); //串口2初始化設(shè)置波特率
- exti_2(); //串口初始化配置中斷
- AT24CXX_Init(); //IIC初始化
-
- /****************IIC********************************/
- // while(AT24CXX_Check) //iic初始化(成功返回0,失敗返回1)
- // {
- // LCD_ShowString(60,120,80,200,16,"IIC--fail--NO"); //初始化失敗--顯示
- // delay_ms(50); //延時(shí)
- // }
- /***************************************************/
- while(RTC_Init()) //RTC初始化 ,一定要初始化成功
- {
- LCD_ShowString(60,130,200,16,16,"RTC ERROR! "); //初始化錯(cuò)誤(坐標(biāo),字體顯示范圍坐標(biāo),字體大小,地址
- delay_ms(800);
- LCD_ShowString(60,130,200,16,16,"RTC Trying..."); //正在重新嘗試
- }
- lcd_ziti(); //框架顯示
- while(1)
- {
- Draw_Circle(120,120,1); //畫圓, 表盤中間的小圓 //注視掉屏幕上就沒有點(diǎn)
- Draw_Circle(120,120,2);
- Draw_Circle(120,120,3);
- Draw_Circle(120,120,4);
- }
- }
- /***********************************************************************
- 在Keil中編譯工程成功后,在下面的Bulid Ouput窗口中會(huì)輸出下面這樣一段信息:
- Program Size: Code=6320 RO-data=4864 RW-data=44 ZI-data=1636
- 代表的意思:
- Code :是程序中代碼所占字節(jié)大小
- RO-data :程序中所定義的指令和常量大小 (個(gè)人理解 :Read Only)
- RW-data :程序中已初始化的變量大小 (個(gè)人理解”:Read/Write)
- ZI-Data :程序中未初始化的變量大小 (個(gè)人理解 :Zero Initialize)
- 1k等于1024字節(jié) 1024k等于1kb 1024kb等于1mb 1024mb等于1gb 1024gb等于1tb
- ************************************************************************/
復(fù)制代碼
所有資料51hei提供下載:
TFTLCD顯示-電子鐘-完整---副本.rar
(965.87 KB, 下載次數(shù): 156)
2018-8-27 22:39 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
|
|