1 / 19

Ubiquitous Sensor Networks NesC

Ubiquitous Sensor Networks NesC. 웹서버실습 (2) 컴퓨터정보과 수원과학대학. NesC. TinyOS Language. C Make efficiency code for microcontroller Provide base characteristic for hardware access Familiar with programmer Difficult to make component based applications nesC(network embedded system C)

raisie
Download Presentation

Ubiquitous Sensor Networks NesC

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ubiquitous Sensor Networks NesC 웹서버실습(2) 컴퓨터정보과 수원과학대학

  2. NesC

  3. TinyOS Language • C • Make efficiency code for microcontroller • Provide base characteristic for hardware access • Familiar with programmer • Difficult to make component based applications • nesC(network embedded system C) • Extended C • No support dynamic memory allocation • Concurrency access to shared data • More flexible • Component Based • Configuration file : wiring components each other • Module file : Actual implementing Component

  4. NesC Programming Language • Component • NesC를 구성하는 기본 블록, 컴포넌트를 정의하는 configuration과 module 부분으로 구분 • Component의 종류: • configuration: 컴포넌트의 연결을 나타냄 • module: 인터페이스의 동작을 기술, 이벤트 핸들러 작성

  5. comp3 comp1: module comp4 comp2: configuration application: configuration NesC Programming Language • Components: • 구성 • module: C구현 부분 • configuration:component select and wire 부분 • Interfaces • provides interface • uses interface

  6. Interface I • Interface • 컴포넌트를 연결하는 포트의 역할을 수행 • 제공자(provider)와 사용자(user) 형태로 컴포넌트에서 선언 • Command와 Event 타입의 함수로 정의 • Command:상위 컴포넌트에서 하위 컴포넌트에게 call 명령을 통해 호출하는 함수 (실제 함수 내용은 하위 컴포넌트에 구현). • Event:하위 컴포넌트에서 상위 컴포넌트로 signal 명령을 통해 호출하는 함수 (실제 함수 내용은 상위 컴포넌트에 구현). interface Timer {    command result_t start (char type, uint32_t interval);    command result_t stop ();    event result_t fired (); }

  7. Interface II • Interfaces used in Blink app. • Red: use interface • Blue: provide interface

  8. 컴포넌트간 연결 • 컴포넌트들 사이의 연결 (wiring) • Interface 1 = interface 2 • 두 개의 interface가 완전히 같음을 의미한다. • Interface1 ‐> interface2 • Interface의 구성 함수가 링크되어 있음을 의미한다. 즉 interface1에서 사용한 함수가 interface2에 구현되어 있음을 나타낸다. • Interface1 <‐ interface2 • Interface2 ‐> interface1과 동일한 표기방법이다.

  9. C1 C2 C3 NesC Programming Language • Configurations의 연결: configuration apps { } implementation { components c1, c2, c3; c1. triangle1 -> c2. triangle1 ; c2. triangle2 -> c3 ; // c3의triangle2 생략 c3. rectangle1 <- c2. rectangle1; } apps component

  10. C1 C2 C3 NesC Programming Language • modules: module C1 { uses interface triangle1; } implementation { ... } module C2 { provides interface triangle1; uses { interface triangle2; interface rectangle1; } } implementation { ... } module C3 { provides interface triangle2; provides interface rectangle1; } implementation { ... }

  11. NesC Variable Type typedef signed char int8_t;typedef unsigned char   uint8_t;typedef short  int16_t;typedef unsigned short  uint16_t;typedef int  int32_t;typedef unsigned   uint32_t;typedef long long  int64_t;typedef unsigned long long   uint64_t; typedef uint8_t result_t; enum { /* standard codes for result_t */  FAIL = 0,  SUCCESS = 1}  typedef unsigned char bool; enum {  FALSE = 0,  TRUE = 1}; Type 선언부 /opt/tinyos-1.x/tos/system/tos.h /usr/local/avr/include/inttypes.h

  12. Naming Conventions

  13. Naming Conventions

  14. NesC Keyword

  15. 실습때 주로 사용하는 컴포넌트

  16. NesC 함수 표현 방법 • return_type function(argument); • void calc_SHT11(uint16_t p_humidity, uint16_t p_temperature) • command return_type function(argument); • command result_t StdControl.init() • event return_type function(argument); • event result_t DataMsg.sendDone(TOS_MsgPtr sent, result_t success) • task return_type function(No argument); • task void dataTask()

  17. 컴포넌트에서 제공하는 함수들의 예

  18. 컴포넌트에서 제공하는 함수들의 예

  19. The End!!

More Related