辛勤整理
單片機源程序如下:
- #include"stm32f10x.h"
- #include"lcd.h"
- #include"fm.h"
- #include"key.h"
- /*
- * 函數名:main
- * 描述 : 主函數
- * 輸入 :無
- * 輸出 : 無
- */
- int main(void)
- {
- float fre=87.5;
- uchar keys=0;
- lcd_init();
- lcd_initA();
- L1602_init();
- i2c_output_init();
- SDA_input_init();
- L1602_string(1,1,"Hi, ^_^");
- L1602_string(2,1," Hello Radio");
- delay1m(30000);
- wcmd(0x01);
- L1602_int(2,15,0) ;
- while(1)
- {
- L1602_string(1,1," Hello Radio");
- L1602_string(2,1,"F:");
- L1602_float(2,3,fre);
- L1602_string(2,8,"(mhz)");
- keys=key();
-
- if(keys!=0)
- {
- GPIO_ResetBits(GPIOB,GPIO_Pin_15);
- if(keys==1) //+自動搜臺
- {
- if(auto_search(1))
- {
- L1602_int(2,15,getADC()) ;
- keys=0;
- fre=getfrequency()/1000.0;
- L1602_float(2,3,fre);
- }
- }
- else if(keys==2) //-自動搜臺
- {
- if(auto_search(1))
- {
- L1602_int(2,15,getADC()) ;
- keys=0;
- fre=getfrequency()/1000.0;
- L1602_float(2,3,fre);
- }
- }
- else if(keys==3) //+手動搜臺
- {
- if(search(1))
- L1602_int(2,15,getADC()) ;
- keys=0;
- fre=getfrequency()/1000.0;
- L1602_float(2,3,fre);
- }
- else if(keys==4) //-手動搜臺
- {
- if(search(0))
- L1602_int(2,15,getADC()) ;
- keys=0;
- fre=getfrequency()/1000.0;
- L1602_float(2,3,fre);
- }
- else if(keys==5) //靜音
- {
- sound_on_off();
- }
- }
- }
-
- }
- /******************* (C) COPYRIGHT 2012 WildFire Team *****END OF FILE************/
復制代碼
所有資料51hei提供下載:
stm程序.rar
(296.88 KB, 下載次數: 68)
2018-9-13 00:27 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|