Switch to full style
PIC Assembly Articles
Post a reply

SEVEN SEGMENT DISPLAY

Thu May 16, 2013 11:38 pm

SEVEN SEGMENT DISPLAY
Code:
list 16f877
include <p16f877.inc>
BANK0 macro
bcf STATUS
,RP0
bcf STATUS
,RP1
endm

BANK1 macro
bsf STATUS
,RP0
bcf STATUS
,RP1
endm

BANK2 macro
bcf STATUS
,RP0
bsf STATUS
,RP1
endm

BANK3 macro
bsf STATUS
,RP0
bsf STATUS
,RP1
endm
;**********
DIGIT EQU 0x20
; *******
ORG 0
NOP
GOTO START
 
ORG 0x20
START CALL INIT 
;.INITIALISE PORTS
AGAIN MOVF DIGIT
,;GET NUMBER BETWEEN 0 9
ANDLW 0x0F 
;ONLY
CALL GET_PATTERN 
;DECODE
MOVWF PORTD 
;OUTPUT
MOVLW 01 
;SELECT 1ST DIGIT
MOVWF PORTA 
;AND OUTPUT
GOTO AGAIN 
;REPEAT FOR EVER
PORT INITIALISATION
INIT BANK1 
;SET To BANr 1
CLRF TRISD 
;SET PORT D To oUTPUT
MOVLW 06 
;MAKE PORT A DIGITAL
MOVWF ADCON1
CLRF TRISA 
;AND PORT OUTPUT
BANK0 
;BACK TO BANK 0
REIURN

DECODE ROUTINE
GET
-PATTERN
ADDWF PCL 
;GoTO EQUIV PATTERN
RETLW 0x3F 
;ZERo PATTERN
RETLW 0x06 
;ONE PATTERN
RETLW 0x5B 
;TWo PATTERN
RETLW 0x4F 
;THREE PATTERN
RETLW 0x66 
;FOLJR PATTzRN
RETLW 0x6D 
;FIvE PATTERN
RETLW 0x7D 
;SIx PATTEuN
RETLW 0x07 
;SEvEN PATTERN
RETLW 0x7F 
;EIGHT PATTERN
RETLW 0x67 
;NINE PATTEuN
RETLW 0x40 
;INVAtID DIGIT
RETLW 0x40 
;INvALID DIGIT
RETLW 0x40 
;PINvALID DIGIT
RETLW 0x40 
;INvALID DIGITN
RETLW 0x40 
;INVAIID DIGIT
RETLW 0x40 
;INvALID DIGIT
END




Post a reply
  Related Posts  to : SEVEN SEGMENT DISPLAY
 MULTIPLEXING Seven SEGMENT DECODER Assembly     -  
 display list     -  
 Here is how to display any 2d array     -  
 Display a different image for each day of the week     -  
 Display images on jsp from servlet     -  
 How can i display these items in Listview in C#?     -  
 Can I display same vertically on right side?     -  
 read php file in asp and display it as html     -  
 display code block using html     -  
 display Coordinates of mouse in java     -