Mesaj led

Başlatan ilker_32, 23 Temmuz 2009, 12:47:14

ilker_32

Bilgisayarım biraz karışmış düzenleme yapıyorum. Gözüme çarpan hoş örnekleri buraya yazıyorum gerçekten birşeyler öğrenmek için güzel örnekler. Daha fazlası için tıklayın.





;*******************************************************************************************
;                           message.asm
;
; This code makes a message appear in mid air.The 5 leds are connected to portb. RB0 - RB4 
; put new message in below. NOTE: messages too long are a problem, as the 
; 'persistence of vision' doesn't work.
; LEDS connected to port RB0 - 4 tilt/accelerometer to RA0 to start text
;
; letters are in columns. i.e letter A
; 0110
; 1001
; 1001   the 1's make up the A.  1 = LED on. 0 = off
; 1111
; 1001

;*******************************************************************************************

	LIST    P=16C84;f=inhx8m
	
w       equ     0			; register destination addresses.
f       equ     1	
same	equ	1

z       equ     2			; status flags
zero	equ	2
c	equ	0
carry	equ	0
	
count1  equ     0C      		; wait counter ls digit file register C
count2  equ	0D			; wait counter ms digit file register D

portb   equ     06      		; port b I/O register f6
porta	equ	05			; port a I/O register f5
status  equ     03     			; status register f3
time	equ	.15
;
;
;
	org     0			; origin
;
init   
	movlw   0			;initialise port settings
	tris    portb
	movwf   portb
	movlw	1
	tris	porta
	bcf	porta,0

start
	goto	getbut 
	
;* TYPE YOUR MESSAGE IN HERE *

letters	call	lh			;type in letters here.
	call	le	
	call	ll
	call	ll
	call	lo
	goto	getbut			;goto get button input

;* FINISH MESSAGE SECTION *

getbut	bcf	status,1
	movf	porta,w			;gets input from start button on porta.0
	movwf	status			;read status register, to see value of porta
	btfsc	status,0
	goto	getbut			;if status = 1 then goto letter else goto getbut
	goto	letters	


;*ROUTINES FOR OUTPUTING CHARACTERS TO LED'S ON PORTB*
;each letter is prefixed with l e.g la is a

la	call 	wait			; wait for a bit
	movlw	B'00001111'		;output corresponding values out of portb
	movwf	portb
	call	wait		
	movlw	B'00010010'
	movwf	portb
	call 	wait
	movlw	B'00010010'
	movwf	portb
	call 	wait
	movlw	B'00001111'
	movwf	portb
	call 	space1
	return

lb	call 	wait			; wait for a bit
	movlw	B'00001111'
	movwf	portb
	call	wait			;
	movlw	B'00010101'
	movwf	portb
	call 	wait
	movlw	B'00010101'
	movwf	portb
	call 	wait
	movlw	B'00001010'
	movwf	portb
	call 	space1
	return

lc	call 	wait			; wait for a bit
	movlw	B'00001110'
	movwf	portb
	call	wait			 
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00010001'
	movwf	portb
	call 	space1
	return

ld	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			 
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00001110'
	movwf	portb
	call 	space1
	return
		

le	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			 
	movlw	B'00010101'
	movwf	portb
	call 	wait
	movlw	B'00010101'
	movwf	portb
	call 	wait
	movlw	B'00010101'
	movwf	portb
	call 	space1
	return

lf	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			 
	movlw	B'00010100'
	movwf	portb
	call 	wait
	movlw	B'00010100'
	movwf	portb
	call 	wait
	movlw	B'00010100'
	movwf	portb
	call 	space1
	return

lg	call 	wait			; wait for a bit
	movlw	B'00001110'
	movwf	portb
	call	wait			 
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00010011'
	movwf	portb
	call 	wait
	movlw	B'00010011'
	movwf	portb
	call 	space1
	return

lh	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			 
	movlw	B'00000100'
	movwf	portb
	call 	wait
	movlw	B'00000100'
	movwf	portb
	call 	wait
	movlw	B'00011111'
	movwf	portb
	call 	space1
	return

li	call 	wait			; wait for a bit
	movlw	B'00010001'
	movwf	portb
	call	wait			 
	movlw	B'00001111'
	movwf	portb
	call 	wait
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00000000'
	movwf	portb
	call 	space1
	return

lj	call 	wait			; wait for a bit
	movlw	B'00010010'
	movwf	portb
	call	wait			 
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00011110'
	movwf	portb
	call 	wait
	movlw	B'00010000'
	movwf	portb
	call 	space1
	return

lk	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			 
	movlw	B'00000100'
	movwf	portb
	call 	wait
	movlw	B'00001010'
	movwf	portb
	call 	wait
	movlw	B'00010001'
	movwf	portb
	call 	space1
	return

ll	call 	wait			; wait for a bit
	movlw	B'0001111'
	movwf	portb
	call	wait			 
	movlw	B'00000001'
	movwf	portb
	call 	wait
	movlw	B'00000001'
	movwf	portb
	call 	wait
	movlw	B'00000001'
	movwf	portb
	call 	space1
	return

lm	call 	wait			; wait for a bit
	movlw	B'00001111'
	movwf	portb
	call	wait			 
	movlw	B'00011000'
	movwf	portb
	call 	wait
	movlw	B'00011000'
	movwf	portb
	call 	wait
	movlw	B'00001111'
	movwf	portb
	call 	space1
	return

ln	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			
	movlw	B'00001000'
	movwf	portb
	call 	wait
	movlw	B'00000100'
	movwf	portb
	call 	wait
	movlw	B'00011111'
	movwf	portb
	call 	space1
	return

lo	call 	wait			; wait for a bit
	movlw	B'00001110'
	movwf	portb
	call	wait			
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00001110'
	movwf	portb
	call 	space1
	return

lp	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			 
	movlw	B'00010100'
	movwf	portb
	call 	wait
	movlw	B'00010100'
	movwf	portb
	call 	wait
	movlw	B'00001000'
	movwf	portb
	call 	space1
	return

lq	call 	wait			; wait for a bit
	movlw	B'00001110'
	movwf	portb
	call	wait			 
	movlw	B'00010001'
	movwf	portb
	call 	wait
	movlw	B'00010011'
	movwf	portb
	call 	wait
	movlw	B'00001111'
	movwf	portb
	call 	space1
	return

lr	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			 
	movlw	B'00010100'
	movwf	portb
	call 	wait
	movlw	B'00010110'
	movwf	portb
	call 	wait
	movlw	B'00001001'
	movwf	portb
	call 	space1
	return

ls	call 	wait			; wait for a bit
	movlw	B'00011101'
	movwf	portb
	call	wait			 
	movlw	B'00010101'
	movwf	portb
	call 	wait
	movlw	B'00010101'
	movwf	portb
	call 	wait
	movlw	B'00010111'
	movwf	portb
	call 	space1
	return

lt	call 	wait			; wait for a bit
	movlw	B'00010000'
	movwf	portb
	call	wait			 
	movlw	B'00011111'
	movwf	portb
	call 	wait
	movlw	B'00010000'
	movwf	portb
	call 	wait
	movlw	B'00000000'
	movwf	portb
	call 	space1
	return

lu	call 	wait			; wait for a bit
	movlw	B'00011111'
	movwf	portb
	call	wait			 
	movlw	B'00000001'
	movwf	portb
	call 	wait
	movlw	B'00000001'
	movwf	portb
	call 	wait
	movlw	B'00011111'
	movwf	portb
	call 	space1
	return

lv	call 	wait			; wait for a bit
	movlw	B'00011110'
	movwf	portb
	call	wait			 
	movlw	B'00000001'
	movwf	portb
	call 	wait
	movlw	B'00011110'
	movwf	portb
	call 	wait
	movlw	B'00000000'
	movwf	portb
	call 	space1
	return

lw	call 	wait			; wait for a bit
	movlw	B'00011110'
	movwf	portb
	call	wait			 
	movlw	B'00000011'
	movwf	portb
	call 	wait
	movlw	B'00000011'
	movwf	portb
	call 	wait
	movlw	B'00011110'
	movwf	portb
	call 	space1
	return

lx	call 	wait			; wait for a bit
	movlw	B'00010010'
	movwf	portb
	call	wait			 
	movlw	B'00001100'
	movwf	portb
	call 	wait
	movlw	B'00001100'
	movwf	portb
	call 	wait
	movlw	B'00010011'
	movwf	portb
	call 	space1
	return

ly	call 	wait			; wait for a bit
	movlw	B'00010001'
	movwf	portb
	call	wait			 
	movlw	B'00001110'
	movwf	portb
	call 	wait
	movlw	B'00001000'
	movwf	portb
	call 	wait
	movlw	B'00010000'
	movwf	portb
	call 	space1
	return

lz	call 	wait			; wait for a bit
	movlw	B'00010001'
	movwf	portb
	call	wait			;
	movlw	B'00010011'
	movwf	portb
	call 	wait
	movlw	B'00010101'
	movwf	portb
	call 	wait
	movlw	B'00011001'
	movwf	portb
	call 	space1
	return

space1	movlw	B'00000000'		;routine to put spaces between the letters
	call 	wait
	movlw	B'00000000'
	movwf	portb
	movlw	B'00000000'
	return

space2 	nop				;loop forever
	goto	space2


;* wait subroutine *

wait    
	movlw   time	        ; load count1 with decimal time
	movwf   count1
d1	movlw   time		; load count2 with decimal time
	movwf   count2	
				
	
d2	decfsz  count2,same	; decrement F,skip if zero
	goto 	d2		; if not zero		
	decfsz  count1		; decrement count1 if count2 is zero
	goto 	d1		; do inside loop again if count2 nz
	retlw 	00
; ----------------------------END

sportmen


mustafa_cmbz

bende üni öğrencilerine yapmıştım böyle bişey netten hazır devre bulmuşlardı 12f629 ile kurmuşlar devreydi çok ta güzel çalışıyordu...