⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.lst

📁 基于飞利浦915控制FM发射模块和显示驱动原代码.
💻 LST
📖 第 1 页 / 共 2 页
字号:
 157   1              int count=0;
 158   1              switch((P0&0x30)|(P1&0x03))
 159   1                      {
 160   2                      case    0x31:           //play
 161   2                                      for(count=0;(power_switch==0);count++)
 162   2                                      {       Delay_ms(1);
 163   3                                              if(count>1200)          //长按关机
 164   3                                              {
 165   4                                                      FlashSave();
 166   4                                                      LCD_AllComsTemp[0]=6;  LCD_AllComsTemp[1]=5;  LCD_AllComsTemp[2]=6;
 167   4                                                      LCD_AllComsTemp[3]=6;  LCD_AllComsTemp[4]=3;  LCD_AllComsTemp[5]=0;
 168   4                                                      LCD_AllComsTemp[6]=6;  LCD_AllComsTemp[7]=3;  LCD_AllComsTemp[8]=0;
 169   4                                                      LCD_AllComsTemp[9]=0;  LCD_AllComsTemp[10]=0; LCD_AllComsTemp[11]=0;
 170   4                                                      LCD_AllComsTemp[12]=0;
 171   4                                                      LCD_Refrush();  //显示OFF
 172   4                                                      Delay_ms(300);
 173   4                                                      power_on=0;
 174   4                                              }
 175   3                                      }
 176   2                                      if(count<=1200 && count>20)
 177   2                                      break;
 178   2                      case    0x32:           //FM_set
 179   2                                      Delay_ms(10);
C51 COMPILER V7.50   MAIN                                                                  11/10/2007 23:09:45 PAGE 4   

 180   2                                      if(F_set==0)
 181   2                                      {                                       
 182   3                                              FM_ON_OFF();
 183   3                                      }
 184   2                                      break;
 185   2                      case    0x23:           //F+
 186   2                                      while(F_increase==0)
 187   2                                      {       count++;
 188   3                                              current_freq++;
 189   3                                              if(current_freq>MAX_FREQ)
 190   3                                                      current_freq=MIN_FREQ;
 191   3                                              recalculate_LcdAllComs();
 192   3                                              LCD_Refrush();
 193   3                                              Delay_ms(300);
 194   3                                              }
 195   2                                      if(count>4)
 196   2                                      {       
 197   3                                              while(((P0&0x30)|(P1&0x03))==NO_PRESS)
 198   3                                              {
 199   4                                                      current_freq++;
 200   4                                                      if(current_freq>MAX_FREQ)
 201   4                                                              current_freq=MIN_FREQ;
 202   4                                                      Delay_ms(100);
 203   4                                                      recalculate_LcdAllComs();
 204   4                                                      LCD_Refrush();
 205   4                                              }
 206   3                                      }
 207   2                                      FM_Changer();
 208   2                                      break;
 209   2                      case    0x13:           //F-
 210   2                                      while(F_decrease==0)    //短按
 211   2                                      {       
 212   3                                              count++;
 213   3                                              current_freq--;
 214   3                                              if(current_freq<MIN_FREQ)
 215   3                                                      current_freq=MAX_FREQ;
 216   3                                              recalculate_LcdAllComs();
 217   3                                              LCD_Refrush();
 218   3                                              Delay_ms(300);
 219   3                                      }
 220   2                                      if(count>4)
 221   2                                      {       
 222   3                                              while(((P0&0x30)|(P1&0x03))==NO_PRESS)
 223   3                                              {
 224   4                                                      current_freq--;
 225   4                                                      if(current_freq<MIN_FREQ)
 226   4                                                      current_freq=MAX_FREQ;
 227   4                                                      Delay_ms(100);
 228   4                                                      recalculate_LcdAllComs();
 229   4                                                      LCD_Refrush();
 230   4                                              }
 231   3                                      }
 232   2                                      FM_Changer();
 233   2                                      break;
 234   2                      default:        break;
 235   2                      }
 236   1      }
 237          //保存数据到 Flash 代码区------------------------------------------------------------------ 
 238          void FlashSave() 
 239          {
 240   1              unsigned char    Load_H; 
 241   1              unsigned char    Load_L; 
C51 COMPILER V7.50   MAIN                                                                  11/10/2007 23:09:45 PAGE 5   

 242   1              Load_L=(char)current_freq;              //取数据低8位
 243   1              Load_H=(char)(current_freq>>8); //取数据高8位
 244   1              do 
 245   1              { 
 246   2                      FMCON=0x00;                     //装载数据指令 
 247   2                      FMADRH=0x07;            //装载起始地址 
 248   2                      FMADRL=0xF0;            //装载结束地址 
 249   2                      FMDATA=Load_H;          //装载数据,地址自增 1 
 250   2                      FMDATA=Load_L;          //装载数据,地址自增 1 
 251   2                      FMCON=0x68;                     //擦除编程操作 
 252   2              }while((FMCON&0x0F)!=0);        //等待编程操作完成 
 253   1      } 
 254          //读取存储在 FLash 空间的变量--------------------------------------------------------------
 255          void  FlashLoad() 
 256          { 
 257   1              unsigned int  code *readp;              //定义读数据指针 
 258   1              readp = 0x07F0;                 //设置指针地址FMADRH 0x07  FMADRL 0xF0
 259   1              current_freq=*readp;    //将读取的值附给current_freq
 260   1      } 
 261          
 262          //主函数------------------------------------------------------------------------------------
 263          main()
 264          {
 265   1              //初始化--------------------------------------------------------------------------------
 266   1              int i=0;
 267   1              system_init1();
 268   1              FM_INIT();
 269   1              Delay_ms(10);
 270   1              //开机程序------------------------------------------------------------------------------
 271   1              for(i=0;(power_switch==0);i++)
 272   1              {       
 273   2                      Delay_ms(1);
 274   2                      if(i>=1000)
 275   2                      {
 276   3                              LCD_Init();
 277   3                              LCD_Refrush();
 278   3                              power_on=1;
 279   3                              Delay_ms(500);
 280   3                      }
 281   2              }
 282   1              FlashLoad();//加载上次正常关机时频率
 283   1              if((current_freq>1080)||(current_freq<760))current_freq=800;
 284   1              FM_Changer();
 285   1              //按键扫描------------------------------------------------------------------------------
 286   1              while(1)
 287   1              {
 288   2                      key_process();
 289   2                      Delay_ms(50);
 290   2                      recalculate_LcdAllComs();
 291   2                      LCD_Refrush();
 292   2                      Delay_ms(50);
 293   2              }
 294   1      }
 295          //中断----------------------------------------------------------------------------------------
 296          /*T1_Interrupt()  interrupt 5
 297          {
 298                  TF1 = 0;
 299                  TR1 = 0;
 300          
 301              TR1 = 1;
 302          
 303          }     */
C51 COMPILER V7.50   MAIN                                                                  11/10/2007 23:09:45 PAGE 6   



MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1069    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     52       7
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -