• 検索結果がありません。

ir com hotaru 最近の更新履歴 kaimunantai ir com hotaru

N/A
N/A
Protected

Academic year: 2018

シェア "ir com hotaru 最近の更新履歴 kaimunantai ir com hotaru"

Copied!
4
0
0

読み込み中.... (全文を見る)

全文

(1)

Bread board Challenge 2012

[BC12-03] IR Com Hotaru

#1 BASE-Module

(1) Parts

(2) Layout

(3) Schematic

1

E

A

ATTINY2313V

A

ATTINY2313V

IR-LED

LED3

LED1

(2)

(4) Firmware Source Code

// Infrared Communication Hotaru

// INT1 : Falling Edge Int. by Aux Input (Infrared Opt-Transistor) // PD0 : Buzzer

// PD1 : Aux.Signal Output ( InfraRed-LED) // PB0, PB1, PB2 : LED1,2,3 1:OFF 0:ON

#include <avr/io.h>

#include <avr/interrupt.h>

// Light Pattern ID #define P_STANDBY 0x00

#define P_SHIFT 0x01 #define P_BLINK 0x02

// Buzzer Control ID #define ON 0x01 #define OFF 0x00

// Initial Light Pattern

volatile int PATTERN = P_STANDBY;

void wait(volatile long i) {

while (i-- > 0); }

void buz(char c) // buzzer control {

switch (c) { case ON:

PORTD |= (1<<PD0); break;

case OFF:

PORTD &= ~(1<<PD0); break;

} }

void beep(int length, int height) // beep !

{

volatile long i, j;

for ( i = 0; i <length; i++) {

(3)

buz(ON);

for ( j = 0; j < height; j++); buz(OFF);

for ( j = 0; j < height; j++); }

}

void led(int led1, int led2, int led3) // led light on / off

// led1,2,3 : 0...OFF, 1...ON {

PORTB |= (1<<PB0) | (1<<PB1) | (1<<PB2) ;

PORTB &= ~( (led1<<PB0) | (led2<<PB1) | (led3<<PB2) ); }

void auxout(void)

// Output Auxiliary Signal {

PORTD |= (1<<PD1); wait(100); PORTD &= ~(1<<PD1); wait(10000); }

void pattern(int no) // Light Pattern Control {

int i;

switch (no) {

case P_SHIFT:

led(1, 0, 0); wait(10000); led(1, 1, 0); wait(10000); led(1, 1, 1); wait(10000); led(1, 1, 0); wait(10000); led(1, 0, 0); wait(10000); led(0, 0, 0); wait(10000); break;

case P_BLINK:

for ( i = 0; i < 3; i++) { led(0, 0, 0); wait(20000); led(1, 1, 1); wait(20000); }

break; default:

led(0, 0, 0); wait(200000); }

}

(4)

ISR(INT1_vect)

// Interrupt 1 : Arrival Auxiliary Signal from Another Module {

beep(50, 5); switch (PATTERN) {

case P_STANDBY:

PATTERN = P_SHIFT; break;

case P_SHIFT:

PATTERN = P_BLINK; break;

case P_BLINK:

PATTERN = P_SHIFT; break;

}

pattern(PATTERN); auxout();

}

int main(void) {

// Initialize I/O Port PORTD = 0xff;

DDRD = (1<<PD0) | (1<<PD1);

DDRB = (1<<PB0) | (1<<PB1) | (1<<PB2);

// Intialize Interrupt MCUCR |= (1<<ISC11); MCUCR &= ~(1<<ISC10); GIMSK |= (1<<INT1);

// STANDBY

led(1, 1, 1); wait(10000);

// Interrupt Enable sei();

// Start Sequence beep(400, 2); auxout(); while (1); return 0; }

参照

関連したドキュメント

連携DB 営業店AP お客さま番号.

「Silicon Labs Dual CP210x USB to UART Bridge : Standard COM Port (COM**)」. ※(COM**) の部分の

The information herein is provided “as−is” and onsemi makes no warranty, representation or guarantee regarding the accuracy of the information, product features,

タッチON/OFF判定 CinX Data Registerの更新 Result Data 1/2 Registerの更新 Error Status Registerの更新 Error Status Channel 1/2 Registerの更新 (X=0,1,…,15).

新々・総特策定以降の東電の取組状況を振り返ると、2017 年度から 2020 年度ま での 4 年間において賠償・廃炉に年約 4,000 億円から

Fig.18  Pyrolyzate of Vulcanized Styrene・ Butadiene Rubber (random copolymer, styrene 25%, carbon black-filled) (top) Comparative a large quantity of substance. (bottom) A

エリアP 雑固体廃棄物 焼却設備 処理設備     瓦礫保管エリア     伐採木保管エリア

In this study, we analyzed synthetic cathinones using an infrared spectrometer (IR), gas chromatograph mass spectrometer (GC-MS), liquid chromatograph mass spectrometer coupled