Difference between revisions of "Toggling a TelosB ADC Pin"

From Cyber-Physical Systems Laboratory
Jump to navigationJump to search
 
(6 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
== TinyOS 2.x ==
 
== TinyOS 2.x ==
  
In TinyOS 2.x, pin toggling is controlled via the following interface:
+
In TinyOS 2.x, pins are toggled via interface tos/chips/msp430/pins/HplMsp430GeneralIO.nc.
 +
 
 +
There is a configuration file called "HplMsp430GeneralIOC" in the same directory that provides multiple instances of the above interface, one for each port.  The port corresponds to the port number of the MCU, some of which map to exposed pins on the TelosB.  See the schemetics of the TelosB to determine which ports map to which exposed pins on the PCB.  Toggling the port consists of calling the following commands:
  
 
<blockquote>
 
<blockquote>
tos/chips/msp430/pins/HplMsp430GeneralIO.nc
+
HplMsp430GeneralIO.makeOutput() <br>
 +
HplMsp430GeneralIO.clr()<br>
 +
HplMsp430GeneralIO.set()<br>
 +
HplMsp430GeneralIO.toggle()
 
</blockquote>
 
</blockquote>
  
There is a configuration file with a similar name in the same directory as above that provides multiple instances of the above interface, one for each port.  The port corresponds to the port number of the MCUToggling the port consists of calling the following commands:
+
Here is an example application that demonstrates how to toggle pins on the TelosB in TinyOS 2.x: [http://www.cse.wustl.edu/~liang/software/t2/TelosBPinToggleT2.zip Link]
 
 
<pre>
 
HplMsp430GeneralIO.makeOutput()
 
HplMsp430GeneralIO.clr()
 
HplMsp430GeneralIO.set()
 
HplMsp430GeneralIO.toggle()
 
</pre>
 

Latest revision as of 16:05, 22 September 2009

TinyOS 1.x

First do this in StdControl.init():

TOSH_MAKE_ADC3_OUTPUT();

To set the pin high:

TOSH_SET_ADC3_PIN();

To set the pin low:

TOSH_CLR_ADC3_PIN();

You can of course switch the ADC number, and maybe even replace it with GIO#.

TinyOS 2.x

In TinyOS 2.x, pins are toggled via interface tos/chips/msp430/pins/HplMsp430GeneralIO.nc.

There is a configuration file called "HplMsp430GeneralIOC" in the same directory that provides multiple instances of the above interface, one for each port. The port corresponds to the port number of the MCU, some of which map to exposed pins on the TelosB. See the schemetics of the TelosB to determine which ports map to which exposed pins on the PCB. Toggling the port consists of calling the following commands:

HplMsp430GeneralIO.makeOutput()
HplMsp430GeneralIO.clr()
HplMsp430GeneralIO.set()
HplMsp430GeneralIO.toggle()

Here is an example application that demonstrates how to toggle pins on the TelosB in TinyOS 2.x: Link