ATtiny10でLEDチカチカ

引越し先はlivedoor Blog https://seisaku-memocyou.blog.jp/になります。
よろしくお願い致します。
鉄道模型 常点灯用の逆起電力対応基板の試作中その1でPIC10LF322を使用してたが、ATtiny10に置き換える為のテストとしてLEDチカチカ
回路図 (ピンはpickit2並び)
ATtyny10_led.png
ATtyny10_led-1.JPG
ATtyny10_led-2.JPG
ATtyny10_led-3.JPG
書き込みソフトはavrdudeを、ハードはusbaspを使用
開発環境MPLAB X IDE v6 XC8 v2.20
#include <avr/io.h>
#include <xc.h>
#include <stdio.h>
#include <avr/interrupt.h>

#define LED PB2
#define TIME 500

volatile unsigned int count = 0;
static void attiny10_init(void);

ISR(TIM0_COMPA_vect){
count++;
if(count >= TIME){
count = 0;
PORTB ^= _BV(LED);
}
}
int main(){
cli();
attiny10_init();
sei();
while(1){
}
}
static void attiny10_init(){
DDRB = 0b00000100;
PORTB = 0x00;
CLKMSR = 0;
CLKPSR = 3;
//timer0 制御レジスタ
TCCR0A = 0b00000000;
TCCR0B = 0b00001010;
OCR0A = 124;
TIMSK0 = 0b00000010;
}

書き込みコマンド
avrdude -c usbasp -P usb -p t10 -U flash:w:N-TRAIN_ATtiny10_LED_V4.X.production.hex:i
N-TRAIN_ATtiny10_LED_V4.X.production.hex
鉄道模型 常点灯用の逆起電力対応発注基板
ATtyny10_led-4.JPG
テスト中です、電源(1.9V)確保出来れば
posted by うめぼし at 13:57Comment(0)

ブログ気持玉

クリックして気持ちを伝えよう!

ログインしてクリックすれば、自分のブログへのリンクが付きます。

→ログインへ

なるほど(納得、参考になった、ヘー)
驚いた
面白い
ナイス
ガッツ(がんばれ!)
かわいい

気持玉数 : 0

この記事へのコメント