回路図(前回と同じ)
--以下、ソースコード--
#include <p16f1827.inc>
cblock 0x70
tbl
tbh
endc
org 00h
bra init
org 04h
bcf INTCON,TMR0IF
movfw tbl
movwf FSR0L
movfw tbh
movwf FSR0H
movfw INDF0
movwf PORTB
movlw 1
addwf tbl
movlw 0
addwfc tbh
movlw LOW tb_end
subwf tbl,w
btfss STATUS,Z
retfie
movlw HIGH tb_end
subwf tbh,w
btfsc STATUS,Z
bra init_r
retfie
init_r
movlw LOW table
movwf tbl
movlw HIGH table
movwf tbh
retfie
init
banksel ANSELB
clrf ANSELB
banksel TRISB
clrf TRISB
movlw B'00110011'
movwf OSCCON
movlw B'10100000'
movwf INTCON
movlw B'11010111'
movwf OPTION_REG
movlw LOW table
movwf tbl
movlw HIGH table
movwf tbh
banksel PORTB
main
bra main
table
dt B'00000011'
dt B'00000110'
dt B'00001100'
dt B'00011000'
dt B'00110000'
dt B'01100000'
dt B'11000000'
dt B'10000001'
tb_end
end
--以上、ソースコード--
OS:windows, Software:MPLAB IDE v8.76,
Writer:PICkit3