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

📄 main.c

📁 利用zigbee进行定位的程序
💻 C
字号:
//----------------------------------------------------//
//-------Institute Of  Computing Technology-----------//
//------------Chinese Academic  Science---------------//
//-----中国科学院计算技术研究所先进测试技术实验室-----//
//----------------------------------------------------//

/**
 * www.wsn.net.cn
 * @copyright:nbicc_lpp
 * @data:2005.11.22
 * @version:0.0.1
 * @updata:$
 *
 */
#include "top.h"
#include "generic.h"

//--------------------------------------------------------


//--------------------------------------------------------
//---------------------------------------------------------------
inline uint8_t hardwareInit(void)
{  OS_SET_PIN_DIRECTIONS();
  return SUCCESS;}


//---------------------------------------------------------
int   main(void)
{

  hardwareInit();
  Leds_greenOn();
  Leds_redOn();
  Leds_yellowOn();
  IoInit();
  
  OS_sched_init();
  cc2420_init();
  os_atomic_enable_interrupt();
  
  //-------------------------------------------------
  //init rssi and payload var
 //-------------------------------------------------
  isready=0;
  tend=0;
  payload=0;
  pagenum=0;
  testnum=0;
  for (int i=0;i<1003;i++)
       	{
       		
			rssi[i]=0;
       	}
  
prssi=rssi;  
  
  //-------------------------------------------------
  //some test for extflash
 //-------------------------------------------------
 extflash_ini();

 for (int i=0;i<264;i++)
		       	{
		       	test[i]=0;
		       	}    
 				Main_Memory_PageRead(0, 0x0000, test, 264);//read the content of a page
 
 				while(!(Status_Register_Get()&0x80));
 //-----------------
 if ((test[0]!=0xff)&&1)
 	{
 		printf("\nflash is not empty!test[0]is %02x\n",test[0]);
 	}
 else
 	{
		
		for (int i=0;i<1024;i++)
				{
			 		PageErase(i);
					while(!(Status_Register_Get()&0x80));
				}
		
 	}
	

  cc2420_setchnl(1);
  cc2420_setrxmode();
  cc2420_enableAddrDecode();
  cc2420_setpanid(0x0004);
  cc2420_setshortaddress(0x0004);
  cc2420_enablefifop();
  Leds_greenOff();
  Leds_redOff();
  Leds_yellowOn();
  while(1) {
  	OS_run_task();
  	}
}

⌨️ 快捷键说明

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