;======================================================
; MIRS_ARM_UNITの制御プログラム
; 2008 1/21
; Programed by Takashi Amoh
;======================================================
LIST P=PIC16F84A
INCLUDE "P16F84A.INC"
;------------------------------------------------------
; カウンタ定義
;------------------------------------------------------
COUNT1 EQU 0DH
COUNT2 EQU 0EH
COUNT3 EQU 0FH
COUNT4 EQU 010H
;------------------------------------------------------
; 初期化 routine
;------------------------------------------------------
INIT
BSF STATUS,RP0
MOVLW 0FH
MOVWF TRISA
CLRF TRISB
BCF STATUS,RP0
MOVLW 0FFH
MOVWF PORTB
;------------------------------------------------------
; MAIN routine (モータ動作)
;------------------------------------------------------
MAIN
BTFSS PORTA,2
GOTO MAIN
START
MOVLW 010H
MOVWF PORTB
CALL DUTY1M
CALL DUTY1M
REVERSE
MOVLW 0FFH
MOVWF PORTB
CALL DUTY1U
MOVLW 020H
MOVWF PORTB
CALL DUTY1M
CALL DUTY1M
STOP
MOVLW 0FFH
MOVWF PORTB
CALL DUTY1U
FINISH
GOTO MAIN
;------------------------------------------------------
; 時間稼ぎ routine (1m秒、1μ秒)
;------------------------------------------------------
DUTY1M
MOVLW 15H
MOVWF COUNT1
SUBDUTYM1
MOVLW 0FFH
MOVWF COUNT2
SUBDUTYM2
MOVLW 0FFH
MOVWF COUNT3
HUBM
DECFSZ COUNT3,F
GOTO HUBM
DECFSZ COUNT2,F
GOTO SUBDUTYM2
DECFSZ COUNT1,F
GOTO SUBDUTYM1
RETURN
DUTY1U
MOVLW 041H
MOVWF COUNT1
SUBDUTYU
DECFSZ COUNT1,F
GOTO SUBDUTYU
RETURN
END
arm_unit(2_4).ASM.txt
使用する際は、ファイル名をarm_unit(2_4).ASMへ変更する必要がある。