Tinyos tutorial learning tips -- lesson 4

介绍了组件图的层次化分解和无线通信。

CntToLedsAndRfm:读取计数器的数值并输出到LED和无线收发模块的栈中。

RfmToLeds:从无线收发模块中接收数据并显示到LED中。

分别编译到两个节点上,然后进行通信测试。

# 单个接口可以连接到多个实现(implementation),如main.stdcontrol

# 配接箭头的方向可以任意,如:

IntToLeds <- Counter.IntOutput;         等同于         Counter.IntOutput -> IntToLeds

# 在配置(Configuration)中也可以提供接口,而不仅仅是使用和配接已有的接口。

# 模块的重命名,如:

components IntToRfmM, GenericComm as Comm;

# 等于号的使用:

IntOutput = IntToRfmM;

其中IntOutput接口是此配置中提供的接口。这里不能用->,因为那是用来连接一个used interface provided implementation的。

 

//没看明白,为什么说confusing

This is how we specify that Active Messages received with the AM_INTMSG handler ID should be wired to the RfmToIntM.ReceiveMsg interface. The direction of the arrow might be a little confusing here. The ReceiveMsg interface (found in tos/interfaces/ReceiveMsg.nc)only declares an event: receive(), which is signaled with a pointer to the received message. So RfmToIntM uses the ReceiveMsg interface, although that interface does not have any commands to call -- just an event that can be signaled.

 

# 给节点确定地址,如:

make mica install.38

 

# 问题:如何确定发送信息的目的地址?

Send.send(TOS_BCAST_ADDR, sizeof(IntMsg), &data)

其中 TOS_BCAST_ADDR 就是发送信息的目的地址。 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值