9-0 count down(using 5*7 CA dot matrix and PIC16F84A

Status
Not open for further replies.

Xelhion

Newbie level 2
Joined
Feb 1, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,293
:lol:Hey guys! ^^ ! This is my first post. I'm going straight to the point. I am made a count down display from 9-0 and then again.
I already finished the code with the numbers revolving :grin:. Is there any way i could make a shorter code? or can you suggest any pattern/design for the count down? Thanks in advance!
My Code:

Code:
START

	movlw b'00000'
	TRIS PORTA
	movlw b'00000000'
	TRIS PORTB

MAIN
	movlw .0
	movwf control1
	movlw .1
	movwf control2
	movlw .2
	movwf control3
	movlw .3
	movwf control4
	movlw .4
	movwf control5
	movlw .5
	movwf control6
	movlw .6
	movwf control7
	movlw .10
	movwf counter
	
NEXT

	movlw .250
	movwf VAR
	movwf VAR2

LOOP

	movlw .1
	movwf PORTB
	movf control1,w
	call decode
	movwf PORTA
	movlw .31
	movwf PORTA
	
	movlw .2
	movwf PORTB
	movf control2,w
	call decode
	movwf PORTA
	movlw .31
	movwf PORTA
	
	movlw .4
	movwf PORTB
	movf control3,w
	call decode
	movwf PORTA
	movlw .31
	movwf PORTA
	
	movlw .8
	movwf PORTB
	movf control4,w
	call decode
	movwf PORTA
	movlw .31
	movwf PORTA
	
	movlw .16
	movwf PORTB
	movf control5,w
	call decode
	movwf PORTA
	movlw .31
	movwf PORTA
	
	movlw .32
	movwf PORTB
	movf control6,w
	call decode
	movwf PORTA
	movlw .31
	movwf PORTA
	
	movlw .64
	movwf PORTB
	movf control7,w
	call decode
	movwf PORTA
	movlw .31
	movwf PORTA
	
	decfsz VAR,f
	goto LOOP
	movlw .30
	movwf VAR
	decfsz VAR2,f
	goto LOOP

	movlw .7
	addwf control1
	addwf control2
	addwf control3
	addwf control4
	addwf control5
	addwf control6
	addwf control7
	
	decfsz counter,f
	goto NEXT
	goto MAIN

decode

	addwf PCL,f
;NUMBER 9
	Retlw b'11111'
	Retlw b'11111'
	Retlw b'00011'
	Retlw b'01011'
	Retlw b'00000'
	Retlw b'11111'
	Retlw b'11111'
;ROTATE NUMBER 8
	Retlw b'10001'
	Retlw b'01110'
	Retlw b'01110'
	Retlw b'00000'
	Retlw b'01110'
	Retlw b'01110'
	Retlw b'10001'
;ROTATE NUMBER 7
	Retlw b'11111'
	Retlw b'11111'
	Retlw b'11110'
	Retlw b'11110'
	Retlw b'00000'
	Retlw b'11111'
	Retlw b'11111'
;ROTATE NUMBER 6
	Retlw b'11011'
	Retlw b'10111'
	Retlw b'01111'
	Retlw b'00001'
	Retlw b'01110'
	Retlw b'01110'
	Retlw b'10001'
;ROTATE NUMBER 5
	Retlw b'11111'
	Retlw b'11111'
	Retlw b'00010'
	Retlw b'01010'
	Retlw b'01000'
	Retlw b'11111'
	Retlw b'11111'
;ROTATE NUMBER 4
	Retlw b'01111'
	Retlw b'01111'
	Retlw b'01111'
	Retlw b'00000'
	Retlw b'01110'
	Retlw b'01110'
	Retlw b'01110'
;ROTATE NUMBER 3
	Retlw b'11111'
	Retlw b'11111'
	Retlw b'00000'
	Retlw b'01010'
	Retlw b'01010'
	Retlw b'11111'
	Retlw b'11111'
;ROTATE NUMBER 2
	Retlw b'10001'
	Retlw b'01110'
	Retlw b'11101'
	Retlw b'11011'
	Retlw b'10111'
	Retlw b'01111'
	Retlw b'00000'
;ROTATE 1
	Retlw b'11111'
	Retlw b'11111'
	Retlw b'11111'
	Retlw b'11111'
	Retlw b'00000'
	Retlw b'11111'
	Retlw b'11111'
;ZERO
	Retlw b'10001'
	Retlw b'01110'
	Retlw b'01110'
	Retlw b'01110'
	Retlw b'01110'
	Retlw b'01110'
	Retlw b'10001'
	
END
 

I have two new revisions, i had trouble with my mplab so if any of kind enough to see if these revisions build correctly it would be a much help. the new revisions are supposed to display 9-blank-8-blank.... and so on,.. the revisions are attached,, thanks.. ^^ and by the way where is the button to edit my post? XD
these are .asm files which i renamed into .txt files ^^ thanks!
 

Attachments

  • dot_matrix_v3(more chance of running).txt
    5.2 KB · Views: 85
  • dot_matrix_v2.2(supposed to be running).txt
    4.4 KB · Views: 85

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…