PIC16F84電子遊戯(25)サブページ
最終更新日:2001年5月23日
マトリックス96(1ページ)へ (2ページ)へ

マトリックス96の全ソースリスト公開
;**********************************************************************
;    Filename:	    matrix5.asm                                       *
;    Date:          2001/5/18                                        *
;    File Version:                                                    *
;**********************************************************************

	list      p=16F84             ; list directive to define processor
	#include <p16F84.inc>         ; processor specific variable definitions

	__CONFIG   _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC

;***** VARIABLE DEFINITIONS
w_temp        EQU     0x0C        ; variable used for context saving 
status_temp   EQU     0x0D        ; variable used for context saving

wait_data		EQU	0x10		;wait data
retu_pointa	EQU	0x11		;retu pointa
count_sub2	EQU	0x12		;count sub2 data

taihi		EQU	0x13		;taihi data
moji_mode		EQU	0x14		;moji mode ram

count_data	EQU	0x15		;0.1sec keisoku count ram

moji1		EQU	0x18		;moji(1)
moji2		EQU	0x19		;moji(2)
moji3		EQU	0x1a		;moji(3)
taihi2		EQU	0x1b		;taihi data2

led_data0		EQU	0x20		;LED DATA(0)
led_data1		EQU	0x21		;LED DATA(1)
led_data2		EQU	0x22		;LED DATA(2)
led_data3		EQU	0x23		;LED DATA(3)
led_data4		EQU	0x24		;LED DATA(4)
led_data5		EQU	0x25		;LED DATA(5)
led_data6		EQU	0x26		;LED DATA(6)
led_data7		EQU	0x27		;LED DATA(7)
led_data8		EQU	0x28		;LED DATA(8)
led_data9		EQU	0x29		;LED DATA(9)
led_data10	EQU	0x2a		;LED DATA(10)
led_data11	EQU	0x2b		;LED DATA(11)

tm0_setdata	EQU	63h		;255-156=99=63H  156*128=19.968msec
cnt_setdata	EQU	05h		;19.968*5=99.84msec

moji_A		EQU	01h
moji_B		EQU	02h
moji_C		EQU	03h
moji_D		EQU	04h
moji_E		EQU	05h
moji_F		EQU	06h
moji_G		EQU	07h
moji_H		EQU	08h
moji_I		EQU	09h
moji_J		EQU	0ah
moji_K		EQU	0bh
moji_L		EQU	0ch
moji_M		EQU	0dh
moji_N		EQU	0eh
moji_O		EQU	0fh
moji_P		EQU	10h
moji_Q		EQU	11h
moji_R		EQU	12h
moji_S		EQU	13h
moji_T		EQU	14h
moji_U		EQU	15h
moji_V		EQU	16h
moji_W		EQU	17h
moji_X		EQU	18h
moji_Y		EQU	19h
moji_Z		EQU	1ah
moji_sp		EQU	1bh
moji_mk		EQU	1ch
moji_love		EQU	1dh
moji_1		EQU	1eh
moji_2		EQU	1fh
moji_3		EQU	20h
moji_4		EQU	21h
moji_5		EQU	22h
moji_6		EQU	23h
moji_7		EQU	24h
moji_8		EQU	25h
moji_9		EQU	26h
moji_0		EQU	27h
moji_co		EQU	28h
moji_kara		EQU	29h
moji_tasu		EQU	2ah
moji_hiku		EQU	2bh
moji_kake		EQU	2ch
moji_waru		EQU	2dh
moji_eq		EQU	2eh
moji_ten		EQU	2fh
moji_hate		EQU	30h
moji_dai		EQU	31h
moji_shou		EQU	32h
moji_up		EQU	33h
moji_right	EQU	34h
moji_down		EQU	35h
moji_left		EQU	36h
moji_daiya	EQU	37h
moji_sha		EQU	38h
moji_dot		EQU	39h
moji_par		EQU	3ah
moji_do		EQU	3bh
;**********************************************************************
		ORG     0x000             ; processor reset vector
  		goto    main              ; go to beginning of program

;----------------------------------------------------------------------------------
		ORG     0x004             ; interrupt vector location
		movwf   w_temp            ; save off current W register contents
		movf	STATUS,w          ; move status register into W register
		movwf	status_temp       ; save off contents of STATUS register

		;---------------------------------	
		bcf	INTCON,T0IF
		movlw	tm0_setdata
		movwf	TMR0

		decfsz	count_data,1
		goto	int_end
time_up		movlw	cnt_setdata		
		movwf	count_data
		;--------------------------------
		call	retu_shift
int_end
		;----------------------------------
		movf    status_temp,w     ; retrieve copy of STATUS register
		movwf	STATUS            ; restore pre-isr STATUS register contents
		swapf   w_temp,f
		swapf   w_temp,w          ; restore pre-isr W register contents
		retfie                    ; return from interrupt
;---------------------------------------------------------------------------------------
main
		call	port_set
		movlw	00h		;port initial set
		movwf	PORTA
		movlw	0ffh
		movwf	PORTB

		movlw	01h
		movwf	moji_mode

		call	count_init
		movf	count_sub2,0
		call	moji_set_sub2
		call	led_set_sub0

		call	timer0_set
		movlw	cnt_setdata
		movwf	count_data

main_loop
;-------------------------------------- key scan
sw1_key		btfsc	PORTA,4
		goto	next_key
		call	wait_1
		btfsc	PORTA,4
		goto	next_key
					;sw1 on
		call	moji_shift
		call	count_init
		movf	count_sub2,0
		call	moji_set_sub2
		call	led_set_sub0
		
sw1_end		btfss	PORTA,4
		goto	sw1_end
next_key
;-------------------------------------- led disp
		movlw	00h
		movwf	PORTA
		movf	led_data0,0
		movwf	PORTB
		call	wait_1

		movlw	01h
		movwf	PORTA
		movf	led_data1,0
		movwf	PORTB
		call	wait_1

		movlw	02h
		movwf	PORTA
		movf	led_data2,0
		movwf	PORTB
		call	wait_1

		movlw	03h
		movwf	PORTA
		movf	led_data3,0
		movwf	PORTB
		call	wait_1

		movlw	04h
		movwf	PORTA
		movf	led_data4,0
		movwf	PORTB
		call	wait_1

		movlw	05h
		movwf	PORTA
		movf	led_data5,0
		movwf	PORTB
		call	wait_1

		movlw	06h
		movwf	PORTA
		movf	led_data6,0
		movwf	PORTB
		call	wait_1

		movlw	07h
		movwf	PORTA
		movf	led_data7,0
		movwf	PORTB
		call	wait_1

		movlw	08h
		movwf	PORTA
		movf	led_data8,0
		movwf	PORTB
		call	wait_1

		movlw	09h
		movwf	PORTA
		movf	led_data9,0
		movwf	PORTB
		call	wait_1

		movlw	0ah
		movwf	PORTA
		movf	led_data10,0
		movwf	PORTB
		call	wait_1

		movlw	0bh
		movwf	PORTA
		movf	led_data11,0
		movwf	PORTB
		call	wait_1
;---------------------------------------
main_next
		goto	main_loop
;-------------------------------------------------------------------------------
led_set_sub0	btfsc	retu_pointa,0
		goto	led_set_s0
		btfsc	retu_pointa,1
		goto	led_set_s1
		btfsc	retu_pointa,2
		goto	led_set_s2
		btfsc	retu_pointa,3
		goto	led_set_s3
		btfsc	retu_pointa,4
		goto	led_set_s4
		btfsc	retu_pointa,5
		goto	led_set_s5
		btfsc	retu_pointa,6
		goto	led_set_s6
		goto	led_set_s7

led_set_s0	movf	moji1,0
		call	led_data_line0
		movwf	led_data0
		movf	moji1,0
		call	led_data_line1
		movwf	led_data1
		movf	moji1,0
		call	led_data_line2
		movwf	led_data2
		movf	moji1,0
		call	led_data_line3
		movwf	led_data3
		movf	moji1,0
		call	led_data_line4
		movwf	led_data4
		movf	moji1,0
		call	led_data_line5
		movwf	led_data5
		movf	moji1,0
		call	led_data_line6
		movwf	led_data6
		movf	moji1,0
		call	led_data_line7
		movwf	led_data7
		movf	moji2,0
		call	led_data_line0
		movwf	led_data8
		movf	moji2,0
		call	led_data_line1
		movwf	led_data9
		movf	moji2,0
		call	led_data_line2
		movwf	led_data10
		movf	moji2,0
		call	led_data_line3
		movwf	led_data11
		return
led_set_s1	call	retu_data_shift	
		movf	moji2,0
		call	led_data_line4
		movwf	led_data11
		return
led_set_s2	call	retu_data_shift		
		movf	moji2,0
		call	led_data_line5
		movwf	led_data11
		return
led_set_s3	call	retu_data_shift
		movf	moji2,0
		call	led_data_line6
		movwf	led_data11
		return
led_set_s4	call	retu_data_shift
		movf	moji2,0
		call	led_data_line7
		movwf	led_data11
		return
led_set_s5	call	retu_data_shift
		movf	moji3,0
		call	led_data_line0
		movwf	led_data11
		return
led_set_s6	call	retu_data_shift
		movf	moji3,0
		call	led_data_line1
		movwf	led_data11
		return
led_set_s7	call	retu_data_shift
		movf	moji3,0
		call	led_data_line2
		movwf	led_data11
		return
;-------------------------------------------------------------------------------
retu_data_shift
		movf	led_data1,0
		movwf	led_data0
		movf	led_data2,0
		movwf	led_data1
		movf	led_data3,0
		movwf	led_data2
		movf	led_data4,0
		movwf	led_data3
		movf	led_data5,0
		movwf	led_data4
		movf	led_data6,0
		movwf	led_data5
		movf	led_data7,0
		movwf	led_data6
		movf	led_data8,0
		movwf	led_data7
		movf	led_data9,0
		movwf	led_data8
		movf	led_data10,0
		movwf	led_data9
		movf	led_data11,0
		movwf	led_data10
		return
;-------------------------------------------------------------------------------
count_init	movlw	00h
		movwf	count_sub2
		movlw	01h
		movwf	retu_pointa
		return
;-------------------------------------------------------------------------------
retu_shift	btfss	retu_pointa,7
		goto	retu_shift2
		movlw	01h
		movwf	retu_pointa
		incf	count_sub2,1	
		movf	count_sub2,0
		call	moji_set_sub2
		movf	moji3,0
		skpz
		goto	retu_shift4
		call	count_init
		movf	count_sub2,0
		call	moji_set_sub2
		goto	retu_shift3
retu_shift4	call	led_set_sub0
		return
retu_shift2	rlf	retu_pointa,1
		bcf	retu_pointa,0
retu_shift3	call	led_set_sub0				
		return
;-------------------------------------------------------------------------------
moji_shift	btfss	moji_mode,3
		goto	moji_shift2
		movlw	01h
		movwf	moji_mode
		return
moji_shift2	rlf	moji_mode,1
		bcf	moji_mode,0
		return		
;-------------------------------------------------------------------------------
moji_set_sub2	btfsc	moji_mode,0
		goto	moji_set_sub20
		btfsc	moji_mode,1
		goto	moji_set_sub21
		btfsc	moji_mode,2
		goto	moji_set_sub22
		goto	moji_set_sub23
moji_set_sub20	movwf	taihi2
		call	moji_set0
		movwf	moji1
		movf	taihi2,0
		addlw	1
		call	moji_set0
		movwf	moji2
		movf	taihi2,0
		addlw	2
		call	moji_set0
		movwf	moji3
		return
moji_set_sub21	movwf	taihi2
		call	moji_set1
		movwf	moji1
		movf	taihi2,0
		addlw	1
		call	moji_set1
		movwf	moji2
		movf	taihi2,0
		addlw	2
		call	moji_set1
		movwf	moji3
		return
moji_set_sub22	movwf	taihi2
		call	moji_set2
		movwf	moji1
		movf	taihi2,0
		addlw	1
		call	moji_set2
		movwf	moji2
		movf	taihi2,0
		addlw	2
		call	moji_set2
		movwf	moji3
		return
moji_set_sub23	movwf	taihi2
		call	moji_set3
		movwf	moji1
		movf	taihi2,0
		addlw	1
		call	moji_set3
		movwf	moji2
		movf	taihi2,0
		addlw	2
		call	moji_set3
		movwf	moji3
		return
;-------------------------------------------------------------------------------
moji_set0		movwf	taihi
		movlw	low(moji00)
		addwf	taihi,1
		movlw	high(moji00)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
moji00		retlw	moji_I
		retlw	moji_love
		retlw	moji_N
		retlw	moji_E
		retlw	moji_W
		retlw	moji_Y
		retlw	moji_O
		retlw	moji_R
		retlw	moji_K
		retlw	moji_mk
		retlw	moji_sp
		retlw	moji_I
		retlw	moji_love
		retlw	00h
;-------------------------------------------------------------------------------
moji_set1	movwf	taihi
		movlw	low(moji10)
		addwf	taihi,1
		movlw	high(moji10)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
moji10		retlw	moji_N
		retlw	moji_O
		retlw	moji_N
		retlw	moji_C
		retlw	moji_H
		retlw	moji_A
		retlw	moji_N
		retlw	moji_S
		retlw	moji_O
		retlw	moji_F
		retlw	moji_T
		retlw	moji_sp
		retlw	moji_P
		retlw	moji_I
		retlw	moji_C
		retlw	moji_1
		retlw	moji_6
		retlw	moji_F
		retlw	moji_8
		retlw	moji_4
		retlw	moji_sp
		retlw	moji_N
		retlw	moji_O
		retlw	00h
;-------------------------------------------------------------------------------
moji_set2		movwf	taihi
		movlw	low(moji20)
		addwf	taihi,1
		movlw	high(moji20)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
moji20		retlw	moji_1
		retlw	moji_2
		retlw	moji_3
		retlw	moji_4
		retlw	moji_5
		retlw	moji_6
		retlw	moji_7
		retlw	moji_8
		retlw	moji_9
		retlw	moji_up
		retlw	moji_right
		retlw	moji_down
		retlw	moji_left
		retlw	moji_sp
		retlw	moji_1
		retlw	moji_2
		retlw	00h
;-------------------------------------------------------------------------------
moji_set3		movwf	taihi
		movlw	low(moji30)
		addwf	taihi,1
		movlw	high(moji30)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
moji30		retlw	moji_T
		retlw	moji_E
		retlw	moji_M
		retlw	moji_P
		retlw	moji_co
		retlw	moji_2
		retlw	moji_4
		retlw	moji_dot
		retlw	moji_7
		retlw	moji_do
		retlw	moji_sp
		retlw	moji_H
		retlw	moji_U
		retlw	moji_M
		retlw	moji_I
		retlw	moji_co
		retlw	moji_6
		retlw	moji_5
		retlw	moji_dot
		retlw	moji_8
		retlw	moji_par
		retlw	moji_sp
		retlw	moji_T
		retlw	moji_E
		retlw	00h
;-------------------------------------------------------------------------------
led_data_line0	movwf	taihi
		movlw	low(table0)
		addwf	taihi,1
		movlw	high(table0)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
table0		retlw	0ffh		;
		retlw	0c0h		;A
		retlw	00h		;B
		retlw	81h		;C
		retlw	00h		;D
		retlw	00h		;E
		retlw	00h		;F
		retlw	81h		;G
		retlw	00h		;H
		retlw	0ffh		;I
		retlw	0f9h		;J
		retlw	00h		;K
		retlw	00h		;L
		retlw	00h		;M
		retlw	00h		;N
		retlw	81h		;O
		retlw	00h		;P
		retlw	81h		;Q
		retlw	00h		;R
		retlw	9dh		;S
		retlw	7fh		;T
		retlw	01h		;U
		retlw	1fh		;V
		retlw	01h		;W
		retlw	3ch		;X
		retlw	0fh		;Y
		retlw	7ch		;Z
		retlw	0ffh		;
		retlw	0fch		;!
		retlw	87h		;love
		retlw	0ffh		;1
		retlw	9ch		;2
		retlw	99h		;3
		retlw	0e3h		;4
		retlw	09h		;5
		retlw	81h		;6
		retlw	1fh		;7
		retlw	99h		;8
		retlw	8dh		;9
		retlw	81h		;0
		retlw	0ffh		;:
		retlw	0e7h		;~
		retlw	0e7h		;+
		retlw	0e7h		;-
		retlw	0bdh		;*
		retlw	0e7h		;waru
		retlw	99h		;=
		retlw	0ffh		;po
		retlw	9fh		;?
		retlw	0e7h		;<
		retlw	3ch		;>
		retlw	0efh		;up
		retlw	0c7h		;right
		retlw	0f7h		;down
		retlw	0efh		;left
		retlw	0e7h		;daiya
		retlw	99h		;#
		retlw	0ffh		;.
		retlw	1ch		;%
		retlw	1fh		;do
;-------------------------------------------------------------------------------
led_data_line1	movwf	taihi
		movlw	low(table1)
		addwf	taihi,1
		movlw	high(table1)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
table1		retlw	0ffh		;
		retlw	80h		;A
		retlw	00h		;B
		retlw	00h		;C
		retlw	00h		;D
		retlw	00h		;E
		retlw	00h		;F
		retlw	00h		;G
		retlw	00h		;H
		retlw	7eh		;I
		retlw	0f8h		;J
		retlw	00h		;K
		retlw	00h		;L
		retlw	00h		;M
		retlw	00h		;N
		retlw	00h		;O
		retlw	00h		;P
		retlw	00h		;Q
		retlw	00h		;R
		retlw	0ch		;S
		retlw	7fh		;T
		retlw	00h		;U
		retlw	07h		;V
		retlw	00h		;W
		retlw	18h		;X
		retlw	07h		;Y
		retlw	78h		;Z
		retlw	0ffh		;
		retlw	0fch		;!
		retlw	03h		;love
		retlw	0beh		;1
		retlw	18h		;2
		retlw	18h		;3
		retlw	83h		;4
		retlw	08h		;5
		retlw	00h		;6
		retlw	1fh		;7
		retlw	00h		;8
		retlw	04h		;9
		retlw	00h		;0
		retlw	0ffh		;:
		retlw	0cfh		;~
		retlw	0e7h		;+
		retlw	0e7h		;-
		retlw	99h		;*
		retlw	0e7h		;waru
		retlw	99h		;=
		retlw	0f7h		;po
		retlw	1fh		;?
		retlw	0c3h		;<
		retlw	3ch		;>
		retlw	0cfh		;up
		retlw	0c7h		;right
		retlw	0f3h		;down
		retlw	0c7h		;left
		retlw	0c3h		;daiya
		retlw	00h		;#
		retlw	0f9h		;.
		retlw	58h		;%
		retlw	5fh		;do
;-------------------------------------------------------------------------------
led_data_line2	movwf	taihi
		movlw	low(table2)
		addwf	taihi,1
		movlw	high(table2)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
table2		retlw	0ffh		;
		retlw	33h		;A
		retlw	66h		;B
		retlw	3ch		;C
		retlw	7eh		;D
		retlw	66h		;E
		retlw	67h		;F
		retlw	3ch		;G
		retlw	0e7h		;H
		retlw	00h		;I
		retlw	0fch		;J
		retlw	0c3h		;K
		retlw	7eh		;L
		retlw	9fh		;M
		retlw	0c7h		;N
		retlw	3ch		;O
		retlw	67h		;P
		retlw	7eh		;Q
		retlw	67h		;R
		retlw	06h		;S
		retlw	00h		;T
		retlw	0fch		;U
		retlw	0c1h		;V
		retlw	0f8h		;W
		retlw	81h		;X
		retlw	0e0h		;Y
		retlw	70h		;Z
		retlw	0ffh		;
		retlw	0e3h		;!
		retlw	01h		;love
		retlw	00h		;1
		retlw	78h		;2
		retlw	7eh		;3
		retlw	3bh		;4
		retlw	6eh		;5
		retlw	66h		;6
		retlw	7fh		;7
		retlw	66h		;8
		retlw	66h		;9
		retlw	7eh		;0
		retlw	99h		;:
		retlw	0c7h		;~
		retlw	00h		;+
		retlw	0e7h		;-
		retlw	0c3h		;*
		retlw	24h		;waru
		retlw	99h		;=
		retlw	0c3h		;po
		retlw	7fh		;?
		retlw	81h		;<
		retlw	18h		;>
		retlw	81h		;up
		retlw	0c7h		;right
		retlw	81h		;down
		retlw	83h		;left
		retlw	81h		;daiya
		retlw	00h		;#
		retlw	0f0h		;.
		retlw	11h		;%
		retlw	81h		;do
;-------------------------------------------------------------------------------
led_data_line3	movwf	taihi
		movlw	low(table3)
		addwf	taihi,1
		movlw	high(table3)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
table3		retlw	0ffh		;
		retlw	33h		;A
		retlw	66h		;B
		retlw	7eh		;C
		retlw	7eh		;D
		retlw	66h		;E
		retlw	67h		;F
		retlw	66h		;G
		retlw	0e7h		;H
		retlw	00h		;I
		retlw	7eh		;J
		retlw	81h		;K
		retlw	0feh		;L
		retlw	0c7h		;M
		retlw	0e3h		;N
		retlw	7eh		;O
		retlw	67h		;P
		retlw	72h		;Q
		retlw	61h		;R
		retlw	66h		;S
		retlw	00h		;T
		retlw	0feh		;U
		retlw	0f0h		;V
		retlw	0c1h		;W
		retlw	0c3h		;X
		retlw	0e0h		;Y
		retlw	42h		;Z
		retlw	0ffh		;
		retlw	83h		;!
		retlw	80h		;love
		retlw	00h		;1
		retlw	72h		;2
		retlw	66h		;3
		retlw	00h		;4
		retlw	6eh		;5
		retlw	66h		;6
		retlw	70h		;7
		retlw	66h		;8
		retlw	66h		;9
		retlw	66h		;0
		retlw	99h		;:
		retlw	0e3h		;~
		retlw	00h		;+
		retlw	0e7h		;-
		retlw	00h		;*
		retlw	24h		;waru
		retlw	99h		;=
		retlw	0c3h		;po
		retlw	72h		;?
		retlw	99h		;<
		retlw	99h		;>
		retlw	01h		;up
		retlw	01h		;right
		retlw	80h		;down
		retlw	01h		;left
		retlw	00h		;daiya
		retlw	99h		;#
		retlw	0f0h		;.
		retlw	0c7h		;%
		retlw	00h		;do
;-------------------------------------------------------------------------------
led_data_line4	movwf	taihi
		movlw	low(table4)
		addwf	taihi,1
		movlw	high(table4)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
table4		retlw	0ffh		;
		retlw	33h		;A
		retlw	66h		;B
		retlw	7eh		;C
		retlw	3ch		;D
		retlw	66h		;E
		retlw	67h		;F
		retlw	66h		;G
		retlw	0e7h		;H
		retlw	7eh		;I
		retlw	7ch		;J
		retlw	18h		;K
		retlw	0feh		;L
		retlw	9fh		;M
		retlw	0f1h		;N
		retlw	3ch		;O
		retlw	67h		;P
		retlw	78h		;Q
		retlw	60h		;R
		retlw	60h		;S
		retlw	7fh		;T
		retlw	0fch		;U
		retlw	0c1h		;V
		retlw	0f8h		;W
		retlw	81h		;X
		retlw	07h		;Y
		retlw	0eh		;Z
		retlw	0ffh		;
		retlw	07h		;!
		retlw	01h		;love
		retlw	0feh		;1
		retlw	66h		;2
		retlw	66h		;3
		retlw	00h		;4
		retlw	6ch		;5
		retlw	66h		;6
		retlw	60h		;7
		retlw	66h		;8
		retlw	66h		;9
		retlw	7eh		;0
		retlw	0ffh		;:
		retlw	0f3h		;~
		retlw	0e7h		;+
		retlw	0e7h		;-
		retlw	0c3h		;*
		retlw	0e7h		;waru
		retlw	99h		;=
		retlw	0e7h		;po
		retlw	62h		;?
		retlw	18h		;<
		retlw	81h		;>
		retlw	81h		;up
		retlw	83h		;right
		retlw	81h		;down
		retlw	0c7h		;left
		retlw	81h		;daiya
		retlw	00h		;#
		retlw	0f9h		;.
		retlw	88h		;%
		retlw	3ch		;do
;-------------------------------------------------------------------------------
led_data_line5	movwf	taihi
		movlw	low(table5)
		addwf	taihi,1
		movlw	high(table5)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
table5		retlw	0ffh		;
		retlw	80h		;A
		retlw	00h		;B
		retlw	18h		;C
		retlw	00h		;D
		retlw	66h		;E
		retlw	67h		;F
		retlw	20h		;G
		retlw	00h		;H
		retlw	0ffh		;I
		retlw	00h		;J
		retlw	3ch		;K
		retlw	0feh		;L
		retlw	00h		;M
		retlw	00h		;N
		retlw	00h		;O
		retlw	07h		;P
		retlw	00h		;Q
		retlw	04h		;R
		retlw	30h		;S
		retlw	7fh		;T
		retlw	00h		;U
		retlw	07h		;V
		retlw	00h		;W
		retlw	18h		;X
		retlw	0fh		;Y
		retlw	1eh		;Z
		retlw	0ffh		;
		retlw	0fh		;!
		retlw	03h		;love
		retlw	0ffh		;1
		retlw	06h		;2
		retlw	00h		;3
		retlw	0fbh		;4
		retlw	60h		;5
		retlw	20h		;6
		retlw	0fh		;7
		retlw	00h		;8
		retlw	00h		;9
		retlw	00h		;0
		retlw	0ffh		;:
		retlw	0f3h		;~
		retlw	0e7h		;+
		retlw	0e7h		;-
		retlw	99h		;*
		retlw	0e7h		;waru
		retlw	99h		;=
		retlw	0ffh		;po
		retlw	0fh		;?
		retlw	3ch		;<
		retlw	0c3h		;>
		retlw	0cfh		;up
		retlw	0c7h		;right
		retlw	0f3h		;down
		retlw	0c7h		;left
		retlw	0c3h		;daiya
		retlw	00h		;#
		retlw	0ffh		;.
		retlw	1ah		;%
		retlw	18h		;do
;-------------------------------------------------------------------------------
led_data_line6	movwf	taihi
		movlw	low(table6)
		addwf	taihi,1
		movlw	high(table6)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
table6		retlw	0ffh		;
		retlw	0c0h		;A
		retlw	99h		;B
		retlw	99h		;C
		retlw	81h		;D
		retlw	7eh		;E
		retlw	7fh		;F
		retlw	31h		;G
		retlw	00h		;H
		retlw	0ffh		;I
		retlw	01h		;J
		retlw	7eh		;K
		retlw	0feh		;L
		retlw	00h		;M
		retlw	00h		;N
		retlw	81h		;O
		retlw	8fh		;P
		retlw	81h		;Q
		retlw	8eh		;R
		retlw	0b9h		;S
		retlw	0ffh		;T
		retlw	01h		;U
		retlw	1fh		;V
		retlw	01h		;W
		retlw	3ch		;X
		retlw	0ffh		;Y
		retlw	3eh		;Z
		retlw	0ffh		;
		retlw	1fh		;!
		retlw	87h		;love
		retlw	0ffh		;1
		retlw	8eh		;2
		retlw	99h		;3
		retlw	0fbh		;4
		retlw	71h		;5
		retlw	0b1h		;6
		retlw	1fh		;7
		retlw	99h		;8
		retlw	81h		;9
		retlw	81h		;0
		retlw	0ffh		;:
		retlw	0e7h		;~
		retlw	0ffh		;+
		retlw	0e7h		;-
		retlw	0bdh		;*
		retlw	0ffh		;waru
		retlw	99h		;=
		retlw	0ffh		;po
		retlw	9fh		;?
		retlw	3ch		;<
		retlw	0e7h		;>
		retlw	0efh		;up
		retlw	0efh		;right
		retlw	0f7h		;down
		retlw	0c7h		;left
		retlw	0e7h		;daiya
		retlw	99h		;#
		retlw	0ffh		;.
		retlw	38h		;%
		retlw	99h		;do
;-------------------------------------------------------------------------------
led_data_line7	movwf	taihi
		movlw	low(table7)
		addwf	taihi,1
		movlw	high(table7)
		movwf	PCLATH
		addcf	PCLATH,1
		movf	taihi,0
		movwf	PCL
table7		retlw	0ffh		;
		retlw	0ffh		;A
		retlw	0ffh		;B
		retlw	0ffh		;C
		retlw	0ffh		;D
		retlw	0ffh		;E
		retlw	0ffh		;F
		retlw	0ffh		;G
		retlw	0ffh		;H
		retlw	0ffh		;I
		retlw	0ffh		;J
		retlw	0ffh		;K
		retlw	0ffh		;L
		retlw	0ffh		;M
		retlw	0ffh		;N
		retlw	0ffh		;O
		retlw	0ffh		;P
		retlw	0ffh		;Q
		retlw	0ffh		;R
		retlw	0ffh		;S
		retlw	0ffh		;T
		retlw	0ffh		;U
		retlw	0ffh		;V
		retlw	0ffh		;W
		retlw	0ffh		;X
		retlw	0ffh		;Y
		retlw	0ffh		;Z
		retlw	0ffh		;
		retlw	0ffh		;!
		retlw	0ffh		;love
		retlw	0ffh		;1
		retlw	0ffh		;2
		retlw	0ffh		;3
		retlw	0ffh		;4
		retlw	0ffh		;5
		retlw	0ffh		;6
		retlw	0ffh		;7
		retlw	0ffh		;8
		retlw	0ffh		;9
		retlw	0ffh		;0
		retlw	0ffh		;:
		retlw	0ffh		;~
		retlw	0ffh		;+
		retlw	0ffh		;-
		retlw	0ffh		;*
		retlw	0ffh		;waru
		retlw	0ffh		;=
		retlw	0ffh		;po
		retlw	0ffh		;?
		retlw	0ffh		;<
		retlw	0ffh		;>
		retlw	0ffh		;up
		retlw	0ffh		;right
		retlw	0ffh		;down
		retlw	0ffh		;left
		retlw	0ffh		;daiya
		retlw	0ffh		;#
		retlw	0ffh		;.
		retlw	0ffh		;%
		retlw	0ffh		;do
;-------------------------------------------------------------------------------
wait_1		
		movlw	0ffh
		movwf	wait_data
wait_2
		decfsz	wait_data,1
		goto	wait_2
		return
;-------------------------------------------------------------------------------
port_set				;RA0,RA1,RA2,RA3(OUT)
					;RA4(IN)
					;RB0,RB1,RB2,RB3,RB4,RB5,RB6,RB7(OUT)
		bsf	STATUS,RP0
		clrf	TRISA
		bsf	TRISA,4
		nop
		clrf	TRISB
		bcf	STATUS,RP0
		return
;-------------------------------------------------------------------------------
timer0_set
		bsf	STATUS,RP0
		movlw	086h		;(1)PORTB NOT PULLUP
					;(0)INTEDG
					;(0)TOCS
					;(0)TOSE
					;(0)PSA
					;(110)1/128
		movwf	OPTION_REG
		bcf	STATUS,RP0
		
		movlw	tm0_setdata
		movwf	TMR0
		bsf	INTCON,T0IE
		bsf	INTCON,GIE
		return
;-----------------------------------------------------------------------------
		END                     ; directive 'end of program'
(2ページ)へ戻る

不明点などあればメールお願いいたします。nonchansoft@nifty.com