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

📄 tea5757.lst

📁 本程序演示 :以非利普TEA5767 为核心的
💻 LST
📖 第 1 页 / 共 3 页
字号:
               radio_state |= RADIO_MANUSCAN_UP;
               mcu_send_state();
              }
              
              void mcu_manuscan_down(void)
              {
               radio_state &= 0xf0;
               radio_state |= RADIO_MANUSCAN_DOWN;
               mcu_send_state();
              }
              
              void mcu_autoscan_up(void)
              {
               radio_state &= 0xf0;
               radio_state |= RADIO_AUTOSCAN_UP;
               mcu_send_state();
              }
              
              void mcu_autoscan_down(void)
              {
               radio_state &= 0xf0;
               radio_state |= RADIO_AUTOSCAN_DOWN;
               mcu_send_state();
              }
              
              
              void mcu_set_bandfreq(unsigned char band)
              {
               
               if(band == RADIO_FM)
                radio_freq = fm_khz/10;
               else
                radio_freq = fm_khz | ((unsigned int)(band)<<14);
               
               command_buff[0] = (unsigned char)((radio_freq>>8) & 0xff);
               command_buff[1] = (unsigned char)(radio_freq & 0xff);
               mcu_set_freq(command_buff);
              }
              
              unsigned char mcu_read_radio_state(void)
              {
               unsigned char temp;
               
               mcu_read_state(receive_data);
               temp = receive_data[0];
               receive_data[0] = 0;
               return temp;
C51 COMPILER V7.50   TEA5757                                                               05/12/2009 22:59:41 PAGE 6   

              }
              
              unsigned int mcu_read_radio_freq(void)
              {
               unsigned int temp;
               mcu_read_freq(receive_data);
               temp = receive_data[0];
               temp = (temp<<8) & 0xff00;
               temp |= receive_data[1];
               receive_data[0] = 0;
               receive_data[1] = 0;
               return temp;
              }
              
              void fm_init(void)
              {
               //mute fm
               fmw_stand_by_rtn(off);
               /*
               fm_pwr_on;//power on radio
               delay720(100);   
               fm_khz = 87500; 
               mcu_set_bandfreq(RADIO_FM);
               */
               //unmute fm
              }
              
              void fmw_all_mute_rtn(unsigned char onoff)
              {
              }
              
              void Radio_manual_scan(unsigned char dir)
              { 
               unsigned char status;
               unsigned int freq;
              
               if(dir)
                mcu_manuscan_up();
               else
                mcu_manuscan_down();
              
              }
              
              void Radio_auto_scan(unsigned char dir)
              { 
               unsigned char status;
               unsigned int freq;
              
               if(dir)
                mcu_autoscan_up();
               else
                mcu_autoscan_down();
              }
              
              #else
              
              unsigned char fm_rd_byte[5] = {0,0,0,0,0}; // Read buf
              unsigned char fm_wr_byte[5] = {0,0,0,0,0}; // write but
              unsigned int fm_khz; 
              
              void delay720(unsigned int count)
              {
C51 COMPILER V7.50   TEA5757                                                               05/12/2009 22:59:41 PAGE 7   

                for(;count>0;count--) ;
               // 1:0.84, 5:1.36, 10:1.96, 20:3.20, 30:4.48, 60:8.04, 80:10.6, 90:11.6, 100:13
              }
              /* ---------------------------------- Command Function ------------------------------------ */
              
              void fmw_hilo_side_rtn(unsigned char hilo)
              {
               if(hilo) fm_wr_byte[2] |= 0x10;
               else  fm_wr_byte[2] &= 0xef;
              }
              
              void fmw_all_mute_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[0] |= 0x80;
               else   fm_wr_byte[0] &= 0x7f;
              }
              
              void fmw_search_mode_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[0] |= 0x40;
               else   fm_wr_byte[0] &= 0xbf;
              }
              
              void fmw_search_dir_rtn(unsigned char dir)
              {
               if(dir) fm_wr_byte[2] |= 0x80;
               else fm_wr_byte[2] &= 0x7f;
              }
              
              void fmw_search_level_rtn(unsigned char level)
              {
               switch(level)
               {
                case all_level : fm_wr_byte[2] &= 0x9f;
                       break;
                case lo_level :  fm_wr_byte[2] &= 0xbf;
                       fm_wr_byte[2] |= 0x20;
                       break;
                case mid_level : fm_wr_byte[2] |= 0x40;
                       fm_wr_byte[2] &= 0xdf;
                       break;
                case hi_level  : fm_wr_byte[2] |= 0x60;
                       break;
               }
              }
              
              void fmw_stereo_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[2] &= 0xf7;
               else   fm_wr_byte[2] |= 0x08;
              }
              
              void fmw_mute_left_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[2] |= 0x04;
               else   fm_wr_byte[2] &= 0xfb;
              }
              
              void fmw_mute_right_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[2] |= 0x02;
               else   fm_wr_byte[2] &= 0xfd;
C51 COMPILER V7.50   TEA5757                                                               05/12/2009 22:59:41 PAGE 8   

              }
              
              void fmw_stand_by_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[3] |= 0x40;
               else   fm_wr_byte[3] &= 0xbf;
              }
              
              void fmw_band_sel_rtn(unsigned char sel)
              {
               if(sel) fm_wr_byte[3] |= 0x20;
               else    fm_wr_byte[3] &= 0xdf;
              }
              
              void fmw_xtal_sel_rtn(unsigned char sel)
              {
               if(sel) fm_wr_byte[3] |= 0x10;
               else    fm_wr_byte[3] &= 0xef;
              }
              
              void fmw_soft_mute_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[3] |= 0x08;
               else   fm_wr_byte[3] &= 0xf7;
              }
              
              void fmw_hcc_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[3] |= 0x04;
               else   fm_wr_byte[3] &= 0xfb;
              }
              
              void fmw_snc_rtn(unsigned char onoff)
              {
               if(onoff) fm_wr_byte[3] |= 0x02;
               else   fm_wr_byte[3] &= 0xfd;
              }
              
              void fmw_search_indi_rtn(unsigned char sel)
              {
               if(sel) fm_wr_byte[3] |= 0x01;
               else fm_wr_byte[3] &= 0xfe;
              }
              
              void fmw_pll_ref_rtn(unsigned char sel)
              {
               if(sel) fm_wr_byte[4] |= 0x80;
               else    fm_wr_byte[4] &= 0x7f;
              }
              
              void fmw_deemph_rtn(unsigned char sel)
              {
               if(sel) fm_wr_byte[4] |= 0x40;
               else    fm_wr_byte[4] &= 0xbf;
              }
              
              unsigned char fmr_ready_flag_rtn(void)
              {
               return (unsigned char)((fm_rd_byte[0] >> 7) & 0x01);
              }
              
              unsigned char fmr_band_limit_rtn(void)
C51 COMPILER V7.50   TEA5757                                                               05/12/2009 22:59:41 PAGE 9   

              {
               return (unsigned char)((fm_rd_byte[0] >> 6) & 0x01);
              }
              
              unsigned short fmr_pll_rtn(void)
              {
               unsigned short temp = 0;
               
               temp = (unsigned short)((fm_rd_byte[0] & 0x3f) << 8);
               temp |= (unsigned short)fm_rd_byte[1];
               
               return temp;
              }
              
              unsigned char fmr_stereo_indi_rtn(void)
              {
               return (unsigned char)((fm_rd_byte[2] >> 7) & 0x01);
              }
              
              unsigned char fmr_if_count_rtn(void)
              {
               return (unsigned char)(fm_rd_byte[2] & 0x7f);
              }
              
              unsigned char fmr_level_adc_rtn(void)
              {
               return (unsigned char)((fm_rd_byte[3] >> 4) & 0x0f);
              }
              
              /* ------------------------------ End Command function ------------------------------------- */
              unsigned char fm_rd_rtn(unsigned char *ptr)
              {

⌨️ 快捷键说明

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