导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→51 ; ; ;Source&nbs

* 78572: 最小巧FSK无线收发芯片模块

   bes 
bes发表的帖子 

 51 ; ; ;Source ;code ;For ;FSK 收发模块 ;Register

void setup_tx (void)
{

 set_tx_config ();
 set_tx_freq (0);
 set_tx_pwr ();
 tx_pwr_mng_start_osc ();

 cChipStatus = 0x00;
 low_batt_cntl(); 
 wakeup_time_cntl();
}

void set_tx_config ()  
{
 send_spi_cntl(0x9F71);  //  CLK 10M,  CAP 12PF; Deviation 60K/90 //915 Century frequece //
}

void set_tx_freq (unsigned char i)
{
 int cntl;
 cntl = FreqGroup[i];
 send_spi_cntl (cntl);
}

void set_tx_pwr (void)
{
 unsigned char c0;

 c0 = tx_buf[0];
 tx_buf[0] = 0xB0;
 spi_master (1); 
 tx_buf[0] = c0;
}

void tx_pwr_mng (unsigned char mode)
{


 switch (mode) {
 case NORMAL:
#ifdef Manule_Power_Mangaer
  Globe_Pwr_mng_cntl = 0xC03E; // normal mode = ea + es + ex + ET + EB
#else
        Globe_Pwr_mng_cntl =0xc0c6;  // Auto Power Amplify Clear ET, In order for Wakeuptime continue to work.
#endif
  break;
 case STANDBY:
#ifdef Manule_Power_Mangaer
  Globe_Pwr_mng_cntl = 0xC036; // standby mode = es + ex + ET + EB  // disable power amplifier
#else
         Globe_Pwr_mng_cntl=0xc0c6;  // Auto Power Amplify Clear ET, In order for Wakeuptime continue to work.
#endif
  break;        
 }
 send_spi_cntl(Globe_Pwr_mng_cntl);
}

void tx_pwr_mng_start_osc (void)
{
          // enable oscillator & sythesizer: es + ex +ET +EB
 wait (1);       // wait 1ms
#ifdef Manule_Power_Mangaer
                  send_spi_cntl(0xc034);  //Clear ET, In order for Wakeuptime continue to work. (Maybe Mcu is rest  , IA4220 still work).
                   send_spi_cntl(0xc036);  //Enable  ET, 
 
#else
                 send_spi_cntl(0xc0c4);  // Auto Power Amplify Clear ET, In order for Wakeuptime continue to work.
                  send_spi_cntl(0xc0c6);  // 
#endif
}


void low_batt_cntl (void)
{
 send_spi_cntl(0xC207);   //2.9V
}

void wakeup_time_cntl ()
{
 send_spi_cntl(0xE232);    // 50ms=500ms
}

void wait (unsigned char millisec)
{
 int cnt;

 while (millisec--)
  for (cnt = 0; cnt   < TC_1MS; cnt++)
   ;
}

void send_spi_cntl (int cntl)
{
 unsigned char c0 = tx_buf[0];
 unsigned char c1 = tx_buf[1];

 tx_buf[0] = (unsigned char) (cntl >  >   8);
 tx_buf[1] = (unsigned char) (cntl & 0xFF);
 spi_master (2); 
 tx_buf[0] = c0;
 tx_buf[1] = c1;
}

void status_read (void)
{
 send_spi_cntl(TX_STATUS_RD);

 cChipStatus = rx_buf[1];
}




发表时间:2005年5月28日17:08:36

  
回复该帖

本主题共有 27 帖,分页:>>>>>该主题的所有内容[27]条

 *树形目录 只列出部分跟帖的标题以及简单的摘要信息 该主题的部分跟帖如下:

  100369.[详细]怎么下载不了
摘要:很遗憾,怎么下载不了?......(21字)
- [zhangrenguivtrek][1016次] 2006年12月7日

  100068.[详细]dabukai
摘要:dabukai......(7字)
- [hyzwww][1005次] 2006年11月29日

  98603.[详细]adfff
摘要:hhdg......(4字)
- [yiyanm][1038次] 2006年10月16日

[上一篇帖子]:跟我设计的查不多嘛 我得是S3C44B0x
[下一篇帖子]:那有linuxview下我想调试uclinux的内核,但是苦与找不到好一些的工具,只知道他了, BR