7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ステッピングモーターをDCモーターの様に扱うモジュール

Last updated at Posted at 2016-01-17

#概要
arduinoからステッピングモーターをDCモーターの様に扱うモジュールをattiny13aで作った。
アセンブラで書いた。
idle air control valve を動かした。
スタート・ストップ、正転・逆転で指示する。
#動画
https://www.youtube.com/watch?v=iw2Boqvj0Gg
#写真
MVC-010S.JPG
#回路図
iacv.JPG
#サンプルコード

.include "tn13def.inc"
.cseg
.org 	0
	rjmp	setup
	reti
	reti
	reti
	reti
	reti
	reti
	reti
	reti
	reti

delay_10ms:
	clr 	r1
	ldi 	r17, 20
delay_10ms_loop:
	dec 	r1
	brne	delay_10ms_loop
	dec 	r17
	brne	delay_10ms_loop
	ret

setup:
	cbi 	DDRB, PB0
	sbi 	DDRB, PB1
	sbi 	DDRB, PB2
	sbi 	DDRB, PB3
	sbi 	DDRB, PB4
	cbi 	DDRB, PB5
	sbi 	PORTB, PB0
	sbi 	PORTB, PB1
	sbi 	PORTB, PB2
	sbi 	PORTB, PB3
	sbi 	PORTB, PB4
	sbi 	PORTB, PB5
	ldi 	r16, low(RAMEND)
	out 	SPL, r16
	ldi 	r21, 1

loop:
	ldi 	r19, 0
	sbic	PINB, PB0
	ldi 	r19, 1
	ldi 	r20, 0
	sbic	PINB, PB5
	ldi 	r20, 1
	cpi		r19, 1
	brne	tugi7
	cpi		r20, 0
	brne	tugi0
	dec 	r21
	rjmp	tugi1
tugi0:
	inc 	r21
tugi1:
	cpi 	r21, 1
	brcc	tugi2
	ldi		r21, 4
tugi2:
	cpi 	r21, 5
	brcs	tugi3
	ldi		r21, 1
tugi3:
	cpi 	r21, 1
	brne	tugi4
	sbi 	PORTB, PB1
	cbi 	PORTB, PB2
	cbi 	PORTB, PB3
	cbi 	PORTB, PB4
tugi4:
	cpi 	r21, 2
	brne	tugi5
	cbi 	PORTB, PB1
	cbi 	PORTB, PB2
	sbi 	PORTB, PB3
	cbi 	PORTB, PB4
tugi5:
	cpi 	r21, 3
	brne	tugi6
	cbi 	PORTB, PB1
	sbi 	PORTB, PB2
	cbi 	PORTB, PB3
	cbi 	PORTB, PB4
tugi6:
	cpi 	r21, 4
	brne	tugi7
	cbi 	PORTB, PB1
	cbi 	PORTB, PB2
	cbi 	PORTB, PB3
	sbi 	PORTB, PB4
tugi7:
	rcall	delay_10ms
	rjmp	loop
7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?