辛勤整理
单片机源程序如下:
- #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)
|