Online Technical Writing
http://www.io.com/~hcexres/textbook/acctoc.html
Showing posts with label Research. Show all posts
Showing posts with label Research. Show all posts
2008/07/22
2008/02/04
Confidence Interval 信賴區間
Confidence Interval 信賴區間: 求一個機率範圍(probability bound)的模擬數據
http://hpds.ee.ncku.edu.tw/~smallko/ns2/confidence_interval.htm
http://hpds.ee.ncku.edu.tw/~smallko/ns2/confidence_interval.htm
2007/12/05
Present 的論文內容
明顯有類似 protocol 這類的 paper
不要選實驗、理論推導
看看有沒有類似第一步、第二步 ... 的結構
主要是要融會貫通講精髓
讓大家知道一個流程
如果是用數學 model 來推導
難懂又不好講
著重找到該文主要突破點, 並找出該突迫所以能達成的 smart ideas, key techniques。
結論:
1. What are the important considerations in the special topic of research (與以前從相關論文所得心得相互驗証, 校正, 並總結)?
2. What are the existing approaches for the special topic of research?
3. What are their relative merits (優點) and disadvantages?
4. If this paper has any relative merits, how are they achieved?
5. If the paper has any disadvantages, what are the causes for them?
6. How to avoid such shortages in your proposed approach?
7. If they are unavoidable, what are the reasons for?
不要選實驗、理論推導
看看有沒有類似第一步、第二步 ... 的結構
主要是要融會貫通講精髓
讓大家知道一個流程
如果是用數學 model 來推導
難懂又不好講
著重找到該文主要突破點, 並找出該突迫所以能達成的 smart ideas, key techniques。
結論:
1. What are the important considerations in the special topic of research (與以前從相關論文所得心得相互驗証, 校正, 並總結)?
2. What are the existing approaches for the special topic of research?
3. What are their relative merits (優點) and disadvantages?
4. If this paper has any relative merits, how are they achieved?
5. If the paper has any disadvantages, what are the causes for them?
6. How to avoid such shortages in your proposed approach?
7. If they are unavoidable, what are the reasons for?
2007/09/11
Using Sluice on Tmote Sky
Sluice: Secure Dissemination of Code Updates in Sensor Networks
Source code
Author's research website
0. Install Moteiv’s Tmote Tools from http://www.moteiv.com/
1. Extract file "sluice-tinyos.tgz" and move sub-directory "contrib" to "C:\cygwin\opt\tinyos-1.x\contrib"
2. Change file "/opt/tinyos-1.x/contrib/cmu/tools/java/jars/bcprov-jdk15-130.jar" to latest version if you need from here. (I use "bcprov-jdk16-137.jar" for this note.)
3. Set up environment variables as follows:
[code]export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
export TOSROOT="/opt/tinyos-1.x"
export TOSDIR="$TOSROOT/tos"
export MAKERULES="$TOSROOT/tools/make/Makerules"
export CLASSPATH="`$TOSROOT/tools/java/javapath`;C:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java;C:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java\\\\jars\\\\bcprov-jdk16-137.jar"
export SLUICE_PRIV_KEYFILE="c:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java\\\\eccPrivate.key"[/code]
4. Modify files "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/DelugePageTransferC.nc" and "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/DelugePageTransferM.nc" about token "SharedMsgBufTX" and "SharedMsgBufRX" by refer to files " /opt/moteiv/tos/lib/Deluge/DelugePageTransferC.nc" and "/opt/moteiv/tos/lib/Deluge/DelugePageTransferM.nc"
5. Modify files "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/VerifierM.nc" as follows:
6. Change to directory "/opt/tinyos-1.x/contrib/cmu/apps/Sluice" and make as follows:
[code]make tmote install[/code]
7. Change to directory "/opt/tinyos-1.x/contrib/cmu/tools/java/net/tinyos/sluice" and "/opt/tinyos-1.x/contrib/cmu/tools/java/net/tinyos/tools" and complie all java files
8. Set up environment variables of "MOTECOM" for the Tmote Sky. for example:
[code]export MOTECOM=serial@COM6:tmote[/code]
9. Now, you can run "java net.tinyos.tools.Sluice" for testing.
Note: the source seems only implement function "inject".
for a example:
10. Change to directory "/opt/moteiv/apps/Count/CountLed" and Modify
file "/opt/moteiv/apps/Count/CountLed/Makefile" as follows:
11. And then make as follows:
[code]make tmote[/code]
12. Change to directory "/opt/moteiv/apps/Count/CountLeds/build/tmote" and "inject to image 1" as follows:
[code]java net.tinyos.tools.Sluice -i -in=1 -ti=tos_image.xml[/code]
Source code
Author's research website
0. Install Moteiv’s Tmote Tools from http://www.moteiv.com/
1. Extract file "sluice-tinyos.tgz" and move sub-directory "contrib" to "C:\cygwin\opt\tinyos-1.x\contrib"
2. Change file "/opt/tinyos-1.x/contrib/cmu/tools/java/jars/bcprov-jdk15-130.jar" to latest version if you need from here. (I use "bcprov-jdk16-137.jar" for this note.)
3. Set up environment variables as follows:
[code]export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
export TOSROOT="/opt/tinyos-1.x"
export TOSDIR="$TOSROOT/tos"
export MAKERULES="$TOSROOT/tools/make/Makerules"
export CLASSPATH="`$TOSROOT/tools/java/javapath`;C:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java;C:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java\\\\jars\\\\bcprov-jdk16-137.jar"
export SLUICE_PRIV_KEYFILE="c:\\\\cygwin\\\\opt\\\\tinyos-1.x\\\\contrib\\\\cmu\\\\tools\\\\java\\\\eccPrivate.key"[/code]
4. Modify files "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/DelugePageTransferC.nc" and "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/DelugePageTransferM.nc" about token "SharedMsgBufTX" and "SharedMsgBufRX" by refer to files " /opt/moteiv/tos/lib/Deluge/DelugePageTransferC.nc" and "/opt/moteiv/tos/lib/Deluge/DelugePageTransferM.nc"
5. Modify files "/opt/tinyos-1.x/contrib/cmu/tos/lib/Sluice/VerifierM.nc" as follows:
...
command uint8_t Verifier.verify(uint8_t *msg_ptr, uint16_t msg_len, NN_DIGIT *r_ptr, NN_DIGIT *s_ptr) {
...
if (post VerifyTask()) {
-#if 1
+#if PLATFORM_PC
dbg(DBG_USR2, "[Verifier.verify] info: posted VerifyTask\n");
dbg_clear(DBG_USR2, "\tr: 0x");
print_nn(r, DBG_USR2);
dbg_clear(DBG_USR2, "\n\ts: 0x");
print_nn(s, DBG_USR2);
dbg_clear(DBG_USR2, "\n");
#endif
return SUCCESS;
} else {
...
}
}
...
6. Change to directory "/opt/tinyos-1.x/contrib/cmu/apps/Sluice" and make as follows:
[code]make tmote install[/code]
7. Change to directory "/opt/tinyos-1.x/contrib/cmu/tools/java/net/tinyos/sluice" and "/opt/tinyos-1.x/contrib/cmu/tools/java/net/tinyos/tools" and complie all java files
8. Set up environment variables of "MOTECOM" for the Tmote Sky. for example:
[code]export MOTECOM=serial@COM6:tmote[/code]
9. Now, you can run "java net.tinyos.tools.Sluice" for testing.
Note: the source seems only implement function "inject".
for a example:
10. Change to directory "/opt/moteiv/apps/Count/CountLed" and Modify
file "/opt/moteiv/apps/Count/CountLed/Makefile" as follows:
COMPONENT ?= CountLedsC
CFLAGS += -I..
+PFLAGS += -DVERIFY_TIME=25 -I$(TOSROOT)/contrib/cmu/tos/lib/Sluice -I$(TOSROOT)/contrib/cmu/tos/lib/SHA1 -I$(TOSROOT)/contrib/ncsu/tos/lib/TinyECC
+TINYOS_NP ?= BNP
include $(MAKERULES)
11. And then make as follows:
[code]make tmote[/code]
12. Change to directory "/opt/moteiv/apps/Count/CountLeds/build/tmote" and "inject to image 1" as follows:
[code]java net.tinyos.tools.Sluice -i -in=1 -ti=tos_image.xml[/code]
2007/09/09
Paper Search
Reference: http://netlab.cse.yzu.edu.tw/
---
# NEC ResearchIndex
# IBM Technical Journals
# Network Bibliography
# The Collection of Computer Science Bibliographies
# IEICE Tran on (可線上申請帳號)
# JIT
# ACM digital library
# IEEE Xplore
# Elsevier SDOS 電子期刊全文資料庫
# 全國博碩士論文資訊網
# Springer - high-quality STM(scientific, technical, and medical) journals, book series, books, reference works and the Online Archives Collection
# Wiley InterScience
# PQDD Thesis in U.S.A (美國碩博論文資料庫)
# JCR資料庫 (SCI, SSCI)
# Google Scholar
# Scirus - for scientific information
---
# NEC ResearchIndex
# IBM Technical Journals
# Network Bibliography
# The Collection of Computer Science Bibliographies
# IEICE Tran on (可線上申請帳號)
# JIT
# ACM digital library
# IEEE Xplore
# Elsevier SDOS 電子期刊全文資料庫
# 全國博碩士論文資訊網
# Springer - high-quality STM(scientific, technical, and medical) journals, book series, books, reference works and the Online Archives Collection
# Wiley InterScience
# PQDD Thesis in U.S.A (美國碩博論文資料庫)
# JCR資料庫 (SCI, SSCI)
# Google Scholar
# Scirus - for scientific information
2007/09/01
研究觀念
在實驗室最重要的事情是你自己要分配自己的時間,什麼時候念
paper什麼時候寫程式時麼時候打球運動,每天早上起床其實早點起來可以做很多事情
早上就可以先想一下今天要做哪些事情,做完了就可以去爽了
沒事多待在實驗室大家的感情其實也會比較好,不然就是多多聚餐
重點就是paper一開始一定要看的多,或是直接看老板上課有一本wireless sensor的書,
他有很多層的介紹與paper的整理,你看看你對哪的方面有興趣的就可以翻後面的目錄自己
去看看,然後有興趣了以後大概就專心的抓差不多20篇左右的paper但是這中間大概會有
垃圾或是奇怪的paper重點就是你看完了以後想一個方法很爛沒有關係但是你要讓老闆知
道你有看了很多這類的paper,可能一開使老闆會一直打你槍,但是一定要堅持到最後如
果那個是你的興趣的話,老闆就會妥協了
每次跟老闆的 meeting很重要,千萬不要有那種得過且過的想法
因為老闆已經去清大了,所以以後你們能跟他meeting的時間要是錯過了可能就要自己去
清大找老師,因為每次的討論時間就是一個對你的方法再更近一步的探討
寫模擬的大概要再12月以前搞懂NS2再衝三小,然後自己可以先針對自己的想法先偷寫,然
後多看google,而且你們除了要寫自己的方法,也要
寫人家的方法要跟人家比較,所以NS2工具的使用特別的重要,另外如果你到超熟的話可以
去PTT去接寫NS2模擬的case很賺,另外NS2可以問問看張育嘉學長,不知是誰嗎? 就是天
天在後面張嘴打電動的那個,他NS2 星海 還有魔獸都蠻厲害的
如果你是實作的請多多加強自己的心臟能力還有程式解bug的能力,我是實作
的常常實驗的結果會不是你想像的,因為變數太多了,所以有的時候方法想完實做了還要常
常修正你的方法,記得要多多跟同學討論,才會有多一些想法,常常我有很多不是我預期
的實驗錯誤或是不明的原因我都會找伯權或是rocky討論,這個很重要它可以幫助你有更
多的想法,在這個過程中你也會發現很多問題以及對應的解決方法,這次的口試教授問的
問題其實再我平常實作的時候就有發生過,還回答的蠻順利的,所以記得在口試前要對自
己的論文極度清楚,還有衍生的問題這些都是可以先在跟老師 meeting 與 實作中發現,如果
到了口試的時候才被委員問出來,那個場面會很難看而且老闆能幫你檔一時,沒有辦法檔全
部,當然如果你們還有其他作研究的問題可以多問問看博班或是我們學長,我們會很樂意
跟你們說的
另外老師的話不用聽的太認真,有的時候它只是講爽的而已,只要對得起
自己問心無愧就可以了
paper什麼時候寫程式時麼時候打球運動,每天早上起床其實早點起來可以做很多事情
早上就可以先想一下今天要做哪些事情,做完了就可以去爽了
沒事多待在實驗室大家的感情其實也會比較好,不然就是多多聚餐
重點就是paper一開始一定要看的多,或是直接看老板上課有一本wireless sensor的書,
他有很多層的介紹與paper的整理,你看看你對哪的方面有興趣的就可以翻後面的目錄自己
去看看,然後有興趣了以後大概就專心的抓差不多20篇左右的paper但是這中間大概會有
垃圾或是奇怪的paper重點就是你看完了以後想一個方法很爛沒有關係但是你要讓老闆知
道你有看了很多這類的paper,可能一開使老闆會一直打你槍,但是一定要堅持到最後如
果那個是你的興趣的話,老闆就會妥協了
每次跟老闆的 meeting很重要,千萬不要有那種得過且過的想法
因為老闆已經去清大了,所以以後你們能跟他meeting的時間要是錯過了可能就要自己去
清大找老師,因為每次的討論時間就是一個對你的方法再更近一步的探討
寫模擬的大概要再12月以前搞懂NS2再衝三小,然後自己可以先針對自己的想法先偷寫,然
後多看google,而且你們除了要寫自己的方法,也要
寫人家的方法要跟人家比較,所以NS2工具的使用特別的重要,另外如果你到超熟的話可以
去PTT去接寫NS2模擬的case很賺,另外NS2可以問問看張育嘉學長,不知是誰嗎? 就是天
天在後面張嘴打電動的那個,他NS2 星海 還有魔獸都蠻厲害的
如果你是實作的請多多加強自己的心臟能力還有程式解bug的能力,我是實作
的常常實驗的結果會不是你想像的,因為變數太多了,所以有的時候方法想完實做了還要常
常修正你的方法,記得要多多跟同學討論,才會有多一些想法,常常我有很多不是我預期
的實驗錯誤或是不明的原因我都會找伯權或是rocky討論,這個很重要它可以幫助你有更
多的想法,在這個過程中你也會發現很多問題以及對應的解決方法,這次的口試教授問的
問題其實再我平常實作的時候就有發生過,還回答的蠻順利的,所以記得在口試前要對自
己的論文極度清楚,還有衍生的問題這些都是可以先在跟老師 meeting 與 實作中發現,如果
到了口試的時候才被委員問出來,那個場面會很難看而且老闆能幫你檔一時,沒有辦法檔全
部,當然如果你們還有其他作研究的問題可以多問問看博班或是我們學長,我們會很樂意
跟你們說的
另外老師的話不用聽的太認真,有的時候它只是講爽的而已,只要對得起
自己問心無愧就可以了
2007/08/29
Change radio transmit power and frequency on Tmote
---Backup the article
Change frequency at compile time
One way to set the CC2420 radio channel is to do it at compile time by assigning the environment variable CC2420_CHANNEL perhaps like this
export CC2420_CHANNEL=12
The valid channels for the CC2420 are 11 to 26, and the default is channel 11. You can put that export command in your login script such as ~/.bashrc to make it persistent across login sessions. If you want a radio channel specific to an application, you can put a similar command in that application's Makefile, like this
CC2420_CHANNEL=12
The next time you build your application, the changes will take effect. Do not forget to also recompile and reinstall TOSBase with the new channel, as well, if applicable.
Change transmit power at compile time
To change the transmit power at compile time, you will need to predefine a preprocessor directive called CC2420_DEF_RFPOWER. To do this, define your compile flags "CFLAGS" before compiling your application. You must specify a power index from 1 to 31. The valid values are 1 through 31 with power of 1 equal to -25dBm and 31 equal to max power (0dBm)
CFLAGS=-DCC2420_DEF_RFPOWER=x make tmote
Change transmit power or frequency at run time
Another way to set the CC2420 radio channel or transmit power is to use the CC2420Control interface provided by the CC2420RadioC component. The two applicable commands are
command result_t TunePreset( uint8_t rh, uint8_t channel );
command result_t SetRFPower( uint8_t rh, uint8_t power );
rh
Either RESOURCE_NONE for automatic resource scheduling or a resource handle acquired by the CC2420ResourceC component. Note, this parameter is not present in any of the commands in the TinyOS 1.x CC2420Control interface
channel
One of the valid 802.15.4 present channels. Valid channel values are 11 through 26. The channel frequencies are calculated by
Freq = 2405 + 5(k-11) MHz for k = 11,12,...,26
power
A power index from 1 to 31. The input value is simply an arbitrary index that is programmed into the CC2420 registers. The output power is set by programming the power amplifier. The valid values are 1 through 31 with power of 1 equal to -25dBm and 31 equal to max power (0dBm)
2007/08/18
Build Octopus develop environment
What is Octopus?
1. Install Moteiv's Tmote Tools from http://www.moteiv.com/
If already installed Cygwin, I recommend uninstall Cygwin firstly. Secondly,
to run setup.msi from tmote-tools-2_0_5.zip. Finally, to upgrade or install
other Cygwin packages.
2. Copy and Modify target file
octopus.target
3. Create octopus directory
4. Modify hardware.h file
/opt/moteiv/tos/platform/octopus/hardware.h
5. Copy and Modify HPLUSART1M.nc file
/opt/moteiv/tos/platform/octopus/HPLUSART1M.nc
6. Copy and Modify Leds.nc file
/opt/moteiv/tos/platform/octopus/Leds.nc
7. Copy and Modify LedsC.nc file
/opt/moteiv/tos/platform/octopus/LedsC.nc
8. Copy MSP430ClockM.nc file
9. Copy and Modify MSP430GeneralIOM.nc file
/opt/moteiv/tos/platform/octopus/MSP430GeneralIOM.nc
10. Copy and Modify NoLeds.nc file
/opt/moteiv/tos/platform/octopus/NoLeds.nc
11. Modify and Compile SerialByteSource.java file
/opt/tinyos-1.x/tools/java/net/tinyos/packet/SerialByteSource.java
Complie SerialByteSource.java file
appendix 1. Make an example application
appendix 2. Run an example application
appendix 3. Set Node ID: 5
1. Install Moteiv's Tmote Tools from http://www.moteiv.com/
If already installed Cygwin, I recommend uninstall Cygwin firstly. Secondly,
to run setup.msi from tmote-tools-2_0_5.zip. Finally, to upgrade or install
other Cygwin packages.
2. Copy and Modify target file
shell> cd /opt/moteiv/tools/make/
shell:/opt/moteiv/tools/make/> cp tmote.target octopus.target
octopus.target
...
-PLATFORM ?= tmote
+PLATFORM ?= octopus
...
-CFLAGS += \
--I$(MOTEIV_DIR)/tos/platform/tmote \
--I$(MOTEIV_DIR)/tos/platform/tmote/util/uartdetect \
+CFLAGS += \
+-I$(MOTEIV_DIR)/tos/platform/octopus \
+-I$(MOTEIV_DIR)/tos/platform/octopus/util/uartdetect \
...
- BOOTLOADER ?= $(MOTEIV_DIR)/tos/lib/Deluge/TOSBoot/build/tmote/main.ihex
+ BOOTLOADER ?= $(MOTEIV_DIR)/tos/lib/Deluge/TOSBoot/build/octopus/main.ihex
...
-tmote: $(BUILD_DEPS)
+octopus: $(BUILD_DEPS)
...
3. Create octopus directory
shell> cp -r /opt/moteiv/tos/platform/tmote /opt/moteiv/tos/platform/octopus
4. Modify hardware.h file
/opt/moteiv/tos/platform/octopus/hardware.h
...
// LEDs
TOSH_ASSIGN_PIN(RED_LED, 5, 4);
TOSH_ASSIGN_PIN(GREEN_LED, 5, 5);
-TOSH_ASSIGN_PIN(YELLOW_LED, 5, 6);
+TOSH_ASSIGN_PIN(YELLOW_LED, 5, 3);
+TOSH_ASSIGN_PIN(BLUE_LED, 5, 6);
...
TOSH_ASSIGN_PIN(STE1, 5, 0);
+TOSH_ASSIGN_PIN(BUFFER_CS, 4, 3);
// ADC
TOSH_ASSIGN_PIN(ADC0, 6, 0);
...
// FLASH
-TOSH_ASSIGN_PIN(FLASH_PWR, 4, 3);
+TOSH_ASSIGN_PIN(FLASH_W, 4, 0);
TOSH_ASSIGN_PIN(FLASH_CS, 4, 4);
...
5. Copy and Modify HPLUSART1M.nc file
shell> cp /opt/moteiv/tos/platform/msp430/HPLUSART1M.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/HPLUSART1M.nc
...
async command result_t USARTControl.tx(uint8_t data){
atomic {
+ TOSH_CLR_BUFFER_CS_PIN();
U1TXBUF = data;
}
return SUCCESS;
}
...
6. Copy and Modify Leds.nc file
shell> cp /opt/tinyos-1.x/tos/interfaces/Leds.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/Leds.nc
interface Leds {
...
/**
* Toggle the yellow LED. If it was on, turn it off. If it was off,
* turn it on.
*
* @return SUCCESS always.
*
*/
async command result_t yellowToggle();
+ async command result_t blueOn();
+ async command result_t blueOff();
+ async command result_t blueToggle();
/**
* Get current Leds information
*
* @return A uint8_t typed value representing Leds status
*
*/
async command uint8_t get();
...
}
7. Copy and Modify LedsC.nc file
shell> cp /opt/tinyos-1.x/tos/system/LedsC.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/LedsC.nc
...
enum {
- RED_BIT = 1,
- GREEN_BIT = 2,
- YELLOW_BIT = 4
+ BLUE_BIT = 1,
+ GREEN_BIT = 2,
+ RED_BIT = 4,
+ YELLOW_BIT = 8
};
async command result_t Leds.init() {
atomic {
ledsOn = 0;
dbg(DBG_BOOT, "LEDS: initialized.\n");
TOSH_MAKE_RED_LED_OUTPUT();
TOSH_MAKE_YELLOW_LED_OUTPUT();
TOSH_MAKE_GREEN_LED_OUTPUT();
+ TOSH_MAKE_BLUE_LED_OUTPUT();
TOSH_SET_RED_LED_PIN();
TOSH_SET_YELLOW_LED_PIN();
TOSH_SET_GREEN_LED_PIN();
+ TOSH_SET_BLUE_LED_PIN();
}
return SUCCESS;
}
...
async command result_t Leds.yellowToggle() {
result_t rval;
atomic {
if (ledsOn & YELLOW_BIT)
rval = call Leds.yellowOff();
else
rval = call Leds.yellowOn();
}
return rval;
}
+ async command result_t Leds.blueOn() {
+ dbg(DBG_LED, "LEDS: Blue on.\n");
+ atomic {
+ TOSH_CLR_BLUE_LED_PIN();
+ ledsOn |= BLUE_BIT;
+ }
+ return SUCCESS;
+ }
+ async command result_t Leds.blueOff() {
+ dbg(DBG_LED, "LEDS: Blue off.\n");
+ atomic {
+ TOSH_SET_BLUE_LED_PIN();
+ ledsOn &= ~BLUE_BIT;
+ }
+ return SUCCESS;
+ }
+ async command result_t Leds.blueToggle() {
+ result_t rval;
+ atomic {
+ if (ledsOn & BLUE_BIT)
+ rval = call Leds.blueOff();
+ else
+ rval = call Leds.blueOn();
+ }
+ return rval;
+ }
async command uint8_t Leds.get() {
uint8_t rval;
atomic {
rval = ledsOn;
}
return rval;
}
async command result_t Leds.set(uint8_t ledsNum) {
atomic {
- ledsOn = (ledsNum & 0x7);
+ ledsOn = (ledsNum & 0xF);
if (ledsOn & GREEN_BIT)
TOSH_CLR_GREEN_LED_PIN();
else
TOSH_SET_GREEN_LED_PIN();
if (ledsOn & YELLOW_BIT )
TOSH_CLR_YELLOW_LED_PIN();
else
TOSH_SET_YELLOW_LED_PIN();
if (ledsOn & RED_BIT)
TOSH_CLR_RED_LED_PIN();
else
TOSH_SET_RED_LED_PIN();
+ if (ledsOn & BLUE_BIT)
+ TOSH_CLR_BLUE_LED_PIN();
+ else
+ TOSH_SET_BLUE_LED_PIN();
}
return SUCCESS;
}
...
8. Copy MSP430ClockM.nc file
shell> cp /opt/moteiv/tos/platform/msp430/timer/MSP430ClockM.nc /opt/moteiv/tos/platform/octopus/
9. Copy and Modify MSP430GeneralIOM.nc file
shell> cp /opt/tinyos-1.x/tos/platform/msp430/MSP430GeneralIOM.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/MSP430GeneralIOM.nc
...
- async command uint8_t Port12.getRaw() { return TOSH_READ_PORT12_PIN(); }
- async command bool Port12.get() { return TOSH_READ_PORT12_PIN() != 0; }
+ async command uint8_t Port12.getRaw() { TOSH_READ_PORT12_PIN(); return 1;}
+ async command bool Port12.get() { TOSH_READ_PORT12_PIN(); return 1;}
...
10. Copy and Modify NoLeds.nc file
shell> cp /opt/moteiv/tinyos-1.x/tos/system/NoLeds.nc /opt/moteiv/tos/platform/octopus/
/opt/moteiv/tos/platform/octopus/NoLeds.nc
...
async command result_t Leds.yellowToggle() {
return SUCCESS;
}
+ async command result_t Leds.blueOn() {
+ return SUCCESS;
+ }
+ async command result_t Leds.blueOff() {
+ return SUCCESS;
+ }
+ async command result_t Leds.blueToggle() {
+ return SUCCESS;
+ }
async command uint8_t Leds.get() {
return 0;
}
...
11. Modify and Compile SerialByteSource.java file
/opt/tinyos-1.x/tools/java/net/tinyos/packet/SerialByteSource.java
...
public void openStreams() throws IOException {
...
try {
serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
serialPort.setSerialPortParams(baudRate,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
+ // elva set COM port pin(DTR) to LOW
+ serialPort.setDTR(false);
+ // elva end of modify
serialPort.addEventListener(this);
serialPort.notifyOnDataAvailable(true);
}
...
is = serialPort.getInputStream();
os = serialPort.getOutputStream();
+ // elva delay for mote reboot
+ try {
+ Thread.sleep(1300);
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ // elva end of modify
}
...
Complie SerialByteSource.java file
shell> cd /opt/tinyos-1.x/tools/java/net/tinyos/packet
shell:/opt/tinyos-1.x/tools/java/net/tinyos/packet> javac SerialByteSource.java
appendix 1. Make an example application
shell> cd /opt/moteiv/apps/Count/CountLeds
shell:/opt/moteiv/apps/Count/CountLeds> make octopus
appendix 2. Run an example application
shell> export MOTECOM=serial@COM6:tmote
shell> cd /opt/tinyos-1.x/tools/java/net/tinyos/tools
shell:/opt/tinyos-1.x/tools/java/net/tinyos/tools> java net.tinyos.tools.Listen
appendix 3. Set Node ID: 5
shell:/opt/moteiv/apps/Count/CountLeds> /opt/tinyos-1.x/tools/make/msp/set-mote-id --objcopy msp430-objcopy --objdump msp430-objdump --target ihex build/octopus/main.ihex build/octopus/main.ihex.out-5 5
Subscribe to:
Posts (Atom)