Questions tagged [nesc]

nesC (pronounced "NES-see") is an extension to the C programming language designed to embody the structuring concepts and execution model of TinyOS.

nesC (pronounced "NES-see") is an extension to the C programming language designed to embody the structuring concepts and execution model of TinyOS. TinyOS is an event-driven operating system designed for sensor network nodes that have very limited resources (e.g., 8K bytes of program memory, 512 bytes of RAM).

The basic concepts behind nesC are:

  • Separation of construction and composition: programs are built out of components, which are assembled ("wired") to form whole programs. Components have internal concurrency in the form of tasks. Threads of control may pass into a component through its interfaces. These threads are rooted either in a task or a hardware interrupt.

  • Specification of component behaviour in terms of set of interfaces. Interfaces may be provided or used by components. The provided interfaces are intended to represent the functionality that the component provides to its user, the used interfaces represent the functionality the component needs to perform its job.

  • Interfaces are bidirectional: they specify a set of functions to be implemented by the interface's provider (commands) and a set to be implemented by the interface's user (events). This allows a single interface to represent a complex interaction between components (e.g., registration of interest in some event, followed by a callback when that event happens). This is critical because all lengthy commands in TinyOS (e.g. send packet) are non-blocking; their completion is signaled through an event (send done). By specifying interfaces, a component cannot call the send command unless it provides an implementation of the sendDone event.

  • Typically commands call downwards, i.e., from application components to those closer to the hardware, while events call upwards. Certain primitive events are bound to hardware interrupts.

  • Components are statically linked to each other via their interfaces. This increases runtime efficiency, encourages rubust design, and allows for better static analysis of programs.

  • nesC is designed under the expectation that code will be generated by whole-program compilers. This should also allow for better code generation and analysis.

Taken from: http://nescc.sourceforge.net/

73 questions
23
votes
7 answers

Is it OK to use a code block as an argument for a C macro?

I have a pattern that is basically some boilerplate code with a part that varies in the middle if(condition){ struct Foo m = start_stuff(); { m.foo = bar(1,2); m.baz = 17; } //this part varies end_stuff(); } Is it OK to make a macro…
hugomg
  • 68,213
  • 24
  • 160
  • 246
3
votes
3 answers

Populating an array from a large array, two elements at a time

I have an array of 10 random elements, generated like this: for ( j = 0;j<10;j++) { file[j] = rand(); printf("Element[%d] = %d\n", j, file[j] ); …
AdiT
  • 539
  • 5
  • 18
2
votes
1 answer

TinyOS event return type meaning

So in TinyOS an interface is composed of commands and events. When a module uses an interface, it calls its commands and provides an implementation of its events (provides an event handler). The sense of the return type of a command is clear, it is…
2
votes
0 answers

Token passing in ring algorithm in nesC/TinyOS

How can I create a token passing protocol for motes in TinyOS? I am trying to create a token passing algorithm that passes a token from mote to mote, however I have not been successful.
user7093314
2
votes
1 answer

How do I have a two way communication in sensor node using tinyOS?

Sending a packet over the radio is acheived by using AMSend.send(AM_BROADCAST_ADDR, msg, len). In receive.receive I can check from which node did I get the message. But how do I send the message back to the same node from which I received message. I…
2
votes
1 answer

TinyOS PC to mote communication

I'm writing a piece of software for my project on Wireless Sensor Networks. Right now I'm concerned with injecting various packets into network. I'm using MIB520 interface board with TinyOS-2.1.2 installed on IRIS mote. I've tried various utilities…
proslaniec
  • 398
  • 1
  • 2
  • 13
2
votes
0 answers

xserver didn't show result from Xsensor

i have build the example Xsensor for 420cc then i plug it and put the sensor board on it, on other side for the serial board i build Xsniffer (TOSBase) to the mote that i need to put it on the 520MiP serial USB. To see the message send form mote 1…
Hana90
  • 943
  • 5
  • 17
  • 37
2
votes
1 answer

broadcast at WSN using Motes

using Xmeshfor wireless sensors nodes, 1- it is possible to make nodes (Motes) to send and received by each other ?? not just to send information to the base station ?? 2-can i modify its packet to add some field ?? 3-it is possible to store some…
Hana90
  • 943
  • 5
  • 17
  • 37
2
votes
1 answer

Packet Acknowledgements in TinyOS

Iam using telosB motes for implementation. I have come across one of the way for acknowledging the packets, task void send() { call PacketAcknowledgements.requestAck(&myMsg); if(call AMSend.send(1, &myMsg, 0) != SUCCESS) { post…
Swetha.P
  • 81
  • 2
  • 8
2
votes
1 answer

Adding source instrumentation code - Is source-to-source compiler right approach? How to build one?

I am working on a project where I need to track changes to particular set of variables in any given application code to model memory access patterns. I can think of two approaches mainly, please give your thoughts on them. My initial thought is…
Microkernel
  • 1,347
  • 4
  • 17
  • 38
2
votes
2 answers

NesC programming language

Does anyone knows where I can find tutorials and code samples, basic and advanced, of NesC programming language. Best regards
rpf
  • 3,612
  • 10
  • 38
  • 47
1
vote
1 answer

How to transmit a message to particular nodes in tinyOS?

I am trying to implement a code in TINYOS TOSSIM, where node 1 transmits a message to node 2, then node 2 transmits to node 3, which transmits a message back to node 1. It seemed to be simple, everything goes well til the point where I have to…
ViniLL
  • 107
  • 1
  • 5
  • 14
1
vote
1 answer

ACK with packet retransmission

Again I came across a doubt. I inserted in my implementation the use of ACK. In the function: AMSend.sendDone (message_t * bufPtr, error_t error) { if (call PacketAcknowledgements.wasAcked (bufPtr)) { dbg ("test", "SEND_ACK \ n"); …
ARSaraiva
  • 21
  • 2
1
vote
1 answer

Telosb Low Power Mode:

I'm working on a project that involves switching the state of the Telosb, i would like to know how to put the motes to "sleep" (low power) and how to wake the motes up.
1
vote
1 answer

Tinyos reception after second reply doesn't work

I'm in trouble with my nesC code. In my code I send a first packet using AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(rd_message)). After that, when a message is received in function event message_t* Receive.receive(message_t* bufPtr, void*…
Raffo
  • 1,642
  • 6
  • 24
  • 41
1
2 3 4 5