随笔分类 -  tinyos

tinyos:data[]
摘要:问题引入在编译下面一段代码时,无意中发现了这样一个错误:.....typedef nx_struct test_msg { nx_uint8_t data[];} test_msg_t.....错误:van9ogh@WSN:Git$ gcc test.c test.c:4: error: flexible array member in otherwise empty struct但如果换成这样:.....typedef nx_struct test_msg { nx_uint8_t counter; nx_uint8_t data[];} te... 阅读全文

posted @ 2012-05-06 17:22 vincent Van Gogh 阅读(844) 评论(0) 推荐(0)

avr isp:uisp
摘要:Avr系列烧写程序,使用的工具为uisp,这个可以在每次使用make micaz install mib520,/dev/ttyUSB0看到,输出如下:cp build/micaz/main.srec build/micaz/main.srec.out installing micaz binary using mib510uisp -dprog=mib510 -dserial=/dev/ttyUSB0 --wr_fuse_h=0xd9 -dpart=ATmega128 --wr_fuse_e=ff --erase --upload if=build/micaz/main.srec... 阅读全文

posted @ 2012-05-05 16:28 vincent Van Gogh 阅读(360) 评论(0) 推荐(0)

利用TinyOS写一个专门转发数据包的App
摘要:由于节点的通信半径非常小(micaz大约15m),因此对于一个大型网络,节点数量可能成百上千个,因此往往数据包需要经过多跳才能到达目的地,这里我们使用ActiveMessageC组件提供的Snoop接口来完成这样的一个功能具体功能:该节点接受任意包,并且将它发送给目的节点直接贴代码了,很好懂的。ForwardAppC.nc#define NEW_PRINTF_SEMANTICS#include "printf.h"configuration ForwardAppC {}implementation { components ForwardC as App; componen 阅读全文

posted @ 2012-05-04 17:06 vincent Van Gogh 阅读(2239) 评论(1) 推荐(1)

BlinkToRadioAppC
摘要:tinyOS 2.x 的 App/tutorial/BlinkToRadio文件夹下面有demo:节点通信下面分析一下:BlinkToRadioAppC.nc#include<Timer.h>#include"BlinkToRadio.h"configurationBlinkToRadioAppC{}implementation{////////////////////////////////基本配线,连线MainC.Boot, LedsC.Leds, Timer0.TimercomponentsMainC;componentsLedsC;componentsB 阅读全文

posted @ 2012-03-28 20:59 vincent Van Gogh 阅读(1202) 评论(0) 推荐(0)

tinyos :Cyclic redundancy check
摘要:tinyos2.0的CRC16在tinyos/tos/lib/tosboot/crc.h文件中有关于ITU Standard CRC-16的实现生成多项式为:G_16(x) = x^16 + x^12 + x^5 + 11uint16_tcrcByte(uint16_tcrc,uint8_tb)2{3uint8_ti;45crc=crc^b<<8; //表示新的数据和生成的CRC可以进行合并,即先将crc左移8位再和b异或6i=8;7do8if(crc&0x8000) //如果最高位为1那么先将crc左移移位再与0x1021异或,其实这里的0x1021表示 //x^12+. 阅读全文

posted @ 2012-03-27 17:05 vincent Van Gogh 阅读(311) 评论(0) 推荐(0)

导航