关于整个系统如何为TelosB工作,我有一个非常基本的问题。我已经阅读了数据手册以及TelosB的操作方式。
现在,我需要通过TelosB节点发送一些特定的数据。我看到了TinyOS的数据包格式。并定义了有效载荷。
typedef nx_struct packet {
nx_uint16_t id; /* Mote id of sending mote. */
nx_uint16_t count; } packet_t;
在收音机计数指示灯代码中,我改变了一些小东西
#include "Timer.h"
#include "RadioCountToLeds.h"
module RadioCountToLedsC @safe() {
uses {
interface Leds;
interface Boot;
interface Receive;
interface AMSend;
interface Timer<TMilli> as MilliTimer;
interface SplitControl as AMControl;
interface Packet;
}
}
implementation {
message_t packet;
bool locked;
uint16_t counter = 0;
event void Boot.booted() {
call AMControl.start();
}
event void AMControl.startDone(error_t err) {
if (err == SUCCESS) {
call MilliTimer.startPeriodic(250);
}
else {
call AMControl.start();
}
}
event void AMControl.stopDone(error_t err) {
// do nothing
}
event void MilliTimer.fired() {
counter++;
dbg("RadioCountToLedsC", "RadioCountToLedsC: timer fired, counter is
%hu.\n", counter);
if (locked) {
return;
}
else {
radio_count_msg_t* rcm = (radio_count_msg_t*)call
Packet.getPayload(&packet, sizeof(radio_count_msg_t));
if (rcm == NULL) {
return;
}
rcm->counter = 11110000;
if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(radio_count_msg_t)) == SUCCESS) {
dbg("RadioCountToLedsC", "RadioCountToLedsC: packet sent.\n", counter);
locked = TRUE;
}
}
}
计数器是我要传输的数据。它是11110000。在Telosb节点中运行TinyOS代码时,如何解释11110000?对于什么数据要输入到telosb或OQPSK的DAC中,我需要非常具体。
我想详细了解如何读取和解释数据。