よろしくお願い致します。
鉄道模型 常点灯用の逆起電力対応基板の試作中その1でPIC10LF322を使用してたが、ATtiny10に置き換える為のテストとしてLEDチカチカ
回路図 (ピンはpickit2並び)
書き込みソフトは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
鉄道模型 常点灯用の逆起電力対応発注基板
テスト中です、電源(1.9V)確保出来れば
この記事へのコメント