Maybe this will help..
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2008-January/030429.html
Kevin
On Wed, Feb 27, 2008 at 11:26 AM, Nikolay Valtchanov
<[EMAIL PROTECTED]> wrote:
> Hello.
>
> I had a small module written for TinyOS 1 and I wanted to modify it
> for TinyOS 2. It was a simple light and humidity sensing module whose
> code I'm including after the message I get from the nesc compiler. I
> am not sure what is actually throwing it off enough to bail out like
> that. Large portions are commented out as I was just trying to compile
> this at this point.
>
> Thanks.
> Nikolay
>
> [EMAIL PROTECTED]:~/code/tinyos_code/apps/Part2Sender$ make telosb
> mkdir -p build/telosb
> compiling Part2AppC to a telosb binary
> ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow
> -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -target=telosb
> -fnesc-cfile=build/telosb/app.c -board=
> -DIDENT_PROGRAM_NAME=\"Part2AppC\" -DIDENT_USER_ID=\"nikolay\"
> -DIDENT_HOSTNAME=\"nikolay-laptop\" -DIDENT_USER_HASH=0x5e662595L
> -DIDENT_UNIX_TIME=0x47c5b5e3L -DIDENT_UID_HASH=0xe9451bceL
> Part2AppC.nc -lm
> nesc1: nesc-semantics.c:145: language_name: Assertion `0' failed.
> nesC: Internal error. Please send a bug report to the nesC bug mailing list
> at [EMAIL PROTECTED]
> make: *** [exe0] Error 1
>
>
> MY AppC FILE:
>
> configuration Part2 {
> }
> implementation {
> components MainC, Part2C, new TimerMilliC(), LedsC, new
> HamamatsuS1087ParC() as LightSensor;//, HumidityC;
> //IntToRfmC
>
> Part2C.Boot -> MainC;
> // MainC.StdControl -> IntToRfmC.StdControl;
> // Main.StdControl -> TimerC.StdControl;
> // MainC.StdControl -> Part2C.StdControl;
>
> // Part2C.IntOutput -> IntToRfmC;
> // MainC.StdControl -> LightSensor.StdControl;
> // Part2C.LightADC -> LightSensor.PAR;
> // Part2C.ADCControl -> LightSensor;
>
> Part2C.HumidityTimer -> TimerMilliC;
> Part2C.FreqTimer -> TimerMilliC;
> //TimerC.Timer[unique("Timer")];
> Part2C.LightTimer -> TimerMilliC;
> //TimerC.Timer[unique("Timer")];
> Part2C.Leds -> LedsC;
>
> // Part2C.TempADC -> HumidityC.Temperature;
> // Part2C.TempSensorControl -> HumidityC;
>
> Part2C.ReadLight -> LightSensor;
> // Part2C.ReadHumidity -> HumidityC;
> }
>
>
> MY C FILE:
>
> #include "Timer.h"
>
> module Part2C {
> // provides {
> //interface StdControl;
> //}
> uses {
> interface Boot;
>
> interface Timer<TMilli> as LightTimer;
> interface Timer<TMilli> as HumidityTimer;
> interface Timer<TMilli> as FreqTimer;
>
> interface Leds;
>
> interface Read<uint16_t> as ReadLight;
> interface Read<uint16_t> as ReadHumidity;
> }
> }
> implementation {
>
>
> /**
> * Initialize the component.
> *
> * @return Always returns <code>SUCCESS</code>
>
> command result_t StdControl.init() {
> call Leds.init();
> call TempSensorControl.init();
>
> return SUCCESS;
> }
> */
>
> event void Boot.booted() {
> call FreqTimer.startPeriodic(1000);
> call LightTimer.startPeriodic(2000);
> call HumidityTimer.startPeriodic(5000);
> }
>
> event void FreqTimer.fired()
> {
> //YellowLED on if light low
> //call Leds.led0On();
> //call Leds.led1On();
> //RedLED on if humidity high
> }
>
> event void LightTimer.fired()
> {
> call ReadLight.read();
> }
>
> event void HumidityTimer.fired()
> {
> call ReadHumidity.read();
> }
>
> event void ReadLight.readDone(error_t result, uint16_t data)
> {
> if (result == SUCCESS){
> if (1.0 * data < 90) call Leds.led0On();
> else call Leds.led0Off();
> }
>
> }
>
> event void ReadHumidity.readDone(error_t result, uint16_t data)
> {
> if (result == SUCCESS){
> if (-38.4 + 0.0098 * data > 29.44) call Leds.led1On();
> else call Leds.led1Off();
>
> data = data | 32768;
>
>
> //message to receiver?
> //call IntOutput.output(data);
> }
>
> }
>
>
>
>
> /**
> * Start things up. This just sets the rate for the clock component.
> *
> * @return Always returns <code>SUCCESS</code>
>
> command result_t StdControl.start() {
> // call LightTimer.start(TIMER_REPEAT, 1000);
> // call TempTimer.start(TIMER_REPEAT, 5000);
> call LightTimer.startPeriodic( 1000 );
> call TempTimer.startPeriodic( 5000 );
> call TempSensorControl.start();
> return SUCCESS;
> }
>
> */
>
> /**
> * Halt execution of the application.
> * This just disables the clock component.
> *
> * @return Always returns <code>SUCCESS</code>
> *
> command result_t StdControl.stop() {
> call LightTimer.stop();
> call TempTimer.stop();
> call TempSensorControl.stop();
> return SUCCESS;
> }
> */
>
> /**
> * SplitControl requires implementation of these,
> * but we don't need anything inside.
> **
> event result_t TempSensorControl.initDone() {
> return SUCCESS;
> }
> event result_t TempSensorControl.startDone() {
> return SUCCESS;
> }
> event result_t TempSensorControl.stopDone() {
> return SUCCESS;
> }
> */
>
>
> /*
> // ADC data ready event handler
> async event result_t LightADC.dataReady(uint16_t data) {
>
> call IntOutput.output(data);
>
> if (1.0 * data < 90) call Leds.yellowOn();
> else call Leds.yellowOff();
>
> return SUCCESS;
> }
>
>
> // Formula on the left is in C; 85F = 29.44C
> async event result_t TempADC.dataReady(uint16_t data) {
>
> if (-38.4 + 0.0098 * data > 29.44) call Leds.greenOn();
> else call Leds.greenOff();
>
> data = data | 32768;
> call IntOutput.output(data);
>
>
>
> return SUCCESS;
> }
> */
>
> }
>
>
>
> --
> Nikolay Valtchanov
> McCormick School of Engineering and Applied Science
> Northwestern University 2009
> Cell: 614 633 7923
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
--
~Kevin
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help