Hi All,
      I am trying to collect light sensor data from MTS400 sensor board and
display that data in PC. I am having MicaZ mote and MIB520 programming
board. My code is as follows:

*MyApp.nc:*

includes SensorboardApp;
configuration MyApp {
}
implementation {
    components Main,MyAppM,TimerC,LedsC,GenericComm,TaosPhoto;
    Main.StdControl -> MyAppM.StdControl;
    Main.StdControl -> TimerC.StdControl;
    Main.StdControl -> GenericComm.Control;
    MyAppM.Timer -> TimerC.Timer[unique("Timer")];
    MyAppM.Leds -> LedsC.Leds;
    MyAppM.SendMsg -> GenericComm.SendMsg[AM_XSXMSG];
    MyAppM.PhotoControl -> TaosPhoto.TaosPhotoM;
    MyAppM.Light -> TaosPhoto.TaosPhotoM;
}

*MyAppM.nc*

includes sensorboardApp;
module MyAppM {
    provides {
        interface StdControl;
    }
    uses {
        interface Timer;
        interface Leds;
        interface SendMsg;
        interface StdControl as PhotoControl;
        interface ADC as Light;
    }
}
implementation {
    bool sending_packet = FALSE;
    TOS_Msg msg_buffer;
    XDataMsg *pack;

    command result_t StdControl.init() {
        call Leds.init();
        call PhotoControl.init();

        atomic {
            pack = (XDataMsg *)&(msg_buffer.data);
            pack -> XSensorHeader.board_id = SENSOR_BOARD_ID;
            pack -> XSensorHeader.packet_id = 2;
            pack -> XSensorHeader.node_id = TOS_LOCAL_ADDRESS;
            pack -> XSensorHeader.rsvd = 0;
        }
        return SUCCESS;
    }

    command result_t StdControl.start() {
          return call Timer.start(TIMER_REPEAT, 2000);
    }
    command result_t StdControl.stop() {
        return call Timer.stop();
    }
    event result_t Timer.fired() {
        call Leds.redToggle();
        call PhotoControl.start();
        call Light.getData();
        return SUCCESS;
    }
    void task SendData() {
        call PhotoControl.stop();
        if(sending_packet) return;
        atomic sending_packet = TRUE;
        if (call SendMsg.send(TOS_UART_ADDR,sizeof(XDataMsg),&msg_buffer) !=
SUCCESS)
            sending_packet = FALSE;
        return;
    }

    event result_t Light.dataReady(uint16_t data) {
    atomic pack -> XData.data1.taoch0 = data;
    atomic pack -> XData.data1.vref = 417;
    post SendData();
    call Leds.yellowToggle();
    return SUCCESS;
    }
    event result_t SendMsg.sendDone(TOS_MsgPtr msg, result_t success) {
    call Leds.greenToggle();
    atomic sending_packet = FALSE;
    return SUCCESS;
    }
}


I am getting following errors while compiling:

compiling MyApp to a micaz binary
ncc -o build/micaz/main.exe -Os -finline-limit=100000 -I%T/platform/micaz
-I%T/lib/Queue -I%T/sensorboards/mts400  -I%T/lib/Broadcast -I%T/lib/XLib
-DROUTE_PROTOCOL=0x90 -I%T/radio/cc2420 -I%T/lib/internal/XMesh
-DMULTIHOPROUTER=XMeshRouter -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d
-Wnesc-all -target=micaz -fnesc-cfile=build/micaz/app.c -board=mts400
-DIDENT_PROGRAM_NAME="MyApp"
-DIDENT_PROGRAM_NAME_BYTES="77,121,65,112,112,0" -DIDENT_USER_ID="admin"
-DIDENT_USER_ID_BYTES="97,100,109,105,110,0" -DIDENT_HOSTNAME="dhivya"
-DIDENT_HOSTNAME_BYTES="100,104,105,118,121,97,0"
-DIDENT_USER_HASH=0x46b777a5L -DIDENT_UNIX_TIME=0x47eb81feL
-DCC2420_DEF_CHANNEL=11  -DCC2420_TXPOWER=TXPOWER_MAX MyApp.nc -lm
MyApp.nc:50:3: warning: no newline at end of file
MyAppM.nc:127:3: warning: no newline at end of file
In file included from MyAppM.nc:1,
                 from MyApp.nc:21:
sensorboardApp.h:40: redefinition of `struct XSensorHeader'
sensorboardApp.h:40: warning: tag XSensorHeader shadows enclosing
struct/union/enum
sensorboardApp.h:45: conflicting types for `XSensorHeader'
SensorboardApp.h:45: previous declaration of `XSensorHeader'
sensorboardApp.h:49: redefinition of `struct GGAMsg'
sensorboardApp.h:49: warning: tag GGAMsg shadows enclosing struct/union/enum
sensorboardApp.h:59: conflicting types for `GGAMsg'
SensorboardApp.h:59: previous declaration of `GGAMsg'
sensorboardApp.h:62: redefinition of `struct XSensorMTS400DataMsg'
sensorboardApp.h:62: warning: tag XSensorMTS400DataMsg shadows enclosing
struct/union/enum
sensorboardApp.h:76: conflicting types for `XSensorMTS400DataMsg'
SensorboardApp.h:76: previous declaration of `XSensorMTS400DataMsg'
sensorboardApp.h:79: redefinition of `AM_XSXMSG'
SensorboardApp.h:79: previous declaration of `AM_XSXMSG'
sensorboardApp.h:82: redefinition of `struct XDataMsg'
sensorboardApp.h:82: warning: tag XDataMsg shadows enclosing
struct/union/enum
sensorboardApp.h:88: conflicting types for `XDataMsg'
SensorboardApp.h:88: previous declaration of `XDataMsg'
In file included from MyApp.nc:21:
In component `MyAppM':
MyAppM.nc: In function `StdControl.init':
MyAppM.nc:46: struct has no member named `XSensorHeader'
MyAppM.nc:46: `SENSOR_BOARD_ID' undeclared (first use in this function)
MyAppM.nc:46: (Each undeclared identifier is reported only once
MyAppM.nc:46: for each function it appears in.)
MyAppM.nc:47: struct has no member named `XSensorHeader'
MyAppM.nc:48: struct has no member named `XSensorHeader'
MyAppM.nc:49: struct has no member named `XSensorHeader'
MyAppM.nc: At top level:
MyAppM.nc:109: `Light.dataReady': async mismatch with declaration
/opt/MoteWorks/tos/interfaces/ADC.nc:48: previous declaration of
`Light.dataReady'
MyAppM.nc: In function `Light.dataReady':
MyAppM.nc:111: struct has no member named `XData'
MyAppM.nc:112: struct has no member named `XData'
In component `MyApp':
MyApp.nc: At top level:
MyApp.nc:45: cannot find `TaosPhotoM'
MyApp.nc:48: cannot find `TaosPhotoM'
make: *** [exe0] Error 1


 Any one please help me to solve these errors..


-- 
thanks & regards,
Dhivya
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to