Well, Sorry about that.
I really appreciate your help

Attached is my ToneDetector files.

I have moved the declaration of the datamsg* packet to the beginning of the 
function block, then I got these warnings and the program doesn't function 
properly:


mune...@muneera-vaio:~/tos/tinyos-2.x/apps/AcousticRanger/ToneDetector$ make 
micaz
mkdir -p build/micaz
    compiling ToneDetectorAppC to a micaz binary
ncc -o build/micaz/main.exe  -Os -DATM128_I2C_EXTERNAL_PULLDOWN=1 
-fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=micaz 
-fnesc-cfile=build/micaz/app.c -board=mts300 -DDEFINED_TOS_AM_GROUP=0x22 
--param max-inline-insns-single=100000 -DIDENT_APPNAME=\"ToneDetectorApp\" 
-DIDENT_USERNAME=\"muneera\" -DIDENT_HOSTNAME=\"muneera-vaio\" 
-DIDENT_USERHASH=0xfb432861L -DIDENT_TIMESTAMP=0x4cc2a549L 
-DIDENT_UIDHASH=0xf1dd381aL -fnesc-dump=wiring 
-fnesc-dump='interfaces(!abstract())' -fnesc-dump='referenced(interfacedefs, 
components)' -fnesc-dumpfile=build/micaz/wiring-check.xml ToneDetectorAppC.nc 
-lm
/home/muneera/tos/tinyos-2.x/tos/chips/cc2420/lpl/DummyLplC.nc:39:2: warning: 
#warning "*** LOW POWER COMMUNICATIONS DISABLED ***"
ToneDetectorC.nc:56: warning: `Timer0.stop' called asynchronously from 
`MicSetting.toneDetected'
ToneDetectorC.nc:58: warning: `DataPacket.getPayload' called asynchronously 
from `MicSetting.toneDetected'
ToneDetectorC.nc:58: warning: `DataPacket.getPayload' called asynchronously 
from `MicSetting.toneDetected'
ToneDetectorC.nc:61: warning: `DataSend.send' called asynchronously from 
`MicSetting.toneDetected'
ToneDetectorC.nc:23: warning: non-atomic accesses to shared variable `counterT':
ToneDetectorC.nc:48: warning:   non-atomic read
    compiled ToneDetectorAppC to build/micaz/main.exe
           12902 bytes in ROM
             294 bytes in RAM
avr-objcopy --output-target=srec build/micaz/main.exe build/micaz/main.srec
avr-objcopy --output-target=ihex build/micaz/main.exe build/micaz/main.ihex
    writing TOS image


Best Regards,


Muneera A. Albabtain
Researcher


MUNEERA A. ALBABTAIN wrote:
> I really appreciate your help.
>
> I did declare 'msg' in the beginning of the module implementation:
>
> implementation {
>        uint16_t counterT =0;
>        message_T msg;
>
> // The rest of the functions
>
> I feel that I'm missing something but I don't know what it is.
>
> Thank you
>
>
> Best Regards,
>
>
> Muneera A. Albabtain
> Researcher
>
> ________________________________________
> From: Michael Schippling [[email protected]]

>
> You haven't included the part of your program where 'msg' is declared,
> so it's hard to say exactly why the compiler is whining...
>
> The problem with packet is that variables can only be declared at the
> beginning of code blocks in C and Nesc. A code block is surrounded by
> { } braces, so declarations are usually put at the beginning of
> the function.
>
> In answer to your audio recording question, search this list for
> audio, microphone, and similar key words. I sent some links, maybe
> last month, that didn't seem to help much but could provide guidance.
>
> MS
>
>
> MUNEERA A. ALBABTAIN wrote:
>> Hello again,,
>>
>> I have been trying to do my own acoustic ranger application with micaz motes 
>> (mts310CA sensorboard).
>>
>> I have three nodes:
>> Node1: only sends an RF packet to node2 and buzz the sounder at the same 
>> time.
>> Node2: Receives the RF packet sent from node1 and increments a counter ( 
>> with a timer) until it detects the buzzer sound to calculate the distance 
>> between the two motes, then it will send a data packet to the baseStation 
>> node with the counter.
>> BaseStation node (Node0): receives the data packet from node2 and displays 
>> the counter value.
>>
>> I'm having a problem with node 2 when I compile the program, the error 
>> details are the following:
>> mune...@muneera-vaio:~/tos/tinyos-2.x/apps/AcousticRanger/ToneDetector$ make 
>> micaz
>> mkdir -p build/micaz
>>     compiling ToneDetectorAppC to a micaz binary
>> ncc -o build/micaz/main.exe  -Os -DATM128_I2C_EXTERNAL_PULLDOWN=1 
>> -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=micaz 
>> -fnesc-cfile=build/micaz/app.c -board=mts300 -DDEFINED_TOS_AM_GROUP=0x22 
>> --param max-inline-insns-single=100000 -DIDENT_APPNAME=\"ToneDetectorApp\" 
>> -DIDENT_USERNAME=\"muneera\" -DIDENT_HOSTNAME=\"muneera-vaio\" 
>> -DIDENT_USERHASH=0xfb432861L -DIDENT_TIMESTAMP=0x4cb2d7fdL 
>> -DIDENT_UIDHASH=0x0fb961f5L -fnesc-dump=wiring 
>> -fnesc-dump='interfaces(!abstract())' -fnesc-dump='referenced(interfacedefs, 
>> components)' -fnesc-dumpfile=build/micaz/wiring-check.xml 
>> ToneDetectorAppC.nc -lm
>> In file included from ToneDetectorAppC.nc:13:
>> In component `ToneDetectorC':
>> ToneDetectorC.nc:40: warning: declaration of `msg' shadows global declaration
>> ToneDetectorC.nc:24: warning: location of shadowed declaration
>> ToneDetectorC.nc: In function `MicSetting.toneDetected':
>> ToneDetectorC.nc:55: syntax error before `*'
>> ToneDetectorC.nc:56: `packet' undeclared (first use in this function)
>> ToneDetectorC.nc:56: (Each undeclared identifier is reported only once
>> ToneDetectorC.nc:56: for each function it appears in.)
>>
>>
>> --------------------------------------------------------
>>
>> The MicSetting.toneDetected function:
>> async event error_t MicSetting.toneDetected() {
>>
>>                 // Stuff to do when tone detected
>>                 call Timer0.stop();
>>                 call Leds.led1Toggle();
>>                 datamsg_t* packet = (datamsg_t*)(call 
>> DataPacket.getPayload(&msg, sizeof(datamsg_t)));
>>                 packet-> nodeID = TOS_NODE_ID;
>>                 packet-> counter = counterT;
>>                 call DataSend.send(0, &msg, sizeof(datamsg_t));
>>
>>
>>                 return SUCCESS;
>>         }
>>
>> ----------------------------------------------------------------
>> The header file:
>> #ifndef SENSORMSG_H
>> #define SENSORMSG_H
>>
>> enum{
>>         AM_DATAMSG = 6,
>> };
>>
>>
>> typedef nx_struct datamsg{
>>         nx_uint8_t nodeID;
>>         nx_uint16_t counter;
>>
>> }datamsg_t;
>>
>>
>> #endif
>>
>> ------------------------------------------------------------------
>>
>> I'm sure that the noteDetection works fine the led toggles, also I have 
>> included the header file in both configuration and module files.
>>
>> I don't know where the problem is exactly!
>>
>> I really appreciate your help and thank you in advance
>>
>>
>> Best Regards,
>>
>>
>> Muneera A. Albabtain
>> Researcher
>>
>> Disclaimer: This message and its attachment, if any, are confidential and 
>> may contain legally privileged information. If you are not the intended 
>> recipient, please contact the sender immediately and delete the  message and 
>> its attachment, if any. You should not copy the message or disclose its 
>> contents to any other person or use it for any purpose. Statements and 
>> opinions expressed in this e-mail are those of the sender, and do not 
>> necessarily reflect those of King Abdulaziz city for Science and Technology  
>> (KACST). KACST accepts no liability for damage caused by this email.
>>
>> _______________________________________________
>> Tinyos-help mailing list
>> [email protected]
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
> Disclaimer: This message and its attachment, if any, are confidential and may 
> contain legally privileged information. If you are not the intended 
> recipient, please contact the sender immediately and delete the  message and 
> its attachment, if any. You should not copy the message or disclose its 
> contents to any other person or use it for any purpose. Statements and 
> opinions expressed in this e-mail are those of the sender, and do not 
> necessarily reflect those of King Abdulaziz city for Science and Technology  
> (KACST). KACST accepts no liability for damage caused by this email.

Disclaimer: This message and its attachment, if any, are confidential and may 
contain legally privileged information. If you are not the intended recipient, 
please contact the sender immediately and delete the  message and its 
attachment, if any. You should not copy the message or disclose its contents to 
any other person or use it for any purpose. Statements and opinions expressed 
in this e-mail are those of the sender, and do not necessarily reflect those of 
King Abdulaziz city for Science and Technology  (KACST). KACST accepts no 
liability for damage caused by this email.

Attachment: ToneDetector.tar.gz
Description: ToneDetector.tar.gz

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

Reply via email to