Home

Wireless Sensor Networks for Monitoring Cracks in Structures

image

Contents

1. P An n nodeid to send command to node nodeid An g group to send command over group groupid sequence number of command seq _no An XCommand list An wake sleep reset lt interval in 41111866 gt 18 6 80 An set_rate lt interval in seconds gt An set_leds lt number from 0 7 lt An set_sound lt 0 off l on gt An red_on red off red toggle An green on green_off green_toggle An yellow_on yellow_off yellow_toggle An set quick lt 0 off 1 on gt An set_ticks lt integer gt An set_pot lt integer gt n n w fax x Extracts command line options and sets flags internally param argc Argument count param argv Argument vector Gauthor Martin Turon 2 UC 7420 SOFTWARE 99 x Qversion 2004 3 10 mturon Intial version n 2004 3 12 mturon Added b s g x n 2004 8 04 mturon Added 1 ver 1 11 n 2004 8 22 mturon Added i ver 1 13 n 2004 9 27 mturon Added t ver 1 15 n 2004 9 29 mturon Added f a v 1 16 void parse args int argc char argv This value is set if when the bitflag is set unsigned baudrate 0 char server port g params flat 0 default to no params set xpacket_initialize while argc if argv argc RE xargv argc switch argv arsc 1 case
2. if arg lt 100 arg 100 msg gt inst 0 param newrate arg printf narg is 08x n msg gt inst 0 param newrate return sizeof XCommandMsg int xcmd set nodeid char buffer int int int 2 UC 7420 SOFTWARE 111 XCommandMsg msg XCommandMsg x buffer unsigned arg xcmd set config buffer XCOMMAND SET NODEID 0xFFFF msg gt inst 0 param nodeid arg return sizeof XCommandMsg xcmd set group char buffer XCommandMsg msg XCommandMsg x buffer unsigned arg xcmd set config buffer XCOMMANDSET GROUP 0xFF msg gt inst 0 param group arg return sizeof XCommandMsg xcmd set rf_power char gt buffer XCommandMsg msg XCommandMsg x buffer unsigned arg xcmd set config buffer XCOMMAND SET RF POWER 0xFF msg inst 0 param rf_power arg return sizeof XCommandMsg xcmd set rf channel char buffer XCommandMsg msg XCommandMsg x buffer unsigned arg xcmd set config buffer XCOMMAND SET RF CHANNEL 0xFF msg inst 0 J param rf channel arg return sizeof XCommandMsg extern int xmesh cmd light path char x buffer fax List of commands handled by XSensor applications using XCommand XCmdHandler xsensor cmd list 4 get_serialid xcmd_get _serialid get_config xcmd_get_config Power Management reset xcmd_reset wake xcmd_wake sleep xcmd_
3. Double toString t else if i 12 amp amp lineType 1 battery voltage logOut println Battery Voltage intVal 10 dataRow 2 Double toString intValx 10 else if i 10 amp amp lineType 2 humidity if t 0 t 25 use this as a default value double h temporary humidity value h 0 0405 x intVal 4 intVal intVal 0 0000028 h t 25 0 01 0 00128 intVal h if h gt 100 h 100 logOut println Humidity h dataRow 3 Double toString h else if i 12 amp amp lineType 2 data logOut println Data 12500 gt intVal 2048 0 1 34 MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG dataRow 4 Double toString 12 500 intVal 2048 0 1 else 11 1 4 seconds into test int secs 0 secs lm getElement_log i 3 OxFF secs lt lt 8 secs lm getElement_log i 2 amp OxFF secs lt lt 8 secs lm getElement_log i 1 amp OxFF secs lt lt 8 secs lm getElement log i amp OxFF logOut println seconds into test intVal dataRow 0 Integer toString intVal else 11 1 8 amp amp lineType 1 samples remaning logOut println intVal samples dataRow 6 Integer toString intVal else if i 10 amp amp lineType 1 samples logOut println intVal samples tot
4. break case 3 XSensorMDA300Data3 data XSensorMDA300Data3 packet data printf mda300 id 02x d1 04x d2 04x d3 04x d4 04x d5 04x packet gt node id data gt digi0 data gt digil data gt digi2 data gt digi3 data gt digi4 data gt digi5 break case 4 XSensorMDA300Data4 data XSensorMDA300Data4 packet data printf 7 mda300 id 02x bat 04x hum 04x temp 04x cntr 04x n packet gt node_id data gt battery data gt sensirion humidity data gt sensirion thermistor data gt counter break case 5 XSensorMDA300Data5 data XSensorMDA300Data5 packet gt data printf mda300 id 02x bat 04x hum 04x temp 04x echol0 04x echo20 04x soiltemp 04x n packet gt node_id data gt battery data gt sensirion humidity data gt sensirion thermistor data gt adc0 data gt adcl data gt adc2 break case 6 XSensorMDA300Data6 data XSensorMDA300Data6 packet gt data printf mda300 id 02x bat 04x hum 04x temp 04x adc0 04x adcl 04x adc2 04x n dig0 04x digl 04x dig2 04x n packet gt node id data gt vref data gt humid data gt humtemp data gt adc0 data gt adcl data gt adc2 data dig0 data gt digl data dig2 break default printf mda300 error unknown packet id i n packet gt packet_id MDA300 specific dis
5. exit 2 XCmdBuilder cmd_bldr xpacket_get_builder g_am_type g command if cmd_bldr printf error Command not found for AM type d g am type g command exit 2 printf Sending d s s g seg no g command g argument len xpacket_build_cmd buffer cmd_bldr g params bits mode_socket xpacXet print rav buffer len xserial_port_write_packet g_ostream buffer len return 1 ALALIA Ul IL O User Manual Follows TAA A TT TT TT FT TT TT FEW TT WU TT fax mainpage XCommand Documentation section version Version Id xcommand c v 1 4 2004 11 11 01 00 51 mturon Exp section usage Usage Usage xcommand lt v g gt command argument An lt s device gt lt b baud gt lt i server port An lt n nodeid gt lt g group gt lt seq_no gt lt a app AM type gt n display help help n q quiet mode suppress headers n show version of all modules n b set the baudrate baud mica2 mica2dot n s set serial port device device coml n i internet serial forwarder inet host port n n nodeid to send command to node nodeid n g group to send command over group groupid n a application or AM type of command message app type n sequence number of command seq_no n n XCommand list n wake sleep reset n set_rate lt interval in millisec gt
6. v xlisten Ver Id xlisten c v 1 11 2004 08 04 21 06 41 mturon Exp 87 Id mep401 c v 1 10 2004 08 04 21 06 41 mturon Exp 86 Id mts400 c v 1 15 2004 08 04 21 06 41 husq Exp 85 Id mts400 c v 1 15 2004 08 04 21 06 41 mturon Exp 84 Id mts300 c v 1 14 2004 08 04 21 06 41 husq Exp 83 Id mts300 c v 1 14 2004 08 04 21 06 41 mturon Exp 82 Id mtsl01 c v 1 5 2004 08 04 21 06 41 husq Exp 81 Id mda300 c v 1 4 2004 08 04 17 15 22 jdprabhu Exp 80 Id mda500 c v 1 11 2004 08 04 21 06 41 husq Exp 03 Id mep500 c v 1 3 2004 08 04 21 06 41 mturon Exp 02 Id mts510 c v 1 6 2004 08 04 21 06 41 husq Exp 01 Id mda500 c v 1 11 2004 08 04 21 06 41 abroad Exp Be PRP PRP Pe ee RB subsection debug d debug This flag puts xlisten in a mode so that it behaves exactly like the TinyOS raw listen tool tinyos 1 x tools src raw_listen c All other command line options except b baud and s serial will be ignored This mode is mainly used for compatibility and debugging serial port issues Individual bytes will be displayed as soon as they are read from the serial port with no post processing In most cases r raw is eguivalent and preferred to using debug mode Gsubsection display Display Options n n n n n n n n n n n n n n n n n The r p and c flags are considered display options These can be passed in various combinations to display multiple views of the same packet at once The d
7. version 2004 10 5 mturon Initial version event result_t XCommand received XCommandOp opcode switch opcode gt cmd case XCOMMAND SET RATE Change the data collection rate MPK timer_rate opcode gt param newrate call Timer stop call Timer start TIMER REPEAT timer rate MPK atomic maxTicks opcode gt param newrate MPK atomic timerTicks 0 MPK break case XCOMMAND SLEEP Stop collecting data and go to sleep sleeping TRUE call Timer stop call Leds set 0 break case XCOMMAND WAKEUP Wake up from sleep state if sleeping 1 MPK 96 MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE initialize call Timer start TIMERREPEAT timer rate sleeping FALSE break case XCOMMAND RESET Reset the mote now break case XOOMMAND ACTUATE break default break return SUCCESS ifdef XMESHSYNC task void SendPing XDataMsg pReading uinti6 t Len MODIFICATION VERSION 2 XMDA300 SHAKF if pReading XDataMsg 6811 Send getBuffer msg_ptr amp Len pReading gt xmeshHeader parent call RouteControl getParent if call Send send msg_ptr sizeof XDataMsg atomic sending packet FALSE SUCCESS event TOS_MsgPtr DownTree receive TOS _MsgPtr pMsg void payload uint16 t payloadLen if sending_packet call Leds yellowToggle atomic sending_packet TRUE post SendPin
8. 0 call Leds yellowOn call PowerMgrDisable TOSH_uwait 1000 if call SendUART send TOS_UART_ADDR atomic sending_packet FALSE call Leds greenToggle call PowerMgrEnable sizeof XDataMsg msg ptr SUCCESS else Hendif Send the RF packet call Leds yellowOn if call Send send msg ptr sizeof XDataMsg SUCCESS atomic sending_packet FALSE call Leds yellowOn call Leds greenOff BEGIN MPK INT CODE TOSH SIGNAL SIG_INTERRUPT6 1 MICA2 SOFTWARE 91 EIMSK 1 lt lt 6 disable ext int 6 post send_radio_msg END MPK INT CODE if FEATUREUARTSEND fax x Handle completion of sent UART packet Gauthor Martin Turon version 2004 7 21 mturon Initial revision event result_t SendUART sendDone TOS_MsgPtr msg result_t success if msg gt addr TOSUART ADDR atomic msg_ptr msg msg_ptr gt addr TOS BCAST ADDR if call Send send msg ptr sizeof XDataMsg SUCCESS atomic sending packet FALSE call Leds yellowOff if TOSLOCAL ADDRESS 0 never turn on power mgr for base call PowerMgrEnable return SUCCESS endif fax Handle completion of sent RF packet author Martin Turon x version 2004 5 27 mturon Initial revision event result t Send sendDone TOS MsgPtr msg result_t success atomic msg ptr msg sending_packet FALSE
9. call Dio3 getData break case 4 call Dio4 getData break case 5 call Dio5 getData break default return if SampleRecord i channelType COUNTER call Counter getData return return command result t SamplerControl init int i call CounterControl init call DioControl init call IBADCcontrol init call BatteryControl init call TempHumControl init for i 0 i lt MAXSAMPLERECORD i SampleRecord i sampling_interval SAMPLE RECORD FREE SampleRecord i ticks_left Oxffff atomic flag25 FLAG NOT SET flag33 FLAG NOT SET flag50 FLAG NOT SET return SUCCESS command result_t SamplerControl start stopFlag FALSE MPK call CounterControl start call DioControl start call IBADCcontrol start call BatteryControl start call TempHumControl start 3 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY 71 call CounterControl start post next schedule next 861601810 return SUCCESS command result t SamplerControl stop int i MPK stopFlag TRUE MPK call SamplerTimer stop MPK atomic MPK for i 0 i lt MAXSAMPLERECORD i MPK MEK call Sample stop i MPK MEK MEK call CounterControl stop call DioControl stop call IBADCcontrol stop call BatteryControl stop call TempHumControl stop
10. call Leds yellowOff if FEATURE UART SEND if TOS LOCAL ADDRESS 0 never turn on power mgr for base call PowerMgrEnable endif return SUCCESS 92MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 fax x Handle a single dataReady event for all MDA300 data types author Leah Fera Martin Turon Qversion 2004 3 17 leahfera Intial revision n 2004 4 1 mturon Improved state machine event result t Sample dataReady uint8_t channel uint8_t channelType uint16_t data uint8_t i switch channelType case ANALOG switch channel MSG 1 first part of analog channels 0 6 case 0 Original line MPK case 7 MPK just cram ADC7 into ADCO s spot tmppack XDataMsg packet data tmppack gt xData datap6 adc0 data atomic msg status 0x01 break case 1 tmppack XDataMsg packet data tmppack gt xData datap6 adcl data atomic msg status 0x02 break case 2 tmppack XDataMsg packet data tmppack gt xData datap6 adc2 data atomic msg status 0x04 break default break case ANALOG channel break case DIGITAL switch channel case 0 tmppack XDataMsg packet data tmppack gt xData datap6 dig0 data atomic msg status 0x08 break SHAKE 1 MICA2 SOFTWARE 93 case l tmppack XDataMsg packet data tmppack gt xData datap6 digl data atomic msg status 0x10
11. data atomic msg status 0x20 break default break case DIGITAL channel break case BATIERY tmppack XDataMsg packet data tmppack gt xData datap6 vref data atomic msg status 0x40 break case HUMIDITY tmppack XDataMsg packet data tmppack gt xData datap6 humid data atomic msg status 0x80 break case TEMPERATURE tmppack XDataMsg packet data tmppack gt xData datap6 humtemp data atomic msg status 0x100 break default break switch channelType if sending packet return SUCCESS if msg status pkt full msg status 0 packetCount MPK if packetCount gt 3 MPK MPK call SamplerControl stop MPK packetCount 0 MPK get rid of timer ticks accumulated while sampling MPK atomic timerTicks 0 MPK MPK 49 30 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 if packetCount gt 1 MPK first ADC reading always is bad post send radio msg return SUCCESS OCICS ICICI RL LE Timer Fired 3 3 3 3 3 3 36 36 36 36 36 36 36 5 56 56 56 56 ICICI ICICI IIIA ICICI ICI IK ak ak a ak event result_t Timer fired MPK if sending_packet return SUCCESS don t overrun buffers if test 0 test 0 call relay_normally_closed toggle call Leds greenOn else test 1 call relay_normally_open toggle call Leds gre
12. inline void setparam_analog uint8_t i uint8_t param switch SampleRecord i case 0 ca brea case l ca brea case 2 ca brea case 3 ca brea case 4 ca brea case 5 ca brea case 6 ca brea case 7 ca brea case 8 ca brea case 9 ca brea case 10 ca brea case 11 ca brea case 12 ca brea case 13 SetParam0 Kj SetParaml Kj SetParam2 SetParam3 SetParam4 SetParam5 K SetParam6 SetParam7 K 3 SetParam8 0 87819 Kj channel setParam param setParam param setParam param set Param param setParam param setParam param setParam param setParam param setParam param setParam param SetParam10 setParam param SetParam11 setParam param SetParam12 setParam param 88 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 call SetParaml3 setParam param break default return static inline void setparam digital int8 t i uint8_t param switch SampleRecord i channel case 0 ca Dio0 setparam param break case 1 ca Diol setparam param break case 2 ca Dio2 setparam param break case 3 ca Dio3 setparam param break case 4 ca Dio4 setparam param break case 5 ca Dio5 setparam param break default return static
13. int xcmd yellow_off char buffer return xcmd actuate buffer XCMD DEVICE LED YELLOW 0 int xcmd_yellow_on char buffer return xcmd actuate buffer XCMD DEVICE LED YELLOW 1 int xcmd yellov toggle char x buffer return xcmd actuate buffer XCMD DEVICE LED YELLOW 2 SI MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE J MPR int xcmd set_pot char xbuffer int pot 7 if g argument pot atoi g_argument return xcmd actuate buffer XCMD DEVICE POT pot int xcmd set leds char buffer int leds 7 default to all on if g argument leds atoi g_argument return xcmd actuate buffer XCMD DEVICE LEDS leds int xcmd _set_sounder char buffer int sounder 0 default to off if g argument sounder atoi g argument return xcmd actuate buffer XCMD DEVICE SOUNDER sounder unsigned xcmd set config char x buffer unsigned cmd unsigned mask XCommandMsg msg XCommandMsg x buffer unsigned arg mask default to maximum value if g argument arg atoi g argument arg amp mask xcmd_set_header buffer Data payload msg gt seq_no g_seq_no msg gt dest g_dest msg gt inst 0 cmd cmd return arg int xcmd set rate char buffer XCommandMsg msg XCommandMsg x buffer unsigned arg xcmd set config buffer XCOMMANDSET RATE 0xFFFFFFFF if arg OxFFFFFFFF arg 5000
14. length l type uintl6 gt lt Data lt lt XField name ElReferenceADC byteoffset 16 length 2 type uintl6 gt lt XField name E1Excitation V byteoffset 18 length 2 type uintl16 gt lt XConversion function 1 225 2 x y returntype float gt lt XConvParam variablename x fieldname El1ExcitationV type float gt lt XConvParam variablename y fieldname E1ReferenceADC type float gt lt XConversion gt lt XField gt lt potentiometer conversion report volts lt lt XField name RangeV byteoffset 20 length 2 type uintl6 gt lt XConversion function 1 225 x z returntype float gt lt XConvParam variablename x fieldname RangeV type float gt lt XConvParam variablename z fieldname E1ReferenceADC type float gt lt XConversion gt lt XField gt lt XFields gt lt XFilter gt gt LOGIC SocketID XSensorEKo AND BoardID SensorId AND PacketID 0 lt lt XCondAnd gt lt XCond name IsEqual gt lt XFilterParam name fieldname value socketId gt lt XFilterParam name fieldvalue value 0x34 gt lt XCond gt lt XCond name IsEqual gt lt XFilterParam name fieldname value boardId gt lt XFilterParam name fieldvalue value
15. printf MDA300 sensor data converted to engineering units n health node id i parent i battery i mV seq_no i n 2 echol0 Soil Moisture 0 2f n 2 echo20 Soil Moisture 0 2f n soil temperature 0 2f Fyn temperature 0 21 C n humidity 0 11 n n packet gt node id packet parent xconvert_battery_mica2 data gt battery data gt seg no xconvert_echol0 data gt adc0 xconvert_echo20 data gt adcl xconvert_spectrum soiltemp data gt adc2 xconvert_sensirion_temp amp data gt sensirion xconvert_sensirion_humidity amp data gt sensirion MDA300 specific display of converted readings for packet 5 void mda300_print_cooked_6 XbowSensorboardPacket packet XSensorMDA300Data6 data XSensorMDA300Data6 packet gt data XSensorSensirion xsensor xsensor humidity data gt humid xsensor thermistor data gt humtemp char timestring TIMESTRING SIZE Timestamp time_now timestamp nev timestamp get string time now timestring printf s timestring timestamp delete time nov if xconvert_battery_mica2 data gt vref 0 printf MDA300 Cooked n tTime t t tID tParent tTemp C RA n 318MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE data t s t i t i t 0 2f t 0 1 tIMPACT n n timestring packet gt node_id packet
16. return SUCCESS command result_t PlugPlay return call Plugged event result_t SamplerTimer fired uint8_t i sample anyone which is supposed to be sampled for i 0 i lt MAX SAMPLERECORD i 11 SampleRecord i sampling interval SAMPLE RECORD FREE if SampleRecord i ticks left 0 SampleRecord i ticks_left SampleRecord i sampling interval sampleRecord i now see when timer should be fired for new samples post next schedule if stopFlag MPK MPK next schedule MPK return SUCCESS Z2MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 command result t Sample set_digital_output uint8_t channel uint8 t state command int8_t Sample getSample uint8_t channel uint8_t channelType uint16_t interval uint8 int8_t i i get_avilable_SampleRecord if iz l return i SampleRecord i channel channel SampleRecord i channelType channelType SampleRecord i ticks_left 0 used for keeping the monostable timer SampleRecord i sampling intervalzinterval Sampling interval set by command above SampleRecord in no use if set to zero SampleRecord i param param if SampleRecord i channelType DIGITAL setparam digital i param channelType COUNTER setparam counter i param channelType ANALOG setparam analog i param f SampleRecord i f SampleRecord i retu
17. should be valid even out of the scope of that function since I2CPacketM nc uses it by its uint8 t condition set the condition command byte set of bitwise functions define testbit var bit var amp 1 lt lt bit 11 zero then return zero and if one n define setbit var bit var 1 lt lt bit define clrbit var bit var amp 7 1 lt lt bit The excitation circuits define FIVEVOLT ON TOSH SET_PW5 PIN define FIVE VOLT_OFF TOSH CLR_PW5_PIN define THREEVOLT TOSH SET_PW3_PIN define THREE VOLT OFF TOSH CLR PVV3 PIN define TURNVOLTAGEBUFFERON TOSH SET PVV2 PIN define TURN VOLTAGE BUFFER_OFF TOSH CLR PVV2 PIN define VOLTAGE BOOSTER ON TOSH CLR PWIPIN define VOLTAGE BOOSTER_ OFF TOSH SET PVV1 PIN The instrumentation amplifier define TURN AMPLIFIERS ON TOSH SET_PW6 PIN define TURN AMPLIFIERS OFF TOSH CLR PVV6 PIN 2 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY 55 declareation of function convert result_t convert void setExcitation VOLTAGE BOOSTER ON if param chan amp EXCITATION 25 TURN VOLTAGE BUFFER ON if param chan EXCITATION 33 THREE VOLT if param chan EXCITATION 50 FIVE_VOLT_ON void resetExcitation uint8_t i uint8_t flag25 0 flag33 0 flag50 0 for i 0 i gt MAX CHANNELS i if param i amp EXCITATION ALVVAYS ON
18. 161 gt 138 4 e amp o MOTE BASED WIRELESS ACPS SOFTWARE lt XCond gt lt XCond name IsEqual gt lt XFilterParam name fieldname value packetId gt lt XFilterParam name fieldvalue value 0x0 gt lt XCond gt lt XCondAnd gt lt XFilter gt lt XDataSinks gt lt XDataSink name Generic Print Datasink gt lt XDSParam name printstring value Vishay Crack Propagation Sensor wide spacing s s n Parent s PortID s n RangeV s V ExcitV s RefADC s gt lt XDSParam name printfields value 0081010 packetId ParentID nodeId RangeV ElExcitationV E1ReferenceADC gt lt XDataSink gt lt XDataSink name Generic File Datasink gt lt XDSParam name rawfilename value Vishay_Crack_Propagation_Wide_Spacing_Raw csv gt lt XDSParam name parsedfilename value Vishay_Crack_Propagation_Wide_Spacing_Parsed csv gt lt XDSParam name convertedfilename value Vishay_Crack_Propagation_Wide_Spacing_Converted csv gt lt XDSParam name delim value gt lt XDSParam name header value yes gt lt XDSParam name timestamp value 7an 4ed oY H M S gt lt XDSParam name backup value yes gt lt XDataSink gt lt XDataSink name Sensor Log Datasink gt lt XDSParam name sensorid value 16l gt lt XDSParam name tablename value
19. J 16MICA2 BASED WIRELESS ACM VERSION I SOFTWARE MODIFICATION OF SENSELIGHTTOLOG This software is largely based on software written by the University of California As per the implied license agreement the original copyright notice is below tab 4 Copyright c 2000 2003 The Regents of the University of California All rights reserved Permission to use copy modify and distribute this software and its documentation for any purpose without fee and without written agreement is hereby granted provided that the above copyright notice the following two paragraphs and the author appear in all copies of this software IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT INDIRECT SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE SOFTWARE PROVIDED HEREUNDER IS ON AN AS IS BASIS AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE SUPPORT UPDATES ENHANCEMENTS OR MODIFICATIONS Copyright c 2002 2003 Intel Corporation All rights reserved This file is distributed under the terms in the attached INTEL LICENSE file
20. L LIBDIR LFLAGS clean rm f o boards o xlisten xlisten arm xlisten exe 6 6 0 0 SE 2 UC 7420 SOFTWARE 121 Listens to the serial port and outputs sensor data in human readable form file xlisten c Gauthor Martin Turon version 2004 3 10 mturon Initial version Copyright c 2004 Crossbow Technology Inc All rights reserved Id xlisten c v 1 17 2004 11 18 04 45 10 mturon Exp include xsensors h static const char g_version Id xlisten c v 1 17 2004 11 18 04 45 10 mturon Exp A structure to store parsed parameter flags typedef union unsigned flat struct output display options unsigned display_raw 1 lt raw TOS packets unsigned display_parsed 1 lt pull out sensor readings unsigned display_cooked 1 lt convert to engineering units unsigned export_parsed 1 lt output comma delimited fields unsigned export_cooked 1 lt output comma delimited fields unsigned log_parsed 1 lt log output to database unsigned 4 1 lt log output to database unsigned display_time 1 lt display timestamp of packet unsigned display ascii 1 lt display packet as ASCII characters unsigned display_rsvd 7 lt pad first word for output options modes of operation unsigned display help T unsigned display baud 1 lt baud was set by user unsigned mode debug 1 lt debug serial port unsigned mode quiet 1
21. XBOVV TOS SENSORBOARDS MDA300 DIRECTORY 53 2 xbow tos sensorboards mda300 directory Copyright c 2003 The Regents of the University of California All rights reserved Redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met Redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Authors Mohammad Rahimi mhr cens ucla edu History created 08 14 2003 update at 11 14
22. command result t ADConvert getContinuousData uint8_t idj return FAIL event result_t I2CPacket readPacketDone char length char data if length 2 state IDLE TURN_AMPLIFIERS_OFF atomic clrbit adc bitmap chan post adc get data signal ADConvert dataReady chan ADC_ERROR resetExcitation 82MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 return FAIL if state GETSAMPLE value data 1 amp Oxff data 0 lt lt 8 amp 0x0f00 conversionNumber value data 0 lt lt 8 01 value data 1 amp Oxff if conversionNumber 0 state IDLE if param chan amp AVERAGE SIXTEEN value value 8 lt lt 4 amp OXOfff the addition is for more percision else if param chan amp AVERAGEEIGHT value value 4 gt gt 3 OXOfff the addition is for more percision else if param chan amp AVERAGEFOUR value value 2 gt gt 2 the addition is for more percision else do nothing since no averaging TURN AMPLIFIERS OFF atomic clrbit adc bitmap chan post adc get data signal ADConvert dataReady chan value resetExcitation else state CONTINUE SAMPLE convert return SUCCESS event result_t I2CPacket writePacketDone bool result if result state IDLE TURN_AMPLIFIERS_OFF atomic clrbit adc_bitmap chan post adc_get_
23. condition 15 break case 11 condition O break case 12 condition 1 break case 13 condition 2 break shift the channel and single ended input bits over condition condition lt lt 4 amp 0xf0 condition condition 0x0f tell the ADC to start converting if call I2CPacket writePacket 1 char amp condition 0x03 FAIL state IDLE post adc_get_data resetExcitation return FALSE return SUCCESS TURN_AMPLIFIERS_OFF get a single reading from id we command result t ADConvert getData uint8 t id 2 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY 61 if id gt 13 return FAIL should never happen unless wiring is wrong atomic setbit adc_bitmap id post adc get data return SUCCESS Setting the MUX has been done event result t Switch setAllDone bool r if r state IDLE TURN_AMPLIFIERS_OFF post adc_get_data resetExcitation return FAIL If the conversions happens fast there is no need to wait for settling of the power supply note that power supply should be set ON by user using the excitation command if param chan amp DELAY BEFORE MEASUREMENT call PowerStabalizingTimer start TIMER ONESHOT VOLTAGESTABLE TIME return SUCCESS else return convert return SUCCESS event result_t PowerStabalizingTimer fired return convert not yet implemented
24. g params bits display_help 1 break case g g params bits mode guiet 1 break case p g params bits display_parsed 1 break case g params bits display raw 1 break case c g_params bits display_cooked 1 break case f switch argv argc 2 case specify arbitrary offset g params bits mode framing 8 01 break case a automatic deframing g params bits mode framing 0 break case 0 case n assume no framing SOQMICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 g params bits mode_framing break case 1 force framing default g_params bits mode framing break break b if argv argc 2 case baudrate g params bits break case s if argv argc 2 xserial set device ar break case a if argv argc 2 g am type break case g if argv argc 2 g group 4 atoi argv argsc 3 break case n if argv argc 2 gv 8186 3 8 008 atoi ar break case ff if argv argc 2 4 g seg no atoi argv argc 3 break case t g params bits display time 1 break case i display baud 1 gv arge 3 atol argv argc 3 2 xserial_set_baud argv argc 3 SHAKE 2 UC 7420 SOFTWARE 101 g params bits mode
25. gt parent xconvert_sensirion_temp amp xsensor xconvert_sensirion_humidity amp xsensor else printf MDA300 Cooked n tTime t t tID tParent tTemp C RA t Bat mV tADC7 mV n data t s t i t i t 0 2f t 0 1 t i t t O 3f n n timestring packet gt node_id packet gt parent xconvert_sensirion_temp amp xsensor xconvert_sensirion_humidity amp xsensor xconvert_battery mica2 data gt vref float xconvert adc precision data gt adc0 1000 printf MDA300 sensor data converted to engineering units n health node id i parent i battery i mV n 3 echol0 Soil Moisture 0 2f n 1 602020 Soil Moisture 0 2f n soil temperature 0 2f Fyn temperature 0 21 C n humidity 0 11 n n packet gt node_id packet parent xconvert_battery mica2 data gt vref xconvert_echol0 data gt adc0 xconvert_echo20 data gt adcl xconvert_spectrum soiltemp data gt adc2 xconvert_sensirion_temp amp xsensor xconvert sensirion humidity amp xsensor MDA300 specific display of converted readings from an XSensor packet void mda300_print_cooked XbowSensorboardPacket packet 1 switch packet gt packet id case l mda300_print_cooked_1 packet break case 2 2 UC 7420 SOFTWARE 119 mda300_print cooked_2 packet break case 3 mda300_print_cooked_3 packet break case 4 mda300_print_c
26. if param i EXCITATION 25 flag25 1 if param i EXCITATION 33 flag33 1 if param i EXCITATION 50 flag50 1 if flag25 0 TURN VOLTAGE BUFFER OFF if flag33 0 THREE VOLT OFF if flag50 0 FIVEVOLT OFF if flag25 amp amp flag33 amp amp flag50 VOLTAGE BOOSTER OFF command void EXCITATION35 on param MAX CHANNELS 1 EXCITATION 25 param MAX CHANNELS 1 EXCITATION ALVVAYS ON VOLTAGE BOOSTER ON TURN VOLTAGE BUFFER ON command void EXCITATION25 off i param MAX CHANNELS 1 amp lEXCITATION 25 if state IDLE resetExcitation otherwise the fuction will be called at the end of conversion 26 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 command void EXCITATION33 on param MAX CHANNELS 1 EXCITATION 33 param MAX CHANNELS 1 EXCITATION ALVVAYS ON VOLTAGE BOOSTER ON THREE_VOLT_ON command void EXCITATION33 off param MAX CHANNELS 1 amp EXCITATION 33 if state IDLE resetExcitation otherwise the fuction will be called at the end of conversion command void EXCITATION5SO on param MAX CHANNELS 1 EXCITATION 50 param MAX CHANNELS 1 EXCITATION ALVVAYS ON VOLTAGE BOOSTER ON FIVE_VOLT_ON command void EXCITATIONS0 off param MAX CHANNELS 1 amp EXCITATION 50 if state IDLE resetExcit
27. n set leds lt number from 0 7 gt n set sound lt 0 off 1 on gt An red on red off red toggle 30MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE n green_on green off green_toggle n yellow_on yellow off yellow_toggle n section params Parameters subsection help help XCommand has many modes of operation that can be controlled by passing command line parameters The current list of these command line options and a brief usage explanation is always available by passing the flag n n A detail explanation of each command line option as of version 1 1 follows subsection versions v versions Displays complete version information for all sensorboard decoding modules within xcommand n xcmd v n xcommand Ver Id xcommand c v 1 1 2004 10 07 19 33 13 mturon Exp n f8 Id cmd XMesh c v 1 4 2004 10 08 00 33 20 mturon Exp n 30 Id cmd_XSensor c v 1 2 2004 10 07 23 14 25 mturon Exp n 12 Id cmd_Surge c v 1 1 2004 10 07 19 33 13 mturon Exp n 08 Id cmd SimpleCmd c v 1 1 2004 10 07 19 33 13 mturon Exp subsection quiet q quiet This flag suppresses the standard xcommand header which displays the version string and parameter selections subsection baud b baudrate baud This flag allows the user to set the baud rate of the serial line connection The default baud rate is 57600 bits per second which is compatible with the Mica2 The desired
28. uint8 tx amp currentRow2 rowWaiting 0 fax x Handle a single dataReady event for all MDA300 data types event result_t Sample dataReady uint8_t channel uint8 t channelType uintl6_t data 11 12MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE switch channelType case ANALOG switch channel case 7 atomic currentRow2 DATA POS data lineStatus READY DATA break default break case ANALOG channel break case BATTERY atomic currentRowl BATT POS data lineStatus READY BATTERY break case HUMIDITY atomic currentRow2 HUMID POS data lineStatus READY HUMIDIIY break case TEMPERATURE atomic currentRow2 TEMP POS data lineStatus READY TEMPERATURE break default break switch channelType if lineStatus LINEREADY MODIFICATION OF SENSELIGHTTOLOG lineStatus 0 atomic currentRowl SAMPLE POS uint16 t nsamples currentRowl SAMPLE POS 1 uint16_t total_samples currentRow1 SECS_POS uint16_t secs currentRowl SECS POS secs amp OxFFFF currentRow2 SECS POSJ currentRowl SECS POS currentRowl SECS POS 1 secs gt gt 16 amp OxFFFF currentRow2 SECS POS 1 currentRowl SECS POS 1 currentRowl SCRATCH POS 0x7777 1 MDA300LOGGER DIRECTORY 13 currentRowl TIME POS time sec amp OxFFFF currentRow2 TIME POS currentRowl TIME POS curr
29. 10 call Sample getSample 10 ANALOG ANALOG SAMPLING TIME AVERAGEFOUR EXCITATION 25 record 11 call Sample getSample 11 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT record 12 call Sample getSample 12 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT record 13 call Sample getSample 13 ANALOG ANALOG SAMPLING _TIME SAMPLER DEFAULT EXCITATION 50 EXCITATION ALWAYS ON MPK digital chennels as accumulative counter record 17 call Sample getSample 0 DIGITAL DIGITAL SAMPLING TIME RESET ZERO AFTER READ FALLING_EDGE record 18 call Sample getSample 1 DIGITAL DIGITAL SAMPLING TIME RISING EDGE EVENT record 19 call Sample getSample 2 DIGITAL DIGITAL SAMPLING TIME SAMPLER DEFAULT EVENT record 20 call Sample getSample 3 DIGITAL 1 MICA2 SOFTWARE 89 DIGITAL SAMPLING TIME FALLING_EDGE record 21 call Sample getSample 4 DIGITAL DIGITAL SAMPLING TIME RISING EDGE record 22 call Sample getSample 5 DIGITAL DIGITAL_SAMPLING_TIME RISING_EDGE EEPROM TOTALIZER counter channels for frequency measurement will reset to zero record 23 call Sample getSample 0 COUNTER MISC_SAMPLING_TIME RESET ZERO AFTER READ RISING_EDGE call Leds greenOn MPK else call Leds redOn return SUCCESS pe 56 56 fe 3 3 6 fe de 3 3 36 de de 3 3 36 fe 56 de 3 36 fe fe de de 3 36
30. 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE added pot line to above MPK enum XCMD STATE OFF 0 XCMD STATE ON 1 XCMD STATE TOGGLE XSensorSubState typedef struct XCommandOp uintl6 t cmd XCommandOpcode union uint32_t newrate lt FOR XCOMMAND SET RATE uintl6_t nodeid lt FOR XCOMMAND SET NODEID uint8_t group lt FOR XCOMMAND SET GROUP uint8_t rf power lt FOR XCOMMAND SET RF POWER uint32 t rf_channel lt FOR XCOMMAND SET RF CHANNEL FOR XOOMMAND ACCIUATE gt struct uintl6_t device 1 gt LEDS sounder relay uintl6_t state lt off on toggle actuate param attribute_ packed XCommandOp typedef struct XCommandMsg TOSMsgHeader tos uint1l6_t seg no lt Reguired by lib Broadcast Bcast uintl6 t dest lt Destination nodeid OxFFFF for all XCommandOp inst 1 __attribute__ packed XCommandMsg void xcmd set header char buffer Fill in TOS msg header XCommandMsg msg XCommandMsg x buffer msg gt tos addr g dest msg gt tos type AMTYPEXCOMMAND msg gt tos group g group msg gt tos length sizeof XCommandMsg sizeof TOSMsgHeader int xcmd_basic char buffer int opcode XCommandMsg msg XCommandMsg x buffer xcmd set header buffer Data payload msg gt seg no 8 860 0 2 UC 7420 SOFTWARE 109 msg gt dest g dest msg gt inst 0 cmd
31. 8 9 temp x msg gt data 10 11 counter x msg gt data l4 msg4 status debug FOGG e ACA 3 3 3 3 3 3 ICI ICI a a a include sensorboard h definitions from tos mda300 directory include appFeatures h includes XCommand includes sensorboard module XMDA300M provides interface StdControl uses interface Leds interface Send interface RouteControl ifdef XMESHSYNC interface Receive as DownTree endif interface XCommand Sampler Communication interface StdControl as SamplerControl interface Sample Timer interface Timer relays interface Relay as relay normally_closed interface Relay as relay normally_open support for plug and play command result t PlugPlay if FEATUREUART SEND 1 XBOVV APPS XMESH XMDA300 DIRECTORY 41 interface SendMsg as SendUART command result_t PowerMgrEnable command result_t PowerMgrDisable endif implementation define ANALOGSAMPLING_TIME 90 define DIGITALSAMPLING_TIME 100 define MISC SAMPLING TIME 110 define MPKRATE 30720 fire twice per minute define MPK TICKS 36 18 minutes between samples define MPK QUICR MESH COUNT 60 MPK take 60 samples at a high speed before lowering rate define ANALOGSENDFLAG 1 define DIGITALSEND_FLAG 1 define MISC SEND FLAG 1 define ERR SEND FLAG 1 define PACRET FULL 0x1C1 MPK Temp Hum Batt ADCO if 0 define PACKET FULL 0x1FF endif define MSGLEN 29 ex
32. ACPS SOFTWARE sensorMaxValue 6 lt lt XDSParam name columninfo value fieldName ElExcitationV displayName Excitation displayOrder 3 unitName Volts unitShortName V sensorType Voltage sensorMinValue 0 sensorMaxValue 6 lt lt XDataSink gt lt XDataSinks gt lt XFieldExtractor gt lt XServeConfig gt 2 CPC CRACK PROPAGATION PATTERN CPC XML 137 2 CPC crack propagation pattern cpc xml lt xml version 1 0 encoding IS0 8859 1 gt lt DOCTYPE XServeConfig SYSTEM xserve config dtd gt lt XServeConfig gt lt XFieldExtractor name Vishay Crack Propagation Sensor wide spacing order 3 gt lt XFields gt lt Tos Hdr lt lt XField name amType byteoffset 2 length l type uint8 gt lt XField name group byteoffset 3 length l type uint8 gt lt XMesh Hdr S lt XField name nodeld byteoffset 7 length 2 type uintl6 specialtype nodeid gt lt XField name socketId byteoffset 11 length l type uint8 gt lt XSensor Hdr gt lt XField name 0081010 byteoffset 12 length l type uint8 specialtype sensorboardid gt lt XField name packetId byteoffset 13 length 1 type uint8 gt lt XField name ParentID byteoffset 14
33. BASIS AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE SUPPORT UPDATES ENHANCEMENTS OR MODIFICATIONS Copyright c 2002 2003 Intel Corporation All rights reserved This file is distributed under the terms in the attached INTEL LICENSE file If you do not find these files copies can be found by writing to Intel Research Berkeley 2150 Shattuck Avenue Suite 1300 Berkeley CA 94704 Attention Intel License Inguiry SE O 00000 WR Ee dE 06 069 SR PE EW 2 File Name SimpleCmd h Description This header file defines the AMSIMPLECMDMSG and AMLOGMSG message types for the SimpleCmd and MDA300Logger applications This software was slightly modified by Hasan Ozer and Mat Kotowsky to include a 3rd integer argument to the start_sensing command It remains otherwise unchanged from the original University of x California software Contact kotowsky northwestern edu enum AM SIMPLECMDMSG 8 AMLOGMSG 9 26 MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG enum LED ON 1 LED OFF 2 RADIO QUIETER 3 RADIO LOUDER 4 START SENSING 5 READ LOG 6 iz typedef struct int nsamples uint32_t interval uint32_t time 800 start_sense_args typedef struct uintl6_t destaddr read log args SimpleCmd message structure typedef struct SimpleCmdMsg int8_t segno int8_t
34. If you do not find these files copies can be found by writing to Intel Research Berkeley 2150 Shattuck Avenue Suite 1300 Berkeley CA 94704 Attention Intel License Inguiry WP SE O 00000 WE DE Ee dE PE e R G WW 2 fax x Defines an interface for a component that senses data at a certain x interval and scale interface Sensing Start sensing data param nsamples The number of samples to gather Qparam interval_sec The interval in msec at which to gather samples command result_t start unsigned long nsamples unsigned long interval 860 unsigned long time sec command result stop 1 MDA300LOGGER DIRECTORY Signalled when sensing has completed event result t done 17 18MICA2 BASED WIRELESS ACM VERSION I SOFTWARE MODIFICATION OF SENSELIGHTTOLOG This software is largely based on software written by the University of California As per the implied license agreement the original copyright notice is below tab 4 e e MW 0 H E 9 OW 0 El El El fax x Copyright c 2000 2003 The Regents of the University of California All rights reserved Permission to use copy modify and distribute this software and its documentation for any purpose without fee and without written agreement is hereby granted provided that the above copyright notice the following two paragraphs and the aut
35. SUCCESS event result_t Dio0 dataReady uintl6 t data signal Sample dataReady 0 DIGITAL data return SUCCESS event result t Diol dataReady uintl6 t data signal Sample dataReady 1 DIGITAL data return SUCCESS event result_t Dio2 dataReady uintl6 t data signal Sample dataReady 2 DIGITAL data return SUCCESS event result_t Dio3 dataReady uintl6 t data signal Sample dataReady 3 DIGITAL data return SUCCESS event result_t Dio4 dataReady uintl6 t data signal Sample dataReady 4 DIGITAL data return SUCCESS event result_t Dio5 dataReady uintl6 t data signal Sample dataReady 5 DIGITAL data 3 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY return SUCCESS event result t Dio0 dataOverflow return SUCCESS event result t Diol dataOverflow return SUCCESS event result t Dio2 dataOverflow return SUCCESS event result t Dio3 dataOverflow return SUCCESS event result_t Dio4 dataOverflow return SUCCESS event result t Dio5 dataOverflow return SUCCESS event result t Counter dataReady uintl6 t data signal Sample dataReady 0 COUNTER data return SUCCESS event result_t Counter dataOverflow return SUCCESS CHAPTER 3 MICA2 Based Wireless ACM Version 3 Software Modification Version 2 XMDA300 Shake n Wake This appendix contains all software used to program the MICA2 motes for Version 3 of the MICA2 based wireless ACM system This ap
36. Vishay Crack_Propagation Wide Spacing sensor results gt lt XDSParam name sensorname value Crack Propagation Wide Spacing gt lt XDSParam name columninfo value fieldName nodeld displayName Node Id displayOrder 1 gt lt XDSParam name columninfo value fieldName RangeV display Name RangeV displayOrder 2 unitName Volts unitShortName V sensorType Voltage sensorMinValue 0 sensorMaxValue 6 lt lt XDSParam 2 CPC CRACK PROPAGATION PATTERN CPC XML 139 name columninfo value fieldName ElExcitationV displayName Excitation displayOrder 3 unitName Volts unitShortName V sensorType Voltage sensorMinValue 0 sensorMaxValue 6 lt lt XDataSink gt lt XDataSinks gt lt XFieldExtractor gt lt XServeConfig gt
37. board id define SENSOR BOARDID 0x81 MDA300 sensor board id define NUM MSG1 BYTES 28 bytes 2 29 detine NUMMSG2BYTES 8 bytes 2 9 define NUM MSG3 BYTES 13 bytes 2 13 format is byte 1 amp 2 ADC reading in big endian format y 8 5 enum Sample_Packet 6 J enum RADIO TEST UART TEST Js 1 MDA300LOGGER DIRECTORY 25 This software is largely based on software written by the University of x California As per the implied license agreement the original copyright notice is below tab 4 Copyright c 2000 2003 The Regents of the University of California All rights reserved Permission to use copy modify and distribute this software and its documentation for any purpose without fee and without written agreement is hereby granted provided that the above copyright notice the following two paragraphs and the author appear in all copies of this software IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT INDIRECT SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE SOFTWARE PROVIDED HEREUNDER IS ON AN AS IS
38. de de 3 3 36 36 fe fe 3 36 3 fe fe de 3 3 de fe e 3 36 36 fe fe 3 36 36 fe fe fe 3 3 fe fe e 3 3 e fe fe 3 e e fe fe ak ak Stop the component ICICI I kok kak kek 3 3 3 5 5 5 5 5 RR III 56 56 command result_t StdControl stop call SamplerControl stop return SUCOESS pe 56 56 fe 3 3 6 de de 3 3 CCI e 3 fe fe e 36 fe le de 3 3 36 de de 3 e e fe fe de 3 36 fe fe de de 3 3 de de do 3 36 36 le fe 3 36 36 fe de fe 3 3 fe fe e 3 CI fe 3 e de fe fe ak ak Task to transmit radio message NOTE that data payload was already copied from the corresponding UART packet AR RR RX task void send_radio_msg 90 MICA2 BASED VVIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKF uint8 t i uintl6_t len XDataMsg data BEGIN MPK INT CODE EIMSK 1 lt lt 6 turn on ext int 6 END MPK INT CODE if sending_packet return atomic sending_packet IRUE Fill the given data buffer data XDataMsg call Send getBuffer msg_ptr amp len tmppack XDataMsg packet data for i 0 i lt sizeof XDataMsg 1 i uint8_t data i uint8_t tmppack i data gt xmeshHeader packet_id 6 data gt xmeshHeader board_id SENSOR BOARD ID data gt xmeshHeader node id TOS LOCAL ADDRESS data gt xmeshHeader parent call RouteControl getParent if FEATURE UART SEND if TOS LOCAL ADDRESS
39. false fileOut println rawString fileOut flush try fileOut close fos close catch IOException e System err println 7 Error closing the file e e printStackTrace if lisRead System err println Mote Im get_sourceaddr has started else if lm getElement_log 5 amp Im getElement log 7 OxFF two random positions are FF int 1 0 position of timestamp timestamp 0 timestamp lm getElement_log i 3 amp OxFF timestamp lt lt 8 timestamp lm getElement_log i 2 amp OxFF timestamp lt lt 8 2 JAVA DIRECTORY 33 timestamp lm getElement log i 1 amp OxFF timestamp lt lt 8 timestamp lm getElement_log i amp OxFF logOut println New test start at timestamp else int lineType if lm getElement log 14 0x77 amp Im getElement_log 15 0x77 lineType 1 else lineType 2 System err println Received log message lm logOut println Raw log message lm logOut println reading a line of type lineType for int i 0 i gt Im numElements_log i 2 int intVal 0 intVal lm getElement_log i 1l amp OxFF intVal lt lt 8 intVal Im getElement_log i amp OxFF if i 8 RE lineType 2 temperature t intVal 98 3840 100 logOut println Temperature t dataRow 1
40. inline void setparam_counter int8_t i uint8_t param call Counter setparam param return void sampleRecord uint8_t i if SampleRecord i channelType ANALOG switch SampleRecord i channel case O call ADCO getData break case l call ADCI getData break case 2 call ADC2 getData break 3 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY 69 case 3 call ADC3 getData break case 4 call ADC4 getData break case 5 call ADC5 getData break case 6 call ADC6 getData break case 7 call ADC7 getData break case 8 call ADC8 getData break case 9 call ADC9 getData break case 10 call ADCI10 getData break case 11 call ADC11 getData break case 12 call ADC12 getData break case 13 call ADCI3 getData break default return if SampleRecord i channelType BATITERY call Battery getData return if SampleRecord i channelType IEMPERATURE SampleRecord i channelType HUMIDITY if SampleRecord i channelType IEMPERATURE call Temp getData if SampleRecord i channelType HUMIDITY call Hum getData return if SampleRecord i channelType DIGITAL switch SampleRecord i channel 4 case O call Dio0 getData 20 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 break case 1 call Diol getData break case 2 call Dio2 getData break case 3
41. opcode switch opcode cmd case XCOMMAND SET RATE Change the data collection rate MPK timer_rate opcode gt param newrate call Timer stop call Timer start TIMER REPEAT timer rate MPK atomic maxTicks opcode gt param newrate MPK atomic timerTicks 0 MPK break case XCOMMAND SLEEP Stop collecting data and go to sleep sleeping TRUE call Timer stop call Leds set 0 break case XCOMMANDWAKEUP Wake up from sleep state if sleeping 1 initialize call Timer start TIMERREPEAT timer rate sleeping FALSE break case XCOMMAND RESET 42 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 Reset the mote now break case XCOMMAND ACIUATE break default break return SUCCESS ifdef XMESHSYNC task void SendPing XDataMsg pReading uintl6_t Len if pReading XDataMsg 6811 Send getBuffer msg_ptr amp Len pReading gt xmeshHeader parent call RouteControl getParent if call Send send msg ptr sizeof XDataMsg SUCCESS atomic sending_packet FALSE event TOS MsgPtr DownTree receive TOS MsgPtr pMsg void payload uint16_t payloadLen if sending_packet call Leds yellowToggle atomic sending_packet TRUE post SendPing pMsg XXX return pMsg endif des 6 66 EE ES dE WW gt NW 26 2 i 3 9 SR E GR 2
42. opcode msg gt inst 0 param nevrate OxCCCCCCCC Fill unused in known way return sizeof XCommandMsg int xcmd actuate char x buffer int device int state XCommandMsg msg XCommandMsg x buffer xemd set header buffer Data payload msg gt seg no g seg no msg gt dest g dest msg gt inst 0 cmd XCOMMAND ACTUATE msg gt inst 0 param actuate device device msg gt inst 0 param actuate state state return sizeof XCommandMsg int xcmd get serialid char buffer return xcmd_basic buffer XCOMMAND_GETSERIALID int xcmd_get_config char buffer return xcmd_basic buffer XCOMMAND GET CONFIG int xcmd reset char x buffer return xcmd_basic buffer XCOMMANDRESET int xcmd sleep char x buffer return xcmd_basic buffer XCOMMAND SLEEP int xcmd_wake char x buffer return xcmd_basic buffer XCOMMANDWAKEUP int xcmd_green_off char buffer return xcmd actuate buffer XCMD DEVICELED GREEN 0 int xcmd _green_on char buffer return xcmd actuate buffer XCMD DEVICELED GREEN 1 int xcmd_green_toggle char buffer return xcmd_actuate buffer XCMD DEVICELED GREEN 2 int xcmd red_off char buffer return xcmd_actuate buffer XCMD DEVICE LED RED 0 int xcmd_red_on char buffer return xcmd actuate buffer XCMD_DEVICELED_RED 1 int xcmd red_toggle char buffer return xcmd_actuate buffer XCMD DEVICE LED RED 2
43. port unsigned mode_quiet 1 lt suppress headers unsigned mode version 1 lt print versions of all modules unsigned 066 1 lt connect to a serial forwarder unsigned mode framing 2 lt auto 0 framed 1 unframed 2 bits struct unsigned short output 1 gt one output option reguired unsigned short mode options s params 98 MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKF A variable to store parsed parameter flags static 8 params g params static int g ostream lt Handle of output stream static char g command unsigned char g am_type AMTYPEXCOMMAND lt TOS AM type of command to send char g argument int g seg no 100 lt Broadcast sequence number unsigned g frame 0x26 1 gt Packetizer sequence number unsigned g group Oxff unsigned g dest OxFFFF lt Destination nodeid 0xFFFF all void xcommand print help 1 printf AnUsage xcommand lt v g gt command argument An lt s device gt lt b baud gt lt i server port gt An lt n nodeid gt lt g group gt lt seg no gt An display help help q quiet mode suppress headers An v show version of all modules in b set the baudrate baud mica2 mica2dot n s set serial port device device coml P An i internet serial forwarder inet host port
44. socket 1 if argv argc 2 server port strchr server if port xport t 0 xsocket_set_port port xsocket_set_server server break case v g params bits mode_version 1 break case d g params bits mode debug 1 break else if argv argc processing arguments backwards so always update command if gs command g argument g command command argv argc argc if g params bits mode guiet Summarize parameter settings printf xcommand Ver s n g version if gs params bits mode_version xpacket_print_versions printf Using params if g params bits display_help printf help if g params bits display baud printf baud 0x 04x baudrate if gs params bits display raw printf raw if g params bits display ascii printf ascii if gs params bits display parsed printf parsed 7 if g params bits display cooked printf cooked if g params bits export_parsed printf export if g params bits display time printf timed if g params bits export cooked printf convert if g params bits log_ cooked printf logging if g params bits mode framing l printt framed if g params bits mode framing 2 printf unframed if g_params bits mode socket printf inet s u
45. the following encoding of the first argument bit 1 red bit 2 green bit 3 yellow Passing a 7 for instance will turn all the LEDs on while passing a O will turn them all off section building Build Process The source code for the xcommand tool is located at opt tinyos 1 x contrib xbow tools sr n n To build the tool change to the xcmd source directory and run make n n To get the latest version of the source change to the xcmd source directory and run cvs update section setup Setup Xcommand is a command line tool that can be run from a cygwin shell by simply typing xcmd The executable needs to be in your working path to use it A simple way to add Xcommand to your working path is to create a soft link to it by running the following command n In s opt tinyos l x contrib xbow tools src xcmd usr local bin xcmd n n You can use Xcommand to actuate subdevices on a mote such as the LEDs sounder or relays The commands can be sent to either one mote over a serial link or a wireless network of motes In both configurations you need to have a MIB510 board connected via a serial cable to your PC n n For a single mote configuration the mote must be programmed with a XSensorMXX4HHF application and plugged into the MIB510 The mote will listen for command packets over the UART and radio whenever it has power n n For the network of motes configuration a base station mote n
46. 2003 driver for ADS7828EB on mda300ca module IBADCM provides interface StdControl interface ADConvert uint8_t port interface SetParam uint8_t port interface Power as EXCITATION25 interface Power as EXCITATION33 interface Power as EXCITATIONSO uses interface I2CPacket uses interface Leds uses interface StdControl as I2CPacketControl 34 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 uses interface Timer as PowerStabalizingTimer uses interface StdControl as SwitchControl uses interface Switch implementation 1 enum IDLE PICK CHANNEL GET SAMPLE CONTINUESAMPLE START CONVERSION PROCESS define VOLTAGESTABLE TIME 50 Time it takes for the supply voltage to be stable enough define MAX ANALOG CHNNELS 13 define MAX CHANNELS MAX ANALOG CHNNELS 1 The last channel is not an analog channel but we keep it only for the sake of exciation Note we do not do anything inside async part so all parts are synchronous and there is no synchronization hazard Now ADC runs in the round robin fashin so it is fair char state current state of the 120 request uintl6 t value value of the incoming ADC reading uint8_t chan uint8_t param MAXCHANNELS xwe reserve last param for excitation of digital channels uinti6 t adc_bitmap int8_t conversionNumber Note condition should be a global variable Since It is passed by address to I2CPacketM 1
47. 3 3 36 3 de 3 3 36 fe fe fe e 36 fe fe fe e 3 3 36 fe e 3 3 36 fe fe 3 3 36 fe de fe 3 3 3 ak fe 3 kk fe e command result t StdControl init uint8_t i call Leds init atomic msg ptr amp msg send buffer sending packet FALSE msg status 0 pkt_full PACKET FULL MAKE BAT MONITOR OUTPUT enable voltage ref power pin as output MAKE_ADC_INPUT enable ADC7 as input 1 XBOVV APPS XMESH XMDA300 DIRECTORY 43 usartl is also connected to external set usartl lines to correct state TOSH MARE FLASHSELECT OUTPUT TOSH MAKE FLASH OUT OUTPUT TOSH MARE FLASH CLR OUTPUT SET FLASH SELECT PIN serial flash tx output usart clk call SamplerControl init initialize return SUCCESS return rcombine call SamplerControl init call CommControl init pf e 56 56 fe 3 3 6 de de 3 3 36 de de 3 3 36 3 de de 36 36 fe de de 3 3 36 de de 3 3 36 36 fe de 3 36 3 fe de de 3 3 de de de 3 36 36 fe fe 3 36 36 fe de fe 3 3 fe de e 3 3 36 fe fe 3 3 GO fe ak ak Start the component Start the clock Setup timer and sampling RX 56 5 5 3 3 3 5 56 5 56 5 3 3 3 3 3 56 5 A ICICI A 56 3 3 3 A 56 56 56 command result_t StdControl start call SamplerControl start if call PlugPlay call Timer start TIMERREPEAT timer rate channel parameteres are irrele
48. 9 83 0146 a4 0125 85 0128 a6 0llf a7 0147 mda500 id 06 bat 00c2 thrm 0204 82 0198 a3 0148 a4 0122 a5 0131 a6 0l2d a7 0143 mda500 id 06 bat 00c2 thrm 0203 a2 019e a3 014e a4 0124 a5 012b a6 0llc a7 0143 mda500 id 06 bat 00c2 thrm 0204 a2 019d 83 0146 a4 0llf 85 0135 a6 0133 a7 011d mda500 id 06 bat 00c2 thrm 0205 a2 019a a3 014c a4 0lle a5 0131 a6 012d a7 011c subsection cooked c cooked n n n n n n Cooked mode actually converts the raw sensor readings within a given packet into engineering units Sample output follows xlisten c b mica2dot xlisten Ver Id xlisten c v 1 7 2004 03 23 00 52 28 mturon Exp Using params baud 0x000e cooked dev ttyS0 input stream opened MDA500 sensor data converted to engineering units health node id 6 battery volts 3163 mv thermistor resistance 10177 ohms tempurature 24 61 C S3 MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 An adc chan 2 voltage 1258 mv An adc chan 3 voltage 1001 mv An adc chan 4 voltage 893 mv An adc chan 5 voltage 939 mv An adc chan 6 voltage 875 mv An adc chan 7 voltage 850 mv subsection quiet g guiet This flag suppresses the standard xlisten header which displays the version string and parameter selections subsection export x export Export mode displays raw adc values as comma delimited text for use in spreadsheet and data manipula
49. An En display help help En r raw display of tos packets raw An p parse packet into raw sensor readings parsed An x export readings in csv spreadsheet format export An c convert data to engineering units cooked En t display time packet was received timed En a ascii display of tos packets ascii En l log data to database logged En d debug serial port by dumping bytes debug S28MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE En b set the baudrate baud mica2 mica2dot En s set serial port device devicezcoml n i use socket input inet host port n sf use serial forwarder input inet host port n h specify size of TOS_msg header header size n v display complete version information for all modules version n q quiet mode suppress headers n section params Parameters subsection help help XListen has many modes of operation that can be controlled by passing command line parameters The current list of these command line options and a brief usage explanation is always available by passing the flag n n A detail explanation of each command line option as of version 1 7 follows subsection baud b baudrate baud This flag allows the user to set the baud rate of the serial line connection The default baud rate is 57600 bits per second which is compa
50. As per the implied license agreement the original copyright notice is below Copyright c 2000 2003 The Regents of the University of California All rights reserved Permission to use copy modify and distribute this software and its documentation for any purpose without fee and without written agreement is hereby granted provided that the above copyright notice the following two paragraphs and the author appear in all copies of this software IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT INDIRECT SPECIAL INCIDENTAL OR CONSEOUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFIWARE AND ITS DOCUMENTATION EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE SOFIWARE PROVIDED HEREUNDER IS ON AN AS IS BASIS AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE SUPPORT UPDATES ENHANCEMENTS OR MODIFICATIONS Copyright c 2002 2003 Intel Corporation All rights reserved This file is distributed under the terms in the attached INTEL LICENSE file If you do not find these files copies can be found by writing to Intel Research Berkeley 2150 Shattuck Avenue Suite 1300 Berkeley CA 94704 Attention Intel License Inguiry The MDA300Logger mo
51. C11 inputs DIO 0 5 counter battery humidity temp El El El El El Es El Output results through mica2 uart and radio 82MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKF Use xlisten exe program to view data from either port uart mount mica2 on mib510 with MDA300 must be connected or now data is read connect serial cable to PC run xlisten exe at 57600 baud radio run mica2 with MDA300 run another mica2 with TOSBASE run xlisten exe at 56K baud LED the led will be green if the MDA300 is connected to the mica2 and the program is running and sending out packets Otherwise it is red Data packet structure PACKET 1 of 4 msg gt data 0 sensor id MDA300 1 msg gt data 1 packet number 1 msg gt data 2 node id msg gt data 3 reserved msg gt data 4 5 analog adc data Ch 0 msg gt data 6 7 analog adc data Ch 1 msg gt data 8 9 analog adc data Ch 2 msg gt data 10 11 analog adc data Ch 3 msg gt data 12 13 analog adc data Ch 4 msg gt data 14 15 analog adc data Ch 5 msg gt data 16 17 analog adc data Ch 6 PACKET 2 of 4 msg gt data 0 sensor id MDA300 0x81 msg gt data 1 packet number 2 msg gt data 2 node id msg gt data 3 reserved msg gt data 4 5 analog adc data Ch 7 msg gt data 6 7 analog adc data Ch 8 msg gt data 8 9 analog adc data Ch 9 msg gt da
52. Cmd that understands the START SENSING and READLOG commands module SimpleCmdM provides interface StdControl interface ProcessCmd uses interface Leds interface Pot interface ReceiveMsg as ReceiveCmdMsg interface StdControl as CommControl interface LoggerRead interface SendMsg as SendLogMsg interface Sensing interface Timer as ReadTimer implementation declare module static variables here TOS_MsgPtr cur_msg The current command message TOS_Msg log_msg The current log message bool send_pending TRUE if a message send is pending bool eeprom_read_pending TRUE if an EEPROM read is pending TOS_Msg buf Free buffer for message reception int reads int readAttempts This task evaluates a command and executes it x Signals ProcessCmd sendDone when the command has completed return Return None task void cmdInterpret struct LogMsg lm struct SimpleCmdMsg cmd struct SimpleCmdMsg cur_msg gt data result_t status SUCCESS do local packet modifications update the hop count and packet source cmd gt hop_count 4 cmd gt source TOS LOCAL ADDRESS 20MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG Execute the command switch cmd gt action 4 case LED ON call Leds yellowOn break case LED OFF call Leds yellowOff break case RADIO_QUIETER call Pot increase break case
53. D SET_QUICK XCommandOpcode MPK enum XCMD DEVICE LED_GREEN XCMD DEVICE LED YELLOW XCMD DEVICE LED RED XCMD DEVICE LEDS XCMD DEVICE SOUNDER XCMD DEVICE RELAY1 XCMD DEVICE RELAY2 XCMD DEVICE RELAY3 XCMD DEVICE POT XSensorSubDevice added pot line to above MPK enum XCMD STATE OFF 0 XCMDSTATEON 1 XCMD STATE TOGGLE XSensorSubState typedef struct XCommandOp uintl6_t cmd union uint32 t newrate I lt uint16_t nodeid lt uint8_t group I lt uint8_t rf power lt uint8 t rf channel gt uint8_t quick MPK uinti6 t ticks MPK FOR XCOMMANDACCIUATE x struct uintl6_t device lt uintl6 t state gt actuate param attribute_ typedef struct XCommandMsg uint16 t seg no IIH uint16_t dest IIH XCommandOp inst 6 __attribute__ XCommandOpcode FOR XCOMMAND SET RATE FOR XCOMMAND SET NODEID FOR XCOMMAND SET GROUP FOR XCOMMAND SET RF POWER FOR XCOMMAND SET RF CHANNEL LEDS off sounder relay on toggle packed XCommandOp Reguired by lib Broadcast Desired destination 0xFFFF for broadcast packed XCommandMsg 80 MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKF typedef struct XSensorHeader uint8_t board_id mica2 mica2dot micaz uint8_t packet_id 1 default serialid msg uint8 t node id uint8_t rsvd __attribute__ packed XCm
54. MDA300Logger Directory MDA300Logger is a software application designed to take readings from a Crossbow MDA300 sensor board and store them on the EEPROM memory on a Crossbow Mica 2 mote until such time as they are uploaded over the radio by a PC running the BcastInject java application Its modular and command processing structure are based on SenseLightToLog and therefore has all the same dependencies as that application with the addition of the MDA300 specific dependencies that are specified in each file MDA300Logger also uses a slightly modified version of the same driver used for XSensorMDA300 MDA300Logger reguires at least one remote mote to have the MDA300Logger application installed on it one base mote on a programming board to have TOSBase installed on it and one PC connected to the programming board either directly or via a network running the modified version of BcastInject in order to start and stop the test and upload data 1 MDA300LOGGER DIRECTORY COMPONENT MD A300Logger SENSORBOARD mda300 PFLAGS I tos interfaces I tos system I tos lib I tos sensorboards SENSORBOARD I tos platform mica2 PROGRAMMER EXTRA FLAGS v 2 include MakeXbowlocal include TOSROOT apps Makerules 4 MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG This software is largely based on software written by the University of
55. NG_TIME SAMPLER_DEFAULT record 16 call Sample getSample 0 SHAKE 1 MICA2 SOFTWARE 87 BATTERY MISC_SAMPLING_TIME SAMPLER DEFAULT start sampling channels Channels 7 10 with averaging since they are more percise channels 3 6 make active excitation MPK record 0 call Sample getSample 0 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT record 1 call Sample getSample 1 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT record 2 call Sample getSample 2 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT MPK MPK record 3 call Sample getSample 3 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT EXCITATION 33 DELAY BEFORE MEASUREMENT record 4 call Sample getSample 4 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT record 5 call Sample getSample 5 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT record 6 call Sample getSample 6 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT MPK record 7 call Sample getSample 7 ANALOG ANALOG SAMPLING TIME AVERAGEFOUR EXCITATION 25 DELAY BEFORE MEASUREMENT MPK record 8 call Sample getSample 8 88 MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKF ANALOG ANALOG SAMPLING TIME AVERAGEFOUR EXCITATION 25 record 9 call Sample getSample 9 ANALOG ANALOG SAMPLING TIME AVERAGEFOUR EXCITATION 25 MPK MPK record
56. NTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEOUENTIAL DAMAGES INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY VVHEIHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Authors Mohammad Rahimi mhr cens ucla edu History created 83 history modified 11 14 2003 module SamplerM provides interface StdControl as SamplerControl provides interface Sample provides command result_t PlugPlay uses interface Leds interface Timer as SamplerTimer analog channels interface StdControl as IBADCcontrol interface ADConvert as ADCO interface ADConvert as ADCI 3 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY interface ADConvert as ADC2 interface ADConvert as ADC3 interface ADConvert as ADC4 interface ADConvert as ADC5 interface ADConvert as ADC6 interface ADConvert as ADC7 interface ADConvert as ADC8 interface ADConvert as ADC9 interface ADConvert as ADC10 interface ADConvert as ADCII interface ADConvert as ADCI2 interface ADConvert as ADC13 ADC parameters interface SetParam as SetParam0 interface SetParam as Set
57. NTENANCE SUPPORT UPDATES ENHANCEMENTS OR MODIFICATIONS Copyright c 2002 2003 Intel Corporation All rights reserved This file is distributed under the terms in the attached INTEL LICENSE file If you do not find these files copies can be found by writing to Intel Research Berkeley 2150 Shattuck Avenue Suite 1300 Berkeley CA 94704 Attention Intel License Inguiry Wo 2 6 ce 6 i EE 6 Pe FE 3 Le S W e E fax x author lt a href mailto szewczyk sourceforge net gt Robert Szewczyk lt a gt x Modified by Hasan Ozer h ozer northwestern edu and Mat Kotowsky kotowsky northwestern edu to be used with the MDA300Logger project package net tinyos tools import net tinyos util x import java io 28MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG import java util Properties import java util Date import net tinyos message public class BcastInject implements MessageListener static Properties p new Properties public static final byte LEDON 1 public static final byte LEDOFF 2 public static final byte RADIOLOUDER 3 public static final byte RADIO_QUIETER 4 public static final byte START SENSING 5 public static final byte READLOG 6 public boolean read_log_done false public boolean start sensing done false public boolean isRead false public static final short TOSBCAST ADDR short
58. NTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFIWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Qauthor Leah Fera Martin Turon Jaidev Prabhu Id XMDA300M nc v 1 4 2005 01 11 05 21 35 husg Exp DCCC e e fe fe yy y y nn nn Tests the MDA300 general prototyping card see Crossbow MIS Series User Manual Read and control all MDA300 signals ADCO ADCI ADC2 ADC3 ADC11 inputs DIO 0 5 counter battery humidity temp El El El El El Es El Output results through mica2 uart and radio 1 XBOVV APPS XMESH XMDA300 DIRECTORY Use xlisten exe program to view data from either port mount mica2 on mib510 with MDA300 must be connected or now data is read uart radio LED th connect serial cable to PC run xlisten exe at 57600 baud run mica2 with MDA300 run another mica2 with TOSBASE run xlisten exe at 56K baud e led will be green if the MDA300 the program is running and sending out packets Otherwise is 39 connected to the mica2 and it is red RR X XX XX XX XX XX XXX XXX xxx Y X xxx X XX XX XX X YN XX Fox xx Y XX X X k Data packet structure PACKET 1 of 4 msg gt data 0 sensor id MDA300 1 msg gt data 1 packet number 1 msg gt data 2 node id msg gt data 3 reserved msg gt data 4 5 analog adc data Ch 0 msg
59. Oxffff public static String outputFilename public static double t public static void usage System err println Usage java net tinyos tools BcastInject lt command gt arguments System err println twhere lt command gt and arguments can be one of the following System err println t tled_on System err println t tled_off System err println t tradio_louder System err println t tradio_quieter System err println t tstart_sensing nsamples interval_sec time sec System err println t tread_log dest_address public static void startSensingUsage System err println Usage java net tinyos tools BcastInject start_sensing num samples interval_sec time _sec public static void readLogUsage System err println Usage java net tinyos tools BcastInject read log dest address data file public static byte restoreSeguenceNo try 1 FileInputStream fis new FilelnputStream bcast properties p load fis byte i byte Integer parseInt p getProperty seguenceNo 1 fis close return i catch IOException e 2 JAVA DIRECTORY 29 p setProperty seguenceNo 1 return 1 public static void saveSeguenceNo int i try FileOutputStream fos new FileOutputStream bcast properties p setProperty seguenceNo Integer toString i p store f
60. PK else call Leds redOn return SUCCESS I 3 3 3 AA 56 56 e e e o o EEE EEEE gt gt A A k k Stop the component 3 3 3 3 3 3 3 36 36 36 36 36 36 5 56 56 56 56 56 5 5 AA AA 3 3 3 3 3 3 3 3 36 AI ICICI AICI ICICI AK a a ak 56 ak ak ak ak command result_t StdControl stop call SamplerControl stop return SUCCESS ECCI e 3 fe fe 3 36 3 fe de 3 3 3 de de 3 3 36 36 fe fe e e fe fe de de 3 3 de ella 36 fe fe 3 36 36 fe OO 3 fe de de 3 3 ICI fe 3 3 GIG fe ak ak 26 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 Task to transmit radio message NOTE that data payload was already copied from the corresponding UART packet e e fe eler 3 fe de de 3 3 de de de 3 3 36 3 le 3 3 36 fe fe de de 3 3 fe fe fe 3 3 36 3 lle 3 fe fe e 36 fe ell 36 de e 3 3 36 fe fe 3 36 36 fe de fe 3 3 3 fe fe 3 3 i a task void 5620 18010 186 uint8_t i uintl6_t len XDataMsg data if sending_packet return atomic sending_packet IRUE Fill the given data buffer data XDataMsg call Send getBuffer msg_ptr amp len tmppack XDataMsg packet data for i 0 i lt sizeof XDataMsg 1 i uint8_t data i uint8_t tmppack i data gt xmeshHeader packet id 6 data gt xmeshHeader board_id SENSOR BOARD ID data gt xmeshHeader node_id TOS LOCAL ADDRESS data gt xmeshHeader parent call RouteContro
61. Paraml interface SetParam as SetParam2 interface SetParam as SetParam3 interface SetParam as SetParam4 interface SetParam as SetParam5 interface SetParam as SetParam6 interface SetParam as SetParam7 interface SetParam as SetParam8 interface SetParam as SetParam9 interface SetParam as SetParaml0 interface SetParam as SetParamll interface SetParam as SetParaml2 interface SetParam as SetParaml3 health channels temp humidity voltage interface StdControl as BatteryControl interface ADConvert as Battery interface ADC as Battery interface StdControl as TempHumControl interface ADConvert as Temp interface ADConvert as Hum digital and relay channels interface StdControl as DioControl interface Dio as Dio0 interface Dio as Diol interface Dio as Dio2 interface Dio as Dio3 interface Dio as Dio4 interface Dio as Dio5 counter channels interface StdControl as CounterControl interface Dio as Counter command result t Plugged 86 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 implementation define SCHEDULER RESPONSE TIME 150 define TIMESCALE 100 this means we have resolution of 0 1 sec define FLAGSET 1 define FLAG NOT SET 0 flag for power saving uint8 t flag25 flag33 flag50 bool stopFlag MPK main data structure 10 byte per recorde struct SampleRecords uint8_t channel uint8_t channelType uint8_t param intl6_t ticks_left
62. RADIO LOUDER call Pot decrease break case START SENSING Initialize the sensing component and start reading data from it lm struct LogMsg log_msg data lm gt sourceaddr TOS LOCAL ADDRESS if call SendLogMsg send TOS_BCAST_ADDR sizeof struct LogMsg amp log_msg send_pending TRUE call Sensing start cmd args ss_args nsamples cmd gt args ss args interval cmd args ss args time sec call LoggerRead resetPointer break case READLOG Check if the message is meant for us if so issue a split phase call to the logger call Leds redOff call Leds yellowOff reads 0 readAttempts 0 call Sensing stop if cmd args rl_args destaddr TOS LOCAL ADDRESS amp amp eeprom_read_pending FALSE if call LoggerRead readNext struct LogMsg log msg data gt log call Leds yellowOn eeprom read_pending TRUE call ReadTimer start TIMER REPEAT 100 break default status FAIL signal ProcessCmd done cur msg status event result t ReadTimer fired readAttempts 1 MDA300LOGGER DIRECTORY 21 if readAttempts gt 300 call ReadTimer stop call Leds yellowOff call Leds redOn call Leds yellowToggle if eeprom read pending send pending if call LoggerRead readNext struct LogMsg log msg data gt log eeprom read_pending TRUE return SUCCESS Signalled in res
63. S0 8859 1 gt lt DOCTYPE XServeConfig SYSTEM xserve config dtd gt lt XServeConfig gt lt XFieldExtractor name Vishay Crack Propagation Sensor narrow spacing order 3 gt lt XFields gt lt Tos Hdr lt lt XField name amType byteoffset 2 length l type uint8 gt lt XField name group byteoffset 3 length l type uint8 gt lt XMesh Hdr S lt XField name nodeld byteoffset 7 length 2 type uintl6 specialtype nodeid gt lt XField name socketId byteoffset 11 length l type uint8 gt lt XSensor Hdr gt lt XField name 0081010 byteoffset 12 length l type uint8 specialtype sensorboardid gt lt XField name packetId byteoffset 13 length 1 type uint8 gt lt XField name ParentID byteoffset 14 length l type uintl6 gt lt Data lt lt XField name ElReferenceADC byteoffset 16 length 2 type uintl6 gt lt XField name E1Excitation V byteoffset 18 length 2 type uintl16 gt lt XConversion function 1 225 2 x y returntype float gt lt XConvParam variablename x fieldname El1ExcitationV type float gt lt XConvParam variablename y fieldname E1ReferenceADC
64. SYNC interface Receive as DownTree endif interface XCommand Sampler Communication interface StdControl as SamplerControl interface Sample Timer interface Timer relays interface Relay as relay normally_closed interface Relay as relay normally_open support for plug and play command result t PlugPlay if FEATUREUART SEND 84 MICA2 BASED VVIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKF interface SendMsg as SendUART command result_t PowerMgrEnable command result_t PowerMgrDisable endif implementation define ANALOGSAMPLING_TIME 90 define DIGITALSAMPLING_TIME 100 define MISC SAMPLING TIME 110 define MPKRATE 30720 fire twice per minute define MPK TICKS 36 18 minutes between samples define MPKOUICKMESHCOUNT 60 MPK take 60 samples at a high speed before lowering rate define ANALOG SEND FLAG define DIGITAL SEND FLAG define MISC SEND FLAG define ERR SEND FLAG PRR BR define PACKET FULL Ox1C1 MPK Temp Hum Batt ADCO if 0 define PACRET FULL 0x1FF endif define MSGLEN 29 excludes TOS header but includes xbow header enum PENDING 0 NOMSG 1 J enum MDA300 PACRET1 1 MDA300 PACRET2 2 MDA300 PACRET3 3 MDA300 PACKET4 4 MDA300 ERR PACKET 8 ET y A 56 A A ICICI ICI ICI I I I kk enum SENSOR ID 0 PACKETJD NODE ID RESERVED DATA START XPacketDataEnum XI i Y O 56
65. Wireless Sensor Networks for Monitoring Cracks in Structures Source Code and Configuration Files Mathew P Kotowsky Contents Chapter 1 MICA2 Based Wireless ACM Version 1 Software Modification of SenseLightToLog 1 MDA300Logger Directory 2 java Directory Chapter 2 MICA2 Based Wireless ACM Version 2 Software Modification of XSMDA300 1 xbow apps XMesh XMDA300 directory 2 xbow tos sensorboards mda300 directory 3 xbow tos sensorboards mda300 directory Chapter 3 MICA2 Based Wireless ACM Version 3 Software Modification Version 2 XMDA300 Shake n Wake 1 MICA2 Software 1 1 xbow tos XLib directory 1 2 xbow apps XMesh XMDA300 directory 2 UC 7420 Software 2 1 xbow beta tools src xcmd directory 2 2 xbow beta tools src xcmd apps directory 2 3 xbow beta tools src xlisten boards directory 2 4 xbow beta tools src xlisten directory Chapter 4 eRo mote based wireless ACPS software 1 CPA crack propagation pattern cpa xml 2 CPC crack propagation pattern cpc xml 37 38 53 64 TT 78 78 81 97 97 107 113 120 133 134 137 CHAPTER 1 MICA2 Based Wireless ACM Version 1 Software Modification of SenseLightToLog This appendix contains all software used to program the MICA2 motes for Version 1 of the MICA2 based wireless ACM system This appen dix is organized by software directory and only the modified files are included 2 MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG 1
66. _pending FALSE call Leds yellowOff reads if readAttempts gt 100 reads gt 100 call ReadTimer stop call Leds yellowOff call Leds redOn return SUCCESS Post a task to process the message in pmsg x return Always returns lt code gt SUCCESS lt code gt command result_t ProcessCmd execute TOS_MsgPtr pmsg cur_msg pmsg post cmdInterpret return SUCCESS x Called upon message receive invokes ProcessCmd execute event TOS MsgPtr ReceiveCmdMsg receive TOS_MsgPtr pmsg result_t retval TOS_MsgPtr ret cur_msg retval call ProcessCmd execute pmsg if retval SUCCESS return ret else 1 return pmsg x Default event handler for lt code gt ProcessCmd done lt code gt return The value of status 1 MDA300LOGGER DIRECTORY 23 default event result t ProcessCmd done TOS MsgPtr pmsg result_t status return status Reset send_pending flag to FALSE in response to x lt code gt SendLogMsg sendDone lt code gt return The value of status xx event result_t SendLogMsg sendDone TOS MsgPtr pmsg result t status call Leds redOff send_pending FALSE return status end of implementation 24 MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG sensorboard h hardware specific definitions for the MDA300 crossbow sensor
67. acket 5 contains MultiHop packets typedef struct uintl6 t seg no uintl6_t adcO0 uintl6_t adcl uintl6_t adc2 uinti6 t battery XSensorSensirion sensirion attribute_ packed XSensorMDA300Data5 pp multihop need only the packet6 typedef struct XSensorMDA300Data6 1 uintl6_t vref uintl6_t humid uinti6 t humtemp uintl6_t 8000 uintl6_t adcl uintl6_t adc2 uintl6_t dig0 uintl6_t digl uinti6 t dig2 __attribute__ packed XSensorMDA300Data6 extern XPacketHandler mda300_packet_handler fax MDA300 Specific outputs of raw readings within a XSensor packet Qauthor Martin Turon Te Se SE version 2004 3 23 mturon Initial version void mda300_print raw XbowSensorboardPacket packet switch packet gt packet id case 1 XSensorMDA300Datal data XSensorMDA300Datal packet data printf mda300 id 02x a0 04x al 04x 82 04 a3 04x a4 04x a5 04x ab6 04x n packet gt node id data gt adc0 data gt adc1 data gt adc2 data gt adc3 data gt adc4 data gt adc5 data gt adc6 break 2 UC 7420 SOFTWARE 115 case 2 XSensorMDA300Data2 data XSensorMDA300Data2 packet data printf 7 mda300 id 02x a7 04x a8 04x a9 04x 810 04 a11 04x 812 04 al3 9004x n packet gt node_id data gt adc7 data gt adc8 data gt adc9 data gt adcl0 data gt adcll data gt adcl2 data gt adcl3
68. action uintl6_t source uint8_t hop count union start_sense_args ss args read_log_args rl_args uint8_t untyped_args 0 args SimpleCmdMsg Log message structure typedef struct LogMsg uintl6_t sourceaddr uint8_t log 16 LogMsg 2 JAVA DIRECTORY 27 2 java Directory This software is largely based on software written by the University of California As per the implied license agreement the original copyright notice is below Copyright c 2000 2003 The Regents of the University of California All rights reserved Permission to use copy modify and distribute this software and its documentation for any purpose without fee and without written agreement is hereby granted provided that the above copyright notice the following two paragraphs and the author appear in all copies of this software IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT INDIRECT SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE SOFTWARE PROVIDED HEREUNDER IS ON AN AS IS BASIS AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAI
69. al dataRow 5 Integer toString intVal else if i 0 timestamp timestamp timestamp lm getElement log i 3 OxFF timestamp lt lt 8 timestamp lm getElement_log i 2 OxFF timestamp lt lt 8 timestamp lm getElement log i l OxFF timestamp lt lt 8 timestamp lm getElement_log i amp OxFF logOut println 7 Time timestamp dataRow 7 Long toString long timestamp end for logOut println END logOut println logOut flush try los close logOut close catch IOException e 2 JAVA DIRECTORY System err println Error closing log file e e printStackTrace end linetype else synchronized this read_log_done true this notifyAll 35 CHAPTER 2 MICA2 Based Wireless ACM Version 2 Software Modification of XMDA300 This appendix contains all software used to program the MICA2 motes for Version 2 of the MICA2 based wireless ACM system This appen dix is organized by software directory and only the modified files are included 37 38 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF 0 Gor SS amp ox x a o PE ee E a Se e o 6 0 e ES PH 8 P 2 6 EE PE dE OR 1 xbow apps XMesh XMDA300 directory tab 4 IMPORTANT READ BEFORE DOWNLOADING COPYING INSTALLING OR USING downloading copying installi
70. al sec we haven t accumulated enough seconds return SUCCESS ticks O for i 0 i lt 7 i Clear current row currentRowl i O currentRow2 i 0 if busy return SUCCESS if nsamples 0 call Timer stop signal Sensing done call Leds redOn return call Comm start Whenever ticks interval start sampler call Comm start turn the radio on while taking a sample call Leds greenOn radioCounter RADIO_TICK_INTERVAL call SamplerControl start if 1 atomic record 14 call Sample getSample 0 TEMPERATURE MISC SAMPLING TIME SAMPLER DEFAULT record 15 call Sample getSample 0 HUMIDITY MISC_SAMPLING_TIME SAMPLER DEFAULT 1 MDA300LOGGER DIRECTORY record 16 call Sample getSample 0 BATTERY MISC SAMPLING TIME SAMPLER DEFAULT record 17 call Sample getSample T ANALOG ANALOG SAMPLING TIME AVERAGE FOUR EXCITATION 25 EXCITATION 33 EXCITATION 50 EXCITATION_ALWAYS ON busy 1 nsamples return SUCCESS x Default event handler to the lt code gt Sensing done lt code gt event return Always returns lt code gt SUCCESS lt code gt default event result t Sensing done return SUCCESS task void writeRowl atomic call LoggerWrite append uint8_t amp currentRowl task void writeRow2 atomic call LoggerVVrite append
71. all Leds redOff ticks 0 secs 0 call LoggerWrite resetPointer nsamples samples total_samples samples time sec uint32_t time interval sec uint32 t interval if interval_sec gt 30 timer will fire every 30 seconds call Timer start TIMER REPEAT 3021024 else interval_sec gt 30 timer will fire once a second call Timer start TIMER REPEAT 1024 atomic nullDataRow TIME POS time sec amp OxFFFF nullDataRow TIME POS 1 time_sec gt gt 16 OxFFFF post writeNullTask call SamplerControl start call SamplerControl stop return SUCCESS This command belongs to the lt code gt Sensing lt code gt interface It turns everything off when the test is stopped x return Always returns lt code gt SUCCESS lt code gt command result_t Sensing stop call Timer stop signal Sensing done return SUCCESS x Event handler to the lt code gt Timer fired lt code gt event x return Always returns lt code gt SUCCESS lt code gt event result_t Timer fired int i if interval_sec gt 30 ticks are 30 seconds apart ticks 30 radioCounter secs 30 if radioCounter 0 10MICA2 BASED WIRELESS ACM VERSION I SOFTWARE MODIFICATION OF SENSELIGHTTOLOG call Comm stop else interval_sec gt 30 so ticks are 1 second apart ticks 4 secs if ticks lt interv
72. all Sample getSample 9 ANALOG ANALOG SAMPLING TIME AVERAGE FOUR EXCITATION 25 MPK MPK record 10 call Sample getSample 10 ANALOG ANALOG_SAMPLING_TIME AVERAGEFOUR EXCITATION 25 record 11 call Sample getSample 11 ANALOG ANALOG_SAMPLING_TIME SAMPLER DEFAULT record 12 call Sample getSample 12 ANALOG ANALOG_SAMPLING_TIME SAMPLER DEFAULT record 13 call Sample getSample 13 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT EXCITATION_50 EXCITATION ALWAYS ON MPK digital chennels as accumulative counter 1 XBOVV APPS XMESH XMDA300 DIRECTORY 45 record 17 call Sample getSample 0 DIGITAL DIGITAL SAMPLINGJTIME RESET ZERO AFTER READ FALLING EDGE record 18 call Sample getSample 1 DIGITAL DIGITAL SAMPLING TIME RISING EDGE EVENT record 19 call Sample getSample 2 DIGITAL DIGITAL SAMPLING TIME SAMPLER DEFAULT EVENT record 20 call Sample getSample 3 DIGITAL DIGITAL SAMPLING TIME FALLING EDGE record 21 call Sample getSample 4 DIGITAL DIGITAL SAMPLING TIME RISING EDGE record 22 call Sample getSample 5 DIGITAL DIGITAL SAMPLING TIME RISING EDGE EEPROM TOTALIZER counter channels for freguency measurement will reset to zero record 23 call Sample getSample 0 COUNTER MISC_SAMPLING_TIME RESET ZERO AFTER READ RISING EDGE call Leds greenOn M
73. ams bits display help 1 break case g g params bits mode guiet 1 break case p g params bits display_parsed 1 break case r g params bits display raw 1 break case a g params bits display_ascii 1 break case c g params bits display cooked 1 2 UC 7420 SOFTWARE 123 break case x switch argv argc 2 case c g_params bits export_cooked 1 break default case g_params bits export_parsed 1 break break case f switch argv argc 2 case specify arbitrary offset g params bits mode framing atoi argv argc 3 43 break case a automatic deframing g params bits mode framing 0 break case 0 case n assume no framing g params bits mode framing 2 break case 11 force framing default g params bits mode framing 1 break break case w case h int offset XPACRET DATASTART MULTIHOP g params bits mode_header 1 switch argv argc 2 case specify arbitrary offset offset atoi argv argc 3 break case 0 direct uart no wireless case 11 single hop offset offset XPACKET DATASTART STANDARD break xpacket_set_start offset break case 1 g params bits log_cooked 1 if argv argc 2 S2MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE break case b if argv
74. arge 2 baudrate xserial_set_baud argv argc 3 g params bits display_baud 1 break case 8 switch argv argc 2 case xserial_set_device argv argc 3 break case 1 g params bits mode sf 1 g params bits mode socxet 1 if argv arge 3 server argv argc 4 port strchr server if port 1 xport 107 xsocket_set_port port xsocket_set_server server break break case g params bits display time 1 break case i g params bits mode sf 0 g_params bits mode socxet 1 gt if arev argc 2 4 server argv argc 3 port strchr server if port xport 0 xsocket_set_port port xsocket_set_server server break case v g params bits mode_version 1 break if if 2 UC 7420 SOFTWARE 125 case d g params bits mode debug 1 break argc g params bits mode guiet Summarize parameter settings printf xlisten Ver sin 7618102 if g params bits mode version xpacket_print_versions printf Using params if 8 params bits display help printf help if g params bits display baud printf baud 0x 04x baudrate if g params bits display raw printf raw if gs params bits display ascii printf ascii if g params bits display parsed printf p
75. arsed if g params bits display cooked printf cooked if gs params bits export parsed printf export if g params bits display time printf timed if g params bits export cooked printf convert 7 if gs params bits log cooked printf logging if g params bits mode framing lt 1 printf framed if g params bits mode framing 2 printf unframed if g params bits mode_header printf header i xpacket_get_start if g params bits mode_socket printf inet s u xsocket_get_server xsocket_get_port if g params bits mode_debug printf debug serial dump An xserial_port_dump printf n g params bits display_help printf nUsage An r n a p An c 1 An An xc d n b n xlisten lt r p c x l d v a gt lt l table gt lt s device gt lt b baud gt lt i server port gt display help help raw display of tos packets raw ascii display of tos packets ascii parse packet into raw sensor readings parsed convert data to engineering units cooked 0 log data to database or file logged export raw readings in csv spreadsheet format export export cooked in csv spreadsheet format export debug serial po
76. ation otherwise the fuction will be called at the end of conversion void setNumberOfConversions conversionNumber 1 if param chan amp AVERAGEFOUR conversionNumber 4 if param chan AVERAGE EIGHT conversionNumber 8 if param chan amp AVERAGESIXTEEN conversionNumber 16 return command result_t StdControl init int i atomic state IDLE adc_bitmap 0 for i 0 i gt MAX CHANNELS i param i 0x00 call 12CPacketControl init call SwitchControl init TOSH_ MAKE PVV2 OUTPUT TOSH MARE PW4 OUTPUT TOSH MARE PVV5 OUTPUT TOSH MARE PVV6 OUTPUT TURN AMPLIFIERS OFF VOLTAGE BOOSTER OFF FIVE VOLT OFF 2 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY 57 THREE_VOLT_OFF TURN_VOLTAGE_BUFFER OFF return SUCCESS command result_t StdControl start call SwitchControl start return SUCCESS command result_t StdControl stop uint8_t ADCaddress MPK ADCaddress 8 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MKK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 12 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MKK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 9 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MKK ADCaddress ADCaddress 0x03 MPK cal
77. baudrate must be passed as a number directly after the equals sign with no spaces inbetween i e b 19200 Optionally a product name can be passed in lieu of an actual number and the proper baud will be set i e b mica2dot Valid product names are mica2 57600 baud mica2dot 19200 baud subsection serial s port serial This flag gives the user the ability to specify which COM port or device xcommand should use The default port is dev ttyS0 or the UNIX equivalent to COMI The given port must be passed directly after the 2 UC 7420 SOFTWARE 105 equals sign with no spaces i e s com3 subsection internet i hostname port inet This flag tells xcmd to connect via a serial forwarder over a TCP IP internet socket Specify the hostname and port to connect in the argument The default hostname is localhost and the default port 9001 The keyword mib600 can be passed as an alias to port 10002 when connecting to that hardware device The hostname and port must be passed directly after the equals sign with no spaces with a optional colon inbetween i e i remote i 10 1 1 1 9000 i mymib mib600 i 9002 i localhost 9003 or i stargate xbow com subsection node n nodeid node This flag specifies which node to send the message to When not passed the broadcast address is used 0xFFFF subsection group g group group This flag specifies which AM group id to send the message o
78. break case 2 tmppack XDataMsg packet data tmppack gt xData datap6 dig2 data atomic msg status 0x20 break default break case DIGITAL channel break case BATTERY tmppack XDataMsg packet data tmppack gt xData datap6 vref data atomic msg status 0x40 break case HUMIDITY tmppack XDataMsg packet data tmppack gt xData datap6 humid data atomic msg_status 0x80 break case TEMPERATURE tmppack XDataMsg packet data tmppack gt xData datap6 humtemp data atomic msg status 0x100 break default break switch channelType if sending_packet return SUCCESS if msg status pkt full msg status 0 packetCount MPK if packetCount gt 3 MPK MPK call SamplerControl stop MPK packetCount 0 MPK 94 MICA2 BASED VVIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 get rid of timer ticks accumulated while sampling MPK atomic timerTicks 0 MPK if packetCount gt 1 MPK first ADC reading always is bad post send radio msg return SUCCESS 38 3 3 3 3 3 3 3 36 o oo oo o EEEE 3 3 3 3 3 56 56 56 56 56 56 56 e e e e e e CEE 5 LL Timer Fired 3 3 3 3 3 3 36 36 36 36 36 36 36 ICICI ICICI RR event result_t Timer fired MPK if sending_packet return SUCCESS don t overrun buffers if test 0 test 0 call relay_normall
79. chan 10 char muxChannel TURN_AMPLIFIERS_ON switch chan default should never happen case 7 muxChanne MUX_CHANNEL SEVEN break case 8 muxChanne MUX_CHANNEL_EIGHT break case 9 muxChanne CHANNEL NINE break case 10 muxChanne MUX CHANNEL TEN break J if call Switch setAll muxChannel FAIL Can not select channel state IDLE TURN_AMPLIFIERS_OFF post adc get data resetExcitation else If the conversions happens fast there is no need to wait for settling of the power supply note that power supply should be set ON by user using the excitation command if param chan DELAY BEFORE MEASUREMENT call PowerStabalizingTimer start TIMER ONE SHOT VOLTAGE STABLE TIME else convert result_t convert if state START CONVERSION PROCESS state CONTINUE SAMPLE state PICK CHANNEL figure out which channel is to be set switch chan default should never happen case 0 condition 8 break 80 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 case l condition 12 break case 2 condition 9 break case 3 condition 13 break case 4 condition 10 break case 5 condition 14 break case 6 condition 11 break case 7 case 8 case 9 case 10 these channels all use ADC channel 7 and multiplex it
80. cludes TOS header but includes xbow header enum PENDING 0 NOMSG 1 J enum MDA300 PACKETI 1 MDA300 PACKET2 2 MDA300 PACRET3 3 MDA300 PACKET4 4 MDA300 ERR PACKET 0xf8 J 38 3 3 3 3 3 3 3 3 36 36 36 36 36 36 5 56 56 56 56 56 56 5 5 oo o ACI I A A A AC AC aC k k enum SENSOR ID 0 PACKETJD NODE ID RESERVED DATA START XPacketDataEnum XI i Y O 56 yn Messages Buffers 22MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 uint32 t timer rate bool sleeping application command state bool sending _packet uintl6 _t segno XDataMsg tmppack TOS Msg packet TOS Msg msg send_buffer TOS MsgPtr msg ptr int packetCount 0 MPK int timerTicks 0 MPK int maxTicks 2 MPK Broadcast every minute until quckMeshCount gt MPK QUICK MESH COUNT int guickMeshCount 0 MPK uinti6 t msg status pkt full char test int8_t record 25 static void initialize atomic sleeping FALSE sending_packet FALSE timer_rate XSENSOR SAMPLE RATE ORIGINAL LINE timer_rate MPK RATE MPK pf e 56 56 fe fe 3 3 6 fe de 3 3 36 de de 3 3 36 3 fe de 3 36 fe fe de 3 3 3 de de 3 3 36 36 fe fe 3 36 fe fe fe de 3 3 fe fe de 3 36 36 fe fe 3 3 36 fe fe fe 3 3 fe fe e 3 3 3 fe fe ACI A fe a ak ak x Initialize the component Initialize Leds e e fe fe er 3 fe de de 3 3 de ell 3 6 3 3 36 fe fe de de 3 36 fe fe de
81. dDataHeader typedef struct SerialIDData uint8_t id 8 attribute packed SerialIDData typedef struct XCmdDataMsg XCmdDataHeader xHeader union PDatal datapl SerialIDData sid xData attribute_ packed XCmdDataMsg if defined PLATFORM MICA2 define MOTEBOARDID 0x60 MTS300 sensor board id endif if defined PLATFORM MICA2DOT define MOTEBOARDID 0x61 MTS300 sensor board id endif if defined PLATFORM MICAZ define MOTEBOARDID 0x62 MTS300 sensor board id endif enum AM XCOMMAND MSG 48 SS x x amp JE 06 0 JE N ea PE DE 6 i i a 6 6 0 76 EE 0 6 DE SE PE 1 MICA2 SOFTWARE 81 1 2 xbow apps XMesh XMDA300 directory tab 4 IMPORTANT READ BEFORE DOWNLOADING COPYING INSTALLING OR USING downloading copying installing or using the software you agree to this license If you do not agree to this license do not download install copy or use the software Intel Open Source License Copyright c 2002 Intel Corporation All rights reserved Redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met Redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer Redistributions in binary form must reproduce the above copyright notice this list of conditions and the foll
82. data signal ADConvert dataReady chan ADCERROR resetExcitation return FAIL if state PICK CHANNEL state GET SAMPLE if call I2CPacket readPacket 2 0x03 0 reading from the bus failed state IDLE post adc_get_data resetExcitation 2 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY return FAIL return SUCCESS event result t Switch getDone char val return SUCCESS event result_t Switch setDone bool r return SUCCESS 63 84 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 6 706 po Mee n Pe e e e 2 ce e MH i 6 ES i 6 RR 3 xbow tos sensorboards mda300 directory Copyright c 2003 The Regents of the University of California All rights reserved Redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met Redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHA
83. dule is desgined to take readings from a Crossbow MDA300 sensor board and store them in the flash memory of a Mica2 mote until such time as the user downloads the data over the wireless radio using a java application on a PC includes sensorboard module MDA300LoggerM provides interface StdControl provides interface Sensing uses interface StdControl as Comm interface StdControl as Logger interface Leds interface Timer as Timer 1 MDA300LOGGER DIRECTORY interface LoggerWrite interface ProcessCmd as CmdExecute Sampler Communication interface StdControl as SamplerControl interface Sample interface PowerManagement support for plug and play command result t PlugPlay command result_t PowerEnable implementation define ANALOG SAMPLING TIME 10 define MISC_SAMPLING_TIME 15 define READY TEMPERATURE 0x01 define READY_HUMIDITY 0x02 define READY BATTERY 0x04 define READY DATA 0x08 define LINE READY 0x0F define TIME POS define SECS_POS define SAMPLE POS 4 define BATT POS 6 define SCRATCH_POS 7 N define TEMP POS 4 define HUMID POS 5 define DATA POS 6 define RADIO TICK INTERVAL 30 declare module static variables here uinti6 t currentRowl 8 current working row 1 of log uinti6 t currentRow2 8 current working row 2 of log uint16_t nullDataRow 8 uint8 t lineStatus short busy 0 unsigned int nsamples samples left unsigned int tota
84. dy uintl6 t data if data ADCERROR signal Sample dataReady 6 ANALOG data return SUCCESS event result_t ADC7 dataReady uinti6 t data if data ADCERROR signal Sample dataReady 7 ANALOG data return SUCCESS event result_t ADCS dataReady uintl6 t data if data ADCERROR signal Sample dataReady 8 ANALOG data return SUCCESS event result_t ADC9 dataReady uinti6 t data if data ADCERROR signal Sample dataReady 9 ANALOG data return SUCCESS event result_t ADC10 dataReady uintl6 t data if data ADCERROR signal Sample dataReady 10 ANALOG data return SUCCESS event result_t ADCll dataReady uintl6 t data if data ADCERROR signal Sample dataReady 11 ANALOG data return SUCCESS event result_t ADC12 dataReady uintl6 t data Z4MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 if data ADCERROR signal Sample dataReady 12 ANALOG data return SUCCESS event result_t ADC13 dataReady uint16_t data if data ADCERROR signal Sample dataReady 13 ANALOG data return SUCCESS async event result_t Battery dataReady uintl6 t data signal Sample dataReady 0 BATTERY data return SUCCESS event result_t Temp dataReady uintl6 t data signal Sample dataReady 0 TEMPERATURE data data type problem return SUCCESS event result_t Hum dataReady uintl6 t data signal Sample dataReady 0 HUMIDITY data return
85. e waiting for data p setProperty putHeader true saveSequenceNo sequenceNo 1 System exit 0 catch Exception e e printStackTrace public void messageReceived int dest addr Message m FileOutputStream fos null PrintWriter fileOut null FileOutputStream los null PrintWriter logOut null try los new FileOutputStream BcastInject log true logOut new PrintWriter los logOut println new Date logOut println mys catch IOException e System err println Error opening log file e e printStackTrace if isRead try fos new FileOutputStream outputFilename true append fileOut new PrintWriter fos catch IOException e System err println Error while opening output file e e printStacETrace 31 P 32MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG long timestamp O String dataRow new String 8 nn String rawString LogMsg lm LogMsg m for int i 0 i gt 16 i rawString lm getElement log i gt 167 0 Long toHexString Im getElement log i amp Oxff 0 if isRead if p getProperty putHeader true equals true fileOut println new Date fileOut println 2y p setProperty put Header
86. eeds to be programmed with TOSBase and plugged into the MIB510 All other motes need to be installed with an XSensorMXX4HF application and put within range of the base station or a valid multi hop peer Take care to program all the motes to the same frequency and group id 2 UC 7420 SOFTWARE 107 2 2 xbow beta tools src xcmd apps directory fax x Handles generating and sending commands to control an XSensor application 6 cmd_XSensor c Gauthor Martin Turon Qversion 2004 10 5 mturon Initial version Copyright c 2004 Crossbow Technology Inc All rights reserved x Id cmd XSensor c v 1 5 2005 02 02 05 47 40 husg Exp include xcommand h enum Basic instructions XCOMMANDEND 0x0 XCOMMAND NOP 0x1 XCOMMAND GET SERIALID Power Management XCOMMAND RESET 0x10 XCOMMAND SLEEP XCOMMAND WAKEUP Basic update rate XCOMMAND SET RATE 0x20 Update rate XCOMMAND GET RATE MoteConfig Parameter settings XCOMMAND GET_CONFIG 0x30 Return radio freq and power XCOMMAND SET NODEID XCOMMAND SET GROUP XCOMMAND SET RF POWER XCOMMAND SET RF CHANNEL Actuation XCOMMAND ACIUATE 0x40 XCommandOpcode enum XCMD DEVICE LED GREEN XCMD DEVICE LED YELLOVV XCMD DEVICE LED RED XCMD DEVICE LEDS XCMD DEVICE SOUNDER XCMD DEVICE RELAY1 XCMD DEVICE RELAY2 XCMD DEVICE RELAY3 XCMD DEVICE POT XSensorSubDevice 30MICA2 BASED WIRELESS ACM VERSION
87. efault display mode when xlisten is invoked with no arguments is r What follows is sample output for all three display options turned on at once xlisten b mica2dot r p c xlisten Ver Id xlisten c v 1 7 2004 03 23 00 52 28 mturon Exp Using params baud 0x000e raw parsed cooked dev ttyS0 input stream opened 7e7e000033000000c8035f61d383036100000000e4510d610000000080070000d4b5f577 7e00007d1d01010600c200050293014401210135012f0122010000000000000000000100 mda500 id 06 bat 00c2 thrm 0205 82 0193 a3 0144 a4 0121 a5 0135 86 012 5 2 MDA500 sensor data converted to engineering units health node id 6 battery volts 3163 mv thermistor resistance 10217 ohms tempurature 24 53 C adc chan 2 voltage 1246 mv adc chan voltage 1001 mv adc chan voltage 893 mv adc chan voltage 955 mv adc chan voltage 936 mv NOT adc chan voltage 896 mv section building Build Process S3MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE The source code for the xlisten tool is located at opt tinyos l x contrib xbow tools src xlisten n n To build the tool change to the xlisten source directory and run make n n To get the latest version of the source change to the xlisten source directory and run cvs update section setup Setup XListen is a command line tool that can be run from a cygwin shell by simply typing xlisten The executable needs to be in yo
88. enOn MPK MPK if enough ticks turn on the MDA300 and do a new MPK round of getSample calls atomic timerTicks MPK if guickMeshCount gt MPK QUICK _MESH COUNT MPK MPK atomic maxTicks MPK_TICKS MPK MPK MPK call RouteControl manualUpdate MPK if timerTicks gt maxTicks amp amp maxTicks gt 0 MPK return SUCCESS MPK atomic timerTicks 0 MPK atomic quickMeshCount 4 MPK call SamplerControl init MPK Is this necessary call SamplerControl start MPK if call PlugPlay MPK MPR record 14 call Sample getSample 0 TEMPERATURE MISC SAMPLING TIME SAMPLER DEFAULT MPK record 15 call Sample getSample 0 1 XBOVV APPS XMESH XMDA300 DIRECTORY 51 HUMIDITY MISC SAMPLING TIME SAMPLER DEFAULT MPK record 16 call Sample getSample 0 BATTERY MISC SAMPLING TIME SAMPLER DEFAULT MPK record 7 call Sample getSample 7 ANALOG ANALOG SAMPLING TIME AVERAGEFOUR EXCITATION 25 DELAY BEFORE MEASUREMENT MPK return SUCCESS Handles all broadcast command messages sent over network NOTE Bcast messages will not be received if seq no is not properly set in first two bytes of data payload Also payload is the remaining data after the required seg no P E We e i Qversion 2004 10 5 mturon Initial version event result t XCommand received XCommandOp
89. entRowl TIME POS 1 time sec gt gt 16 amp OxFFFF TIME POS 1 currentRow1 TIME_ POS 1 currentRow2 post writeRowl rowWaiting 2 return SUCCESS Event handler for the lt code gt LoggerWrite writeDone lt code gt event Toggle the yellow LED if status is true Qreturn Always returns lt code gt SUCCESS lt code gt event result_t LoggerWrite writeDone result_t status if rowWaiting 2 post writeRow2 if rowWaiting 0 busy 0 1 call SamplerControl stop call SamplerControl init return SUCCESS x Event handler to the lt code gt CmdExecute done lt code gt event Do nothing Qreturn Always returns lt code gt SUCCESS lt code gt event result t CmdExecute done TOS MsgPtr pmsg result_t status return SUCCESS 14MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG This software is largely based on software written by the University of x California As per the implied license agreement the original copyright notice is below I DE e AF 00000 06 E e 069 RR 5 2 Copyright c 2000 2003 The Regents of the University of California All rights reserved Permission to use copy modify and distribute this software and its documentation for any purpose without fee and without written agreement is hereby granted provided that the above copyright not
90. et set args ss args nsamples nsamples packet set args ss args interval interval sec packet set args ss args time time sec start_sensing true else if cmd equals read_log read log true packet set_action READLOG short address short Integer parseInt argv 1 outputFilename argv 2 packet set_args rl_ args destaddr address else 1 usage System exit 1 try System err print Sending payload for int i 0 i gt packet dataLength i System err print Integer toHexString packet dataGet i 8 Oxff System err println MoteIF mote new MotelF PrintStreamMessenger err Need to wait for messages to come back BcastInject bc null if read_log start sensing bc new BcastInject mote registerListener new LogMsg bc mote send TOS BCAST ADDR packet if start sensing p setProperty putHeader true synchronized bc 1 if bc start sensing done false System err println Waiting for response to start_sensing be wait 10000 System err println Done waiting for acks 2 JAVA DIRECTORY if read log 1 System err println Output file is outputFilename synchronized bc 1 bc isRead true if bc read log done false System err println Waiting for response to read log be wait 10000 System err println Don
91. g pMsg XXX return pMsg endif 65 DE 00 DE SE 2 UC 7420 SOFTWARE 97 2 UC 7420 Software 2 1 xbow beta tools src xcmd directory Sends commands to the serial port to control a wireless sensor network file xcommand c Gauthor Martin Turon version 2004 10 3 mturon Initial version Copyright c 2004 Crossbow Technology Inc All rights reserved Id xcommand c v 1 4 2004 11 11 01 00 51 mturon Exp include xcommand h static const char g_version Id xcommand c v 1 4 2004 11 11 01 00 51 mturon Exp A structure to store parsed parameter flags typedef union unsigned flat struct output display options unsigned display_raw 1 lt raw TOS packets unsigned display parsed 1 lt pull out sensor readings unsigned display_cooked 1 lt convert to engineering units unsigned export_parsed 1 lt output comma delimited fields unsigned export_cooked 1 lt output comma delimited fields unsigned log_parsed 1 lt log output to database unsigned 48 1 lt log output to database unsigned display_time 1 lt display timestamp of packet unsigned display ascii 1 lt display packet as ASCII characters unsigned display_rsvd 7 1 gt pad first word for output options modes of operation unsigned display help 1 unsigned display baud l1 lt baud was set by user unsigned mode debug 1 lt debug serial
92. g send buffer 86 MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 sending packet FALSE msg status 0 pkt full PACKET FULL MAKE BAT MONITOR OUTPUT enable voltage ref power pin as output MAKE ADC INPUT enable ADC7 as input usartl is also connected to external serial flash set usartl lines to correct state TOSH MAKE FLASH SELECT OUTPUT TOSH MARE FLASH OUT OUTPUT tx output TOSH MARE FLASH CLE OUTPUT usart clk TOSH SET_FLASH_SELECT_PIN call SamplerControl init initialize return SUCCESS return rcombine call SamplerControl init call CommControl init pf e 3 fe fe fe ae fe fe fe fe e e 36 de de 3 3 36 3 fe fe e 36 fe fe de 3 3 3 de de 3 3 36 fe fe fe 3 36 fe fe fe e 3 3 de fe e e e 36 fe fe e e fe fe fe fe e ICCC e fe fe ACI e A a ak ak Start the component Start the clock Setup timer and sampling e e fe fe fe e e 3 56 de de 3 3 fe de de 3 3 36 3 fe 3 3 36 fe fe de de 3 36 fe eel 36 3 lle 3 fe fe e 36 fe fe ell lola e fe fe 3 3 36 fe fe fe 3 a fe de 3 e ai a command result_t StdControl start call SamplerControl start if call PlugPlay call Timer start TIMERREPEAT timer rate channel parameteres are irrelevent record 14 call Sample getSample 0 TEMPERATURE MISC SAMPLING TIME SAMPLER DEFAULT record 15 call Sample getSample 0 HUMIDITY MISC_SAMPLI
93. gt data 6 7 analog adc data Ch 1 msg gt data 8 9 analog adc data Ch 2 msg gt data 10 11 analog adc data Ch 3 msg gt data 12 13 analog adc data Ch 4 msg gt data 14 15 analog adc data Ch 5 msg gt data 16 17 analog adc data Ch 6 PACKET 2 of 4 msg gt data 0 sensor id MDA300 0x81 msg gt data 1 packet number 2 msg gt data 2 node id msg gt data 3 reserved msg gt data 4 5 analog adc data Ch 7 msg gt data 6 7 analog adc data Ch 8 msg gt data 8 9 analog adc data Ch 9 msg gt data 10 11 analog adc data Ch 10 msg gt data 12 13 analog adc data Ch 11 msg gt data 14 15 analog adc data Ch 12 msg gt data 16 17 analog adc data Ch 13 PACKET 3 of 4 msg gt data 0 sensor id MDA300 1 msg data 1 packet number 3 msg gt data 2 node id msg gt data 3 reserved msg gt data 4 5 digital data Ch 0 msg gt data 6 7 digital data Ch l msg gt data 8 9 digital data Ch 2 msg gt data 10 11 digital data Ch 3 msg gt data 12 13 digital data Ch 4 20 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 x msg gt data 14 15 digital data Ch 5 x PACKET 4 of 4 msg gt data 0 sensor id MDA300 0x81 msg gt data l packet number 4 msg gt data 2 node id x msg gt data 3 reserved x msg gt data 4 5 batt x msg gt data 6 7 hum x msg gt data
94. he same as the i flag The sf flag tells xlisten to specifically use the TinyOS ial forwarder protocol subsection raw r raw n n n n n n n Raw mode displays the actual TOS packets as a sequence of bytes as seen coming over the serial line Sample output follows xlisten r xlisten Ver Id xlisten c v 1 7 2004 03 23 00 52 28 mturon Exp Using params raw dev ttyS0 input stream opened 7e 7e000033000000c8035f61d383036100000000e4510d610000000080070000d4b5f577 7e00007d1d8101060029091e09ef082209e7080bp09b40800000000000000000000000100 7e00007d1d81020600f007de07da07d507c3064706540500000000000000000000000100 subsection parsed p parsed The Parsed mode attempts to interpret the results of the incoming TOS packets and display information accordingly The first stage of the parsing is to look for a valid sensorboard id field and display the part number node_id of the packet sender is also pulled out and displayed Finally raw sensor readings are extracted and displayed with some designation as to their meaning xlisten p b mica2dot xlisten Ver Id xlisten c v 1 7 2004 03 23 00 52 28 mturon Exp Using params baud 0x000e parsed dev ttyS0 input stream opened mda500 id 06 bat 00cl thrm 0203 82 0196 a3 0149 a4 011d a5 012b a6 0llb a7 0147 mda500 id 06 bat 00c2 thrm 0203 a2 019d a3 014d 84 0116 a5 0131 a6 0llb a7 0140 mda500 id 06 bat 00c2 thrm 0204 a2 019
95. hor appear in all copies of this software IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT INDIRECT SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGFS ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE SOFTWARE PROVIDED HEREUNDER IS ON AN AS IS BASIS AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE SUPPORT UPDATES ENHANCEMENTS OR MODIFICATIONS Copyright c 2002 2003 Intel Corporation All rights reserved This file is distributed under the terms in the attached INTEL LICENSE file If you do not find these files copies can be found by writing to Intel Research Berkeley 2150 Shattuck Avenue Suite 1300 Berkeley CA 94704 Attention Intel License Inguiry This software was slightly modified by Hasan Ozer and Mat Kotowsky to include a 3rd integer argument to the start sensing command It remains otherwise unchanged from the original University of California software Contact kotowsky northwestern edu Author Robert Szewczyk Su Ping 1d author Robert Szewczyk author Su Ping 1 MDA300LOGGER DIRECTORY includes SimpleCmdMsg fax This is an enhanced version of Simple
96. ice the following two paragraphs and the author appear in all copies of this software IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT INDIRECT SPECIAL INCIDENTAL OR CONSEOUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFIWARE AND ITS DOCUMENTATION EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE SOFIWARE PROVIDED HEREUNDER IS ON AN AS IS BASIS AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE SUPPORT UPDATES ENHANCEMENTS OR MODIFICATIONS Copyright c 2002 2003 Intel Corporation All rights reserved This file is distributed under the terms in the attached INTEL LICENSE file If you do not find these files copies can be found by writing to Intel Research Berkeley 2150 Shattuck Avenue Suite 1300 Berkeley CA 94704 Attention Intel License Inguiry This software was slightly modified by Hasan Ozer and Mat Kotowsky to include a 3rd integer argument to the start_sensing command It remains otherwise unchanged from the original University of California software Contact kotowsky northwestern edu Configuration for SimpleCmd module FR ES 6 06 Author Contact tinyos help millennium berkeley edu Description SimpleC
97. id xconvert_adc_precision packet gt data 0 xconvert_adc_precision packet gt data 1 xconvert_adc_precision packet data 2 xconvert_adc_precision packet gt data 3 xconvert 806 single packet gt data 4 xconvert_adc_single packet gt data 5 xconvert_adc_single packet gt data 6 Jia MDA300 specific display of converted readings for packet 3 void mda300_print_cooked_3 XbowSensorboardPacket packet printf MDA300 sensor data converted to engineering units n 2 health node id i packet i n n packet gt node_id packet gt packet_id MDA300 specific display of converted readings for packet 4 void mda300_print_cooked_4 XbowSensorboardPacket packet 2 UC 7420 SOFTWARE 117 XSensorMDA300Data4 data XSensorMDA300Data4 packet data printf MDA300 sensor data converted to engineering units n 2 health node id i packet i n 3 battery voltage i mV n a temperature 0 21 C n humidity 0 1 n n packet gt node_id packet gt packet id xconvert_battery_mica2 data gt battery xconvert sensirion temp amp data gt sensirion xconvert_sensirion_ humidity amp data gt sensirion MDA300 specific display of converted readings for packet 5 void mda300_print_cooked_5 XbowSensorboardPacket packet XSensorMDA300Data5 data XSensorMDA300Data5 packet gt data
98. kets file author version Copyright RX XXX x mda300 c Martin Turon 2004 3 23 mturon Initial version c 2004 Crossbow Technology Inc All rights reserved Id mda300 c v 1 29 2005 01 29 00 47 41 mturon Exp include lt math h gt Hifdef arm__ include lt sys types h gt endif include xsensors h include timestamp timestamp h MDA300 XSensor packet 1 contains single analog adc channels typedef struct uintl6_t uintl uintl uintl uintl uintl ct ct cr ct tt 6 6 6 6 6 6 uintl 8060 adcl adc2 adc3 adc4 adc5 adc6 XSensorMDA300Datal MDA300 XSensor packet 2 contains precision analog adc channels typedef struct uintl6_t uintl uintl uintl uintl uintl ct ct ct ct ct ct 6 6 6 6 6 6 uintl adc7 8068 adc9 adcl0 adcll adcl2 adcl3 XSensorMDA300Data2 MDA300 XSensor packet 3 contains digital channels typedef struct uintl6_t uintl6_t uintl6_t uint16_t uint16_t uintl6 t digi0 digil digi2 digi3 digi4 digi5 SIMICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE XSensorMDA300Data3 MDA300 XSensor packet 4 contains misc other sensor data typedef struct uinti6 t battery XSensorSensirion sensirion uinti6 t counter XSensorMDA300Data4 MDA300 XSensor p
99. l I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 13 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MPKK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 10 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MKK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 14 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MKK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 11 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MPK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 15 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 0 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 1 MPK ADCaddress ADCaddress lt lt 4 amp 0xf0 MPKK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK ADCaddress 2 MPK 38 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 ADCaddress ADCaddress
100. l Research Berkeley 2150 Shattuck Avenue Suite 1300 Berkeley CA 94704 Attention Intel License Inguiry MDA300Logger nc is based on SenseLightToLog nc written by David Culler and Su Ping Intel Research Berkeley Lab Date 7 11 2002 Modifications by Hasan Ozer and Mat Kotowsky Northwestern University November 2004 includes sensorboardApp configuration MDA300Logger provides interface Sensing implementation 1 MDA300LOGGER DIRECTORY components Main MDA300LoggerM SimpleCmd LedsC SamplerC components GenericComm as Comm TimerC Logger components HPLPowerManagementM Main StdControl gt MDA300LoggerM MDA300LoggerM Leds gt LedsC MDA300LoggerM Timer gt TimerC Timer unique Timer MDA300LoggerM LoggerWrite gt Logger LoggerWrite MDA300LoggerM PowerEnable gt HPLPowerManagementM Enable MDA300LoggerM Comm gt Comm MDA300LoggerM Logger gt Logger Sensing MDA300LoggerM Sensing Sampler Communication MDA300LoggerM SamplerControl gt SamplerC SamplerControl MDA300LoggerM Sample gt SamplerC Sample support for plug and play MDA300LoggerM PlugPlay SamplerC PlugPlay 6 RE 00000 I DE e dE PE SR OR 2 MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG This software is largely based on software written by the University of California
101. l getParent if FEATURE UART SEND if TOS LOCAL ADDRESS 0 call Leds yellowOn call PowerMgrDisable TOSH_uwait 1000 if call SendUART send TOS UART ADDR sizeof XDataMsg msg ptr SUCCESS atomic sending_packet FALSE call Leds greenToggle call PowerMgrEnable else Hendif Send the RF packet call Leds yellowOn if call Send send msg ptr sizeof XDataMsg SUCCESS atomic sending_packet FALSE call Leds yellowOn call Leds greenOff 1 XBOVV APPS XMESH XMDA300 DIRECTORY AT pif FEATUREUART SEND fax x Handle completion of sent UART packet Gauthor Martin Turon x Qversion 2004 7 21 mturon Initial revision event result t SendUART sendDone TOS_MsgPtr msg result t success if msg gt addr TOSUART ADDR atomic msg_ptr msg msg_ptr gt addr TOS_BCAST_ADDR if call Send send msg ptr sizeof XDataMsg SUCCESS atomic sending_packet FALSE call Leds yellowOff if TOSLOCAL ADDRESS 0 never turn on power mgr for base call PowerMgrEnable I return SUCCESS endif fax Handle completion of sent RF packet author Martin Turon x version 2004 5 27 mturon Initial revision event result t Send sendDone TOS_MsgPtr msg result_t success atomic msg_ptr msg sending packet FALSE call Leds yellowOff if FEATUREUART SEND if TOSLOCAL ADDRESS 0 ne
102. l_samples total samples int8_t record 25 uint32_t time sec uint32_t interval_sec unsigned int ticks 0 uint32_t secs 0 int radioCounter RADIO_TICK_INTERVAL int rowWaiting 0 fax x Initialize the application 8 MICA2 BASED VVIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG return Initialization status command result_t StdControl init call PowerEnable call SamplerControl init call Logger init call Comm init return SUCOESS Insert a row that indicates the beginning of the test task void writeNullTask call LoggerWrite append uint8_t amp nullDataRow Start the application return Start status command result_t StdControl start int i call Leds redOn for i 0 i lt 8 i nullDataRow i OxFFFF lineStatus 0 return rcombine call Logger start call Comm start Stop the application return Stop status command result_t StdControl stop call Logger stop return call Comm stop This command belongs to the lt code gt Sensing lt code gt interface It starts the timer to generate periodic events return Always returns lt code gt SUCCESS lt code gt command result_t Sensing start unsigned long samples unsigned long interval unsigned long time if samples 0 return SUCCESS 1 MDA300LOGGER DIRECTORY c
103. lt lt 4 amp 0xf0 MKK ADCaddress ADCaddress 0x03 MPK call I2CPacket writePacket 1 char amp ADCaddress 0x03 MPK TURN AMPLIFIERS OFF MPK VOLTAGE BOOSTER OFF MPK FIVE VOLT OFF MPK THREEVOLT OFF MPK TURN VOLTAGE BUFFER OFF MPK call SwitchControl stop return SUCCESS command result_t SetParam setParam uint8 t id uint8_t mode f param id mode return SUCCESS default event result t ADConvert dataReady uint8 t id uintl6_t data return SUCCESS task void 806 60 08 8 uint8_t mylndex uint8_t count uint16 t my bitmap if state IDLE return That means the component is busy in a conversion process When conversion done either successfull or fail it is gauranteed that this task will be posted so we can safely return value 0 state START_CONVERSION_PROCESS atomic my_bitmap adc_bitmap it gaurantees a round robin fair scheduling of ADC conversions count 0 myIndex chan 1 if myIndex gt MAX ANALOG CHNNELS myIndex 0 while I testbit my_bitmap myIndex mylndex if myIndex gt MAX ANALOG CHNNELS mylndex 0 count if count gt MAX ANALOG CHNNELS state IDLE return no one waiting for conversion chan mylndex setExcitation 2 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY 99 setNumberOfConversions if among the instrumentation channels we set the MUX if chan 7 chan 8 chan 9
104. lt suppress headers unsigned mode_version 1 lt print versions of all modules unsigned mode_header 1 lt user using custom packet header unsigned 066 1 lt connect to a serial socket unsigned mode sf 1 lt connect to a serial forwarder unsigned mode framing 2 lt auto 0 framed 1 unframed 2 bits struct unsigned short output 1 gt one output option required unsigned short mode options s_params A variable to store parsed parameter flags 32MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKF static s params g params static int g_istream lt Handle of input stream fax gt Extracts command line options and sets flags internally param argc Argument count param argv Argument vector author Martin Turon Qversion 2004 3 10 mturon Intial version n 2004 3 12 mturon Added b s g x n 2004 8 04 mturon Added 1 ver 1 11 n 2004 8 22 mturon Added i ver 1 13 n 2004 9 27 mturon Added t ver 1 15 n 2004 9 29 mturon Added f a v 1 16 void parse args int argc char argv This value is set if when the bitflag is set unsigned baudrate 0 char xserver port g params flat 0 default to no params set xpacket_initialize while argc if argv argc amp amp argv argc switch argv arsc 1 case _par
105. md module demonstrates a simple command interpreter for TinyOS tutorial Lesson 8 in particular It receives a command message from its RF interface which triggers a command interpreter task to execute the command When the command is finished executing the component 1 MDA300LOGGER DIRECTORY 15 signals the upper layers with the received message and the status x indicating whether the message should be further processed As a simple version it can only interpret the follwoing commands x Led_on 1 Led_off 2 radio_quieter 3 radio louder 4 x start_sensing 5 and read log 6 Start sensing commands will trigger the Sensing start interface while read log will read the EEPROM with a specific log line and broadcast the line over the radio when read is done includes SimpleCmdMsg configuration SimpleCmd provides interface ProcessCmd implementation components Main Simple CmdM MDA300Logger Logger TimerC GenericComm as Comm PotC LedsC Main StdControl gt SimpleCmdM SimpleCmdM Leds gt LedsC ProcessCmd SimpleCmdM ProcessCmd SimpleCmdM CommControl gt Comm SimpleCmdM ReceiveCmdMsg gt Comm ReceiveMsg AM SIMPLECMDMSG SimpleCmdM SendLogMsg gt Comm SendMsg AM LOGMSG SimpleCmdM LoggerRead gt Logger SimpleCmdM Pot PotC SimpleCmdM Sensing lt MDA300Logger Sensing SimpleCmdM ReadTimer gt TimerC Timer unique 7 Timer
106. n Nodes typically ignore messages for a group which they have not been programmed for so it is important to pass the correct group here subsection sequence seg no sequence This flag defines the sequence number that will be used for sending the command packet The TinyOS Bcast component uses the sequence number to insure that the same command doesn t cycle through the network forever Try and increment this number systematically everytime a command message is sent subsection application a am_type app This flag specifies which AM TOS type to send the message on The AM type can be passed as an integer or as an application name For example Surge sends commands on AMTYPE 18 To set the rate of a Surge node one would use xcmd a 18 set rate The default am_type will work for any application that uses the TinyOS XCommand component such as XSensor section params Commands subsection sleep XCommand Will tell the mote to stop collecting data and go to sleep subsection wake XCommand Will wake up a mote and restart data aquisition from the sleep state subsection set rate XCommand The set_rate command will change the data aquisition duty cycle of the 30GMICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE mote The first argument is the new timer interval in milliseconds subsection set_leds XCommand The set_leds command will actuate all three LEDs of a mote using
107. ng or using the software you agree to this license If you do not agree to this license do not download install copy or use the software Intel Open Source License Copyright c 2002 Intel Corporation All rights reserved Redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met Redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer Redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFIWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS CAS IS AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE INTEL OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEOUENTIAL DAMAGES INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHEIHER IN CO
108. ooked_4 packet break case 5 mda300_print_cooked_5 packet break case 6 mda300_print_cooked_6 packet break default printf MDA300 Error unknown packet id i n n packet gt packet id XPacketHandler mda300_packet_handler XTYPE_MDA300 Id mda300 c v 1 29 2005 01 29 00 47 41 mturon Exp mda300_print raw mda300_print_cooked mda300 print raw mda300_print_cooked iz void mda300 initialize xpacket_add_type amp mda300_packet_handler 32MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE 2 4 xbow beta tools src xlisten directory Makefile for xlisten Id Makefile v 1 24 2005 01 28 05 19 24 mturon Exp CC gcc ARMCC arm linux gcc LFLAGS lm CFLAGS O2 VVall Wno format Main xlisten sources SRCS xlisten c xpacket c xconvert c SRCS xserial c xsocket c Add Mote Sensor board support SRCS boards mica2 c boards mica2dot c boards micaz c Add Mote Data Aquisition board support SRCS boards mda300 c Add Mica2 integrated sensorboards SRCS boards msp410 c Add support for virtual board that XsensorTutorial uses during Training seminar Add AM types SRCS amtypes health c amtypes surge c SRCS timestamp timestamp c all xlisten xlisten SRCS CC CFLAGS o G SRCS LFLAGS xlisten arm SRCS ARMCC I INCDIR CFLAGS o SRCS
109. os Z Properties for BcastInject n catch IOException e System err println Exception while saving sequence number e e printStackTrace public static void main String argv throws IOException String cmd byte sequenceNo 0 boolean read_log false boolean start_sensing false if argv length lt 1 usage System exit 1 cmd argv 0 if cmd equals start_sensing amp amp argv length 4 startSensing Usage System exit 1 else if cmd equals read_log amp amp argv length 3 readLog Usage System exit 1 SimpleCmdMsg packet new SimpleCmdMsg seguenceNo restoreSequenceNo packet set_seqno sequenceNo packet set_hop_count short 0 packet set_source 0 if cmd equals led_on packet set_action LED ON led_off LED OFF radio louder RADIO LOUDER 0 else if cmd eguals packet set_action else if cmd eguals packet set_action else if cmd equals radio_quieter RADIO QUIETER Fd dd GT DN ld packet set_action 30 MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG else if cmd eguals start sensing packet set_action START SENSING short nsamples short Integer parseInt argv 1 long interval_sec long Integer parseInt argv 2 int time_sec int Integer parseInt argv 3 pack
110. owing disclaimer in the documentation and or other materials provided with the distribution Neither the name of the Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFIWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS CAS IS AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE INTEL OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEOUENTIAL DAMAGES INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHEIHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFIWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE Qauthor Leah Fera Martin Turon Jaidev Prabhu Id XMDA300M nc v 1 4 2005 01 11 05 21 35 husg Exp pf e 3 af fe fe ae af fe fe fe e e e ell 36 fe de 3 36 fe le de de 3 3 de de de 3 3 36 3 lle 3 fe fe de 36 fe el 36 ella e fe fe fe e e fe fe fe e e ICICI de A a e de e Tests the MDA300 general prototyping card see Crossbow MIS Series User Manual Read and control all MDA300 signals ADCO ADC1 ADC2 ADC3 AD
111. pen dix is organized by software directory and only the modified files are included 77 38 MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 1 MICA2 Software 1 1 xbow tos XLib directory file XCommand h Qauthor Martin Turon version 2004 10 1 mturon Summary of XSensor commands reset sleep wakeup OE i RR Se o R W 6 SE PE define INITIAL TIMER RATE 10000 enum Basic instructions XCOMMAND END 0x0 XCOMMAND NOP Oxl XCOMMAND GET SERIALID Power Management XCOMMAND RESET 0x10 XCOMMAND SLEEP XCOMMAND WAKEUP Basic update rate XCOMMAND SET RATE 0x20 XCOMMAND GET RATE MoteConfig Parameter settings XCOMMAND GET_CONFIG 0x30 XCOMMAND SET_NODEID XCOMMAND SET GROUP XCOMMAND SET RF POWER XCOMMAND SET RF CHANNEL Actuation XCOMMAND ACTUATE 0x40 controlling a wireless sensor network set get rate heartbeat set get nodeid group set get radio freg band power actuate device state set get calibration set get mesh type max resend Copyright c 2004 Crossbow Technology Provides a library module for handling basic application messages for version All rights reserved Id XCommand h v 1 2 2005 01 27 03 36 31 husq Exp Update rate Return radio freg and power SHAKF 1 MICA2 SOFTWARE MPK 79 XCOMMAND SET TICRS 0x50 MPK XCOMMAN
112. play of converted readings for packet 1 310MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKE void mda300 _print_ cooked _1 XbowSensorboardPacket packet printf MDA300 sensor data converted to engineering units n 2 health node id i packet i n 7 adc chan 0 voltage i mV n 2 adc chan 1 voltage i mV n 3 adc chan 2 voltage i mV n 2 adc chan 3 voltage i mV n 2 adc chan 4 voltage i mV n adc chan 5 voltage i mV n adc chan 6 voltage i mV n n packet gt node_id packet gt packet_id xconvert_adc_single packet gt data packet gt data packet gt data packet gt data packet gt data packet gt data packet gt data xconvert_adc_single xconvert_adc_single xconvert adc single xconvert adc single xconvert adc single xconvert adc single MDA300 specific display of converted readings LE a ES e NS o for packet 2 void mda300_print_cooked_2 XbowSensorboardPacket packet printf MDA300 sensor data converted to engineering units n 2 health node id i packet i n adc chan 7 voltage i uV n 2 adc chan 8 voltage i uV n F adc chan 9 voltage i uV n adc chan 10 voltage i uV n 2 adc chan 11 voltage i mV n adc chan 12 voltage i mV n 0 adc chan 13 voltage i mV n n packet gt node_id packet gt packet
113. ponse to the event from lt code gt Sensing done lt code gt return Always returns lt code gt SUCCESS lt code gt event result t Sensing done call Leds yellov Off return SUCCESS x Initialize the application x return Success of component initialization command result_t StdControl init cur_msg amp buf send_pending FALSE eeprom _read_pending FALSE return rcombine call CommControl init call Leds init Start the application x return Always returns lt code gt SUCCESS lt code gt command result_t StdControl start return SUCCESS Stop the application x return Always returns lt code gt SUCCESS lt code gt command result_t StdControl stop return SUCCESS Signalled when the log has completed the reading and now we re ready to send out the log message x return Always returns lt code gt SUCCESS lt code gt 22MICA2 BASED WIRELESS ACM VERSION 1 SOFTWARE MODIFICATION OF SENSELIGHTTOLOG xx event result t LoggerRead readDone uint8 t packet result t success Send message only if read was successful struct LogMsg xlm if success amp amp eeprom read_pending amp amp send_pending lm struct LogMsg log msg data lm gt sourceaddr TOS LOCAL ADDRESS if call SendLogMsg send TOS BCAST ADDR sizeof struct LogMsg amp log msg call Leds redOn send_pending TRUE eeprom read
114. rgs argc argv while 1 SHAKE 2 UC 7420 SOFTWARE 127 if g params bits mode sf Serial forwarder read length xsocket_read_packet g_istream buffer else Serial read direct or over socket mib600 length xserial_port_read_packet g_istream buffer if length lt XPACKET_MIN SIZE continue ignore patial packets and packetizer frame end if gs params bits display time xpachet print time if g params bits display rav xpacket_print_raw buffer length if 8g params bits 0182187 88011 xpacket_print_ascii buffer length if params bits mode s xpacket decode buffer length g_params bits mode framing if gs params bits display parsed xpacXet print parsed buffer if gs params bits export_parsed xpacket_export_parsed buffer if gs params bits export_cooked xpacket_export_cooked buffer if 8 params bits log_cooked xpacket log cooked buffer if g params bits display cooked xpacket_print_cooked buffer Ae UU I NL EEES ES ESE AE User Manual Follows fax Qmainpage XListen Documentation section version Version Id xlisten c v 1 17 2004 11 18 04 45 10 mturon Exp Qsection usage Usage Usage xlisten lt r p c x 1 d v d gt lt b baud gt lt s device gt lt h size gt
115. rn i command result_t Sample reTask int8_t record uinti6 t interval if record lt 0 record gt MAXSAMPLERECORD return FAIL SampleRecord record sampling_interval interval return SUCCESS command result_t Sample stop int8_t record if record lt 0 record gt MAXSAMPLERECORD return FAIL f SampleRecord record channelType ANALOG setparam analog record 0 MPK SampleRecord record sampling_interval SAMPLERECORD FREE return SUCCESS default event result_t Sample dataReady uint8_t channel uint8 t channelType uint16_t data return SUCCESS event result_t ADCO dataReady uint1l6_t data if data ADCERROR signal Sample dataReady 0 ANALOG data return SUCCESS event result t ADC1 dataReady uintl6 t data if data ADCERROR signal Sample dataReady 1 ANALOG data return SUCCESS 3 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY event result_t ADC2 dataReady uintl6 t data if data ADCERROR signal Sample dataReady 2 ANALOG data return SUCCESS event result_t ADC3 dataReady uintl6 t data if data ADCERROR signal Sample dataReady 3 ANALOG data return SUCCESS event result_t ADC4 dataReady uintl6 t data if data ADCERROR signal Sample dataReady 4 ANALOG data return SUCCESS event result_t ADCO5 dataReady uintl6 t data if data ADCERROR signal Sample dataReady 5 ANALOG data return SUCCESS event result_t ADCO6 dataRea
116. rt by dumping bytes debug set the baudrate baud mica2 mica2dot set serial port device device com1 320MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 i use socket input inet zhost port sf use serial forwarder input inet host port n 1 specify framing 0 auto l zon 2 off n h specify header size header offset t display time packet was received timed q quiet mode suppress headers An v show version of all modules An exit 0 Default to displaying packets as raw parsed and cooked if g params options output 0 1 1 g params bits display raw g params bits display_parsed g params bits display cooked 1 Stream initialization Set STDOUT and STDERR to be line buffered so output is not delayed setlinebuf stdout setlinebuf stderr if g params bits mode socket g istream xsocket_port open else g istream xserial_port_open int xmain get verbose w return g_params bits mode_quiet The main entry point for the sensor listener console application param argc Argument count param argv Argument vector author Martin Turon Qversion 2004 3 10 mturon Intial version int main int argc char s argv int length unsigned char buffer 255 parse a
117. s V ExcitV s RefADC s gt lt XDSParam name printfields value 0081010 packetId ParentID nodeld RangeV ElExcitationV E1ReferenceADC gt lt XDataSink gt lt XDataSink name Generic File Datasink gt lt XDSParam name rawfilename value Vishay_Crack_Propagation_Narrow_Spacing_Raw csv gt lt XDSParam name parsedfilename value Vishay_Crack_Propagation_Narrow_Spacing_Parsed csv gt lt XDSParam name convertedfilename value Vishay_Crack_Propagation_Narrow_Spacing_Converted csv gt lt XDSParam name delim value gt lt XDSParam name header value yes gt lt XDSParam name timestamp value Yan d Y H M S gt lt XDSParam name backup value yes gt lt XDataSink gt lt XDataSink name Sensor Log Datasink gt lt XDSParam name sensorid value 162 gt lt XDSParam name tablename value Vishay_Crack_Propagation_Narrow_Spacing sensor _results gt lt XDSParam name sensorname value Crack Propagation Narrow Spacing gt lt XDSParam name columninfo value fieldName nodeld displayName Node Id displayOrder 1 gt lt XDSParam name columninfo value fieldName RangeV displayName RangeV displayOrder 2 unitName Volts unitShortName V sensorType Voltage sensorMinValue 0 136 4 eo MOTE BASED WIRELESS
118. sleep App Control set rate xcmd_set_rate Mote Configuration set_nodeid xcmd_set_nodeid set group xcmd_set_group 1 set_rf_power xcmd _set_rf_power set 11 channel xcmd _set_rf channel Actuation set_sound xcmd_set_sounder 31MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 SHAKF set leds xcmd set leds green_on xcmd_green_on green off xcmd green 011 green toggle xcmd green toggle red on xcmd red_on red off xcmd red_ off red toggle xcmd red toggle yellow_on xcmd_yellow_on yellow_off xcmd_yellow_off yellow toggle xcmd yellow toggle MPK set_pot xcmd_set_pot XMesh command here for now light path xmesh_cmd_light_path NULL NULL J Valid reference names for XSensor XCommand from the command line char xsensor_app keywords do cmd xcmd xcommand XCommand sensor xsensor XSensor NULL iz XAppHandler xsensor app desc AMTYPEXCOMMAND Id cmd XSensor c v 1 5 2005 02 02 05 47 40 husq Exp xsensor_cmd_list xsensor_app_keywords iz void initialize_XSensor xpachet add type Exsensor app desc 2 UC 7420 SOFTWARE 113 2 3 xbow beta tools src xlisten boards directory fax Handles conversion to engineering units of mda300 pac
119. ta 10 11 analog adc data Ch 10 msg gt data 12 13 analog adc data Ch 11 msg gt data 14 15 analog adc data Ch 12 msg gt data 16 17 analog adc data Ch 13 PACKET 3 of 4 El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El El x El El El El El El El msg gt data 0 sensor id MDA300 1 msg data 1 packet number 3 msg gt data 2 node id msg gt data 3 reserved msg gt data 4 5 digital data Ch 0 msg gt data 6 7 digital data Ch 1 msg gt data 8 9 digital data Ch 2 msg gt data 10 11 digital data Ch 3 msg gt data 12 13 digital data Ch 4 1 MICA2 SOFTWARE 83 x msg gt data 14 15 digital data Ch 5 x PACKET 4 of 4 msg gt data 0 sensor id MDA300 0x81 msg gt data l packet number 4 msg gt data 2 node id x msg gt data 3 reserved x msg gt data 4 5 batt x msg gt data 6 7 hum x msg gt data 8 9 temp x msg gt data 10 11 counter x msg gt data l4 msg4 status debug FOCI HU include sensorboard h definitions from tos mda300 directory include appFeatures h includes XCommand includes sensorboard module XMDA300M provides interface StdControl uses interface Leds interface Send interface RouteControl ifdef XMESH
120. tible with the Mica2 The desired baudrate must be passed as a number directly after the equals sign with no spaces inbetween i e b 19200 Optionally a product name can be passed in lieu of an actual number and the proper baud will be set i e b mica2dot Valid product names are mica2 57600 baud mica2dot 19200 baud subsection serial s port serial This flag gives the user the ability to specify which COM port or device xlisten should use The default port is dev ttySO or the UNIX equivalent to COMI The given port must be passed directly after the equals sign with no spaces i e s com3 subsection internet i hostname port inet This flag tells xlisten to attach to a virtual serial connection over a TCP IP internet socket Specify the hostname and port to connect in the argument The default hostname is localhost and the default port 9001 The keyword mib600 can be passed as an alias to port 10002 when connecting to that hardware device The hostname and port must be passed directly after the eguals sign with no spaces with a optional colon inbetween i e i remote i 10 1 1 1 9000 i mymib mib600 i 9002 i localhost 9003 or i stargate xbow com subsection serial forwarder sf hostname port inet ser 2 UC 7420 SOFTWARE 129 This flag tells xlisten to attach to a serial forwarder connection over a TCP IP internet socket The hostname and port arguments are t
121. tion programs The user can pipe the output of xlisten in export mode to a file and load that file into Microsoft Excel to build charts of the information Sample output follows n xlisten b mica2dot g x n 51200 24323 54113 899 97 0 58368 3409 n 6 193 518 409 328 283 296 298 n 6 194 517 410 330 292 310 300 n 6 194 518 409 329 286 309 288 n 6 194 517 411 331 287 297 300 n 6 194 516 413 335 288 301 287 subsection timed t timed Displays the time at which the packet was received n xlisten t n 2004 09 29 10 24 29 n 2004 09 29 10 36 57 subsection ascii a ascii Displays the raw packet contents as ASCII characters subsection logging l logged Logs incoming readings to a Postgres database Default connection settings are server localhost port 5432 user tele pass tiny subsection header h size header Passing the header flag tells xlisten to use a different offset when parsing packets that are being forwarded by TOSBase Generally this flag is not required as xlisten autodetects the header size from the AM type When this flag is passed all xlisten will assume all incoming packets have a data payload begining after the header size offset subsection versions v versions Displays complete version information for all sensorboard decoding modules SHAKE n n n n n n n n n n n n n 2 UC 7420 SOFTWARE 131 within xlisten xlisten
122. type float gt lt XConversion gt lt XField gt lt potentiometer conversion report volts lt lt XField name RangeV byteoffset 20 length 2 type uintl6 gt lt XConversion function 1 225 x z returntype float gt lt XConvParam variablename x fieldname RangeV type float gt lt XConvParam variablename z fieldname E1ReferenceADC type float gt lt XConversion gt lt XField gt lt XFields gt lt XFilter gt gt LOGIC SocketID XSensorEKo AND BoardID SensorId AND PacketID 0 lt lt XCondAnd gt lt XCond name IsEqual gt lt XFilterParam name fieldname value socketId gt lt XFilterParam name fieldvalue value 0x34 gt lt XCond gt lt XCond name IsEqual gt lt XFilterParam name fieldname value boardId gt lt XFilterParam name fieldvalue value 162 gt 1 CPA CRACK PROPAGATION PATTERN CPA XML 135 lt XCond gt lt XCond name IsEqual gt lt XFilterParam name fieldname value packetId gt lt XFilterParam name fieldvalue value 0x0 gt lt XCond gt lt XCondAnd gt lt XFilter gt lt XDataSinks gt lt XDataSink name Generic Print Datasink gt lt XDSParam name printstring value Vishay Crack Propagation Sensor narrow spacing s s n 8 PortID s n RangeV
123. ur working path to use it A simple way to add xlisten to your working path is to create a soft link to it by running the following command n In s opt tinyos l x contrib xbow tools src xlisten usr local bin xlisten n n You can use xlisten to read sensor data from either one mote over a serial link or a wireless network of motes In both configurations you need to have a MIB510 board connected via a serial cable to your PC n n For a single mote configuration the mote must be programmed with a XSensorMXX 44 application and plugged into the MIB510 The mote will stream packets over the UART whenever it has power n n For the network of motes configuration a base station mote needs to be programmed with TOSBase and plugged into the MIB510 All other motes need to be installed with an XSensorMXX4HF application and put within range of the base station or a valid multi hop peer Xlisten must then be run with the w flag to properly parse the wireless packets Take care to program all the motes to the same freguency and group id CHAPTER 4 eKo mote based wireless ACPS software This appendix contains the XML files that were created for use with the CPA and CPC crack propagation patterns They are placed on the eKo base station in the usr xbow xserve configxml directory 133 134 4 e amp o MOTE BASED WIRELESS ACPS SOFTWARE 1 CPA crack propagation pattern cpa xml lt xml version 1 0 encoding I
124. used for keeping the monostable timer intl6_t sampling interval Sampling interval set by command above It is in second SampleRecord in no use if set to zero SampleRecord MAX SAMPLERECORD check what is the SampleRecords that are avilable and return one that is available static inline int8_t get_avilable_SampleRecord int8_t i for i 0 i lt MAX SAMPLERECORD i if SampleRecord i sampling interval SAMPLE RECORD FREE return i return 1 not available SampleRecord find the next channel which should be serviced task void next schedule 4 int8_t i int16_t min SCHEDULER RESPONSE TIME minimum time to ba called we set it to 15Sec min so that if a new sampling reguest comes we reply with 15 sec delay if stopFlag MPK return MPK for i 0 i MAX SAMPLERECORD i find out any one who should be serviced before next li 11 SampleRecord i sampling interval SAMPLE RECORD FREE 1 if SampleRecord i ticks_left gt min min SampleRecord i ticks left for i 0 i QMAX SAMPLERECORD i set the next time accordingly 3 XBOVV TOS SENSORBOARDS MDA300 DIRECTORY if SampleRecord i sampling interval SAMPLE RECORD FREE SampleRecord i ticks left SampleRecord i ticks left min min min gt TIME SCALE call SamplerTimer start TIMER ONESHOT min static since timer gets input in milisecond and we get command in 0
125. vent record 14 call Sample getSample 0 TEMPERATURE MISC SAMPLING TIME SAMPLER DEFAULT record 15 call Sample getSample 0 HUMIDITY MISC_SAMPLING_TIME SAMPLER DEFAULT record 16 call Sample getSample 0 BATTERY MISC_SAMPLING_TIME SAMPLER DEFAULT start sampling channels they are more percise hannels 3 6 make active excitation MPK record 0 call Sample getSample 0 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT Channels 7 10 with averaging since record 1 call Sample getSample 1 24MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF XMDA300 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT record 2 call Sample getSample 2 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT MPK MPK record 3 call Sample getSample 3 ANALOG ANALOG SAMPLING TIME SAMPLER DEFAULT EXCITATION 33 DELAY BEFORE MEASUREMENT record 4 call Sample getSample 4 ANALOG ANALOG_SAMPLING_TIME SAMPLER DEFAULT record 5 call Sample getSample 5 ANALOG ANALOG_SAMPLING_TIME SAMPLER DEFAULT record 6 call Sample getSample 6 ANALOG ANALOG_SAMPLING_TIME SAMPLER DEFAULT MPK record 7 call Sample getSample 7 ANALOG ANALOG SAMPLING TIME AVERAGEFOUR EXCITATION 25 DELAY BEFOREMEASUREMENT MPK record 8 call Sample getSample 8 ANALOG ANALOG SAMPLING TIME AVERAGE FOUR EXCITATION 25 record 9 c
126. ver turn on power mgr for base call PowerMgrEnable endif return SUCCESS fax x Handle a single dataReady event for all MDA300 data types 28 MICA2 BASED WIRELESS ACM VERSION 2 SOFTWARE MODIFICATION OF 0 author Leah Fera Martin Turon Qversion 2004 3 17 leahfera Intial revision n 2004 4 1 mturon Improved state machine event result_t Sample dataReady uint8 t channel uint8 t channelType uintl6 t data uint8_t i switch channelType case ANALOG switch channel MSG 1 first part of analog channels 0 6 case 0 Original line MPK case 7 MPK just cram ADC7 into ADCO s spot tmppack XDataMsg packet data tmppack gt xData datap6 adc0 data atomic msg status 0x01 break 0 case 1 tmppack XDataMsg packet data tmppack gt xData datap6 adcl data atomic msg status 0x02 break case 2 tmppack XDataMsg packet data tmppack gt xData datap6 adc2 data atomic msg status 0x04 break default break case ANALOG channel break case DIGITAL switch channel case 0 tmppack XDataMsg packet data tmppack gt xData datap6 dig0 data atomic msg status 0x08 break case 1 tmppack XDataMsg packet data tmppack gt xData datap6 digl data atomic msg status 0x10 1 XBOVV APPS XMESH XMDA300 DIRECTORY break case 2 tmppack XDataMsg packet data tmppack gt xData datap6 dig2
127. x California As per the implied license agreement the original copyright notice is below I DE e AF 00000 06 E e 069 RR 5 2 o HE PE dE R gt OP Copyright c 2000 2003 The Regents of the University of California All rights reserved Permission to use copy modify and distribute this software and its documentation for any purpose without fee and without written agreement is hereby granted provided that the above copyright notice the following two paragraphs and the author appear in all copies of this software IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT INDIRECT SPECIAL INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE THE SOFTWARE PROVIDED HEREUNDER IS ON AN AS IS BASIS AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE SUPPORT UPDATES ENHANCEMENTS OR MODIFICATIONS Copyright c 2002 2003 Intel Corporation All rights reserved This file is distributed under the terms in the attached INTEL LICENSE file If you do not find these files copies can be found by writing to Inte
128. xsocket_get_server xsocket_get_port if g params bits mode debug 30MICA2 BASED WIRELESS ACM VERSION 3 SOFTWARE MODIFICATION VERSION 2 XMDA300 in El El El El in printf debug serial dump Mn xserial_port_dump printf n if xcommand_print_help exit 0 s params bits display help Default to displaying packets as raw if 0 1 parsed g params options output g_params bits display_raw g_params bits display_parsed 1 g_params bits display_cooked Stream initialization Set STDOUT and STDERR to be line buffered setlinebuf stdout setlinebuf stderr so output if g params bits mode socket g ostream else 1 g ostream xsocket_port_open xserial_port_open t xmain_get_verbose return g params bits mode quiet The main entry point for the sensor commander console Qparam argc Argument count param argv Argument vector author Martin Turon version 2004 10 3 mturon Intial version t main int argc char argv int len 0 unsigned char buffer 255 parse_args argc argv if xcommand_print_help g command and cooked is not delayed application SHAKE 2 UC 7420 SOFTWARE 103 exit 2 if xpacket get app g am type printf error No command table for AM type d g am type
129. y_closed toggle call Leds greenOn else test 1 call relay_normally_open toggle call Leds greenOn MPK MPK if enough ticks turn on the MDA300 and do a new MPK round of getSample calls atomic timerTicks MPK if quickMeshCount gt MPK MESH COUNT MPK MPK atomic maxTicks MPK_TICKS MPK MPK MPK call RouteControl manualUpdate MPK if timerTicks gt maxTicks amp amp maxTicks gt 0 MPK return SUCCESS MPK atomic timerTicks 0 MPK atomic guickMeshCount MPK call SamplerControl init MPK Is this necessary call SamplerControl start MPK if call PlugPlay MPK MPK SHAKE 1 MICA2 SOFTWARE 95 record 14 call Sample getSample 0 TEMPERATURE MISC SAMPLING TIME SAMPLER DEFAULT MPK record 15 call Sample getSample 0 HUMIDITY MISC SAMPLING TIME SAMPLER DEFAULT MPK record 16 call Sample getSample 0 BATTERY MISC SAMPLING TIME SAMPLER DEFAULT record 7 call Sample getSample 7 ANALOG ANALOG SAMPLING TIME AVERAGE FOUR EXCITATION 25 DELAY BEFORE MEASUREMENT MPK return SUCCESS 2 i SS Handles all broadcast command messages sent over network NOTE Bcast messages will not be received if seg no is not properly set in first two bytes of data payload Also payload is the remaining data after the reguired seg no
130. yn Messages Buffers 1 MICA2 SOFTWARE 85 uint32 t timer rate bool sleeping application command state bool sending _packet uintl6 _t segno XDataMsg tmppack TOS Msg packet TOS Msg msg send_buffer TOS MsgPtr msg ptr int packetCount 0 MPK int timerTicks 0 MPK int maxTicks 2 MPK Broadcast every minute until quckMeshCount gt MPE QUICR MESH COUNT int guickMeshCount 0 MPK uinti6 t msg status pkt full char test int8_t record 25 static void initialize atomic sleeping FALSE sending_packet FALSE timer_rate XSENSORSAMPLERATE ORIGINAL LINE timer_rate MPKRATE MK pf e 56 56 fe fe 3 3 6 fe de 3 3 36 de de 3 3 36 3 6 de 3 36 fe fe de 3 3 de de de 3 3 36 fe fe fe 3 36 3 fe fe de 3 3 de fe de 3 36 36 fe fe 3 36 36 fe fe fe 3 3 fe fe e 3 3 CI fe 3 e e fe fe ak ak x Initialize the component Initialize Leds e e de fe fe 3 3 3 6 de de CCCI 3 3 fe 3 3 36 fe le de de 3 36 fe de de 3 3 36 3 de 3 3 36 fe fe fe e 36 fe ell eol 3 36 fe fe 3 3 36 fe de I 3 3 de fe 3 3 ica command result t StdControl init uint8_t i BEGIN MPK INT CODE sei Enable external interrupts EIMSK amp 1 lt lt 6 disable ext int 6 EICRB amp 0x03 lt lt 4 make int 6 low level triggered EIMSK 1 lt lt 6 turn on ext int 6 END MPK INT CODE call Leds init atomic msg ptr amp ms

Download Pdf Manuals

image

Related Search

Related Contents

Cisco Cable Assembly Dual RG-6, 6.1m  Brenthaven Kona Project 2  Mode d`installation  DataView PowerPad III Control Panel User`s Manual    ACTi E41A surveillance camera  OneView Life User Guide  取扱説明書(管理者用Web ブラウザ操作編)  LG Electronics 60H Flat Panel Television User Manual  Texte intégral PDF  

Copyright © All rights reserved.
Failed to retrieve file