A ver si me podes echar una mano resulta que tengo que hacer un programa que cuente de 0000 hasta 9999
De momento solo empieza a contar el display 1(bit0) pero cuando llega a 9 salta al siguiente display(bit1) y apaga el
el primer display,lo quiero es que permanezca encencendido los 4 Display
Ej:
0000,0001,0002,0003,0004,0004,0005,0006,0007,0008,0009,0010,0011 etc.
De momento es este el codigo que tengo:
;
; The following line embeds configuration data into the PICmicro
LIST P=16F88
; __CONFIG H'2007', H'3F7A' ; RC mode
__CONFIG H'2008', H'3FFC' ; Clock Fail-Safe disabled
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; using aliases, bit names and conditional loops
#DEFINE PAGE0 BCF STATUS,5
#DEFINE PAGE1 BSF STATUS,5
STATUS EQU H'03' ; STATUS register
TRISB EQU H'86' ; Port B direction register
PORTB EQU H'06' ; Port B data register
TRISA EQU H'85' ; Port A direction register
PORTA EQU H'05' ; Port A data register
PCL EQU H'02'
W EQU 0 ; Working register flag
F EQU 1 ; File register flag
C EQU 0 ; Carry flag
Z equ 2
COUNT equ h'37' ; Use File h'30' as a loop counter
COUNT5 equ h'38'
COUNT1 equ h'30' ; Use File h'30' as a loop counter
COUNT2 equ h'31'
COUNT3 equ h'32'
COUNT4 equ h'37'
DIGIT1 EQU h'33'
DIGIT2 EQU h'34'
DIGIT3 EQU h'35'
DIGIT4 EQU h'36'
N equ H'50' ; Delay parameter computed in the text
ORG 0 ; Reset vector
GOTO 5 ; Goto start of program
ORG 4 ; Interrupt vector
GOTO 5 ; Goto start of program
ORG 5 ; Start of program memory
START CLRF PORTA ; clear Port B data register
CLRF PORTB
PAGE1 ; PAGE1
CLRF H'9B' ; Clear the ANSEL register
CLRF TRISA ; Port A direction register for output
CLRF TRISB ; Port B direction register for output
PAGE0 ; PAGE0
movlw d'0' ;
movwf DIGIT1
movlw d'0' ;
movwf DIGIT2
movlw d'0' ;
movwf DIGIT3
movlw d'0' ;
movwf DIGIT4
MAIN NOP
CLRF COUNT1
CLRF COUNT2
CLRF COUNT3
CLRF COUNT4
CLRF COUNT1
MOVF COUNT1, W
CALL TABLE
MOVWF PORTB
BSF PORTA,0
BSF PORTA,1
BSF PORTA,2
BSF PORTA,3
CALL DELAY
CLRF COUNT1
LoopD1 ;CLRF TRISA
;CLRF TRISB
MOVF COUNT1,W
CALL TABLE
MOVWF PORTB
BSF PORTA,3
CALL DELAY
INCF COUNT1
MOVF COUNT1
CLRF PORTA
ADDLW H'F6'
BTFSS STATUS,Z
GOTO LoopD1
MOVF COUNT2,W
CALL TABLE
MOVWF PORTB
BCF PORTA,2
BSF PORTA,2
MOVF COUNT3,W
CALL TABLE
MOVWF PORTB
BCF PORTA,1
BSF PORTA,1
MOVF COUNT4,W
CALL TABLE
MOVWF PORTB
BCF PORTA,0
BSF PORTA,0
CALL DELAY
INCF COUNT1
MOVF COUNT1
CLRF PORTA
ADDLW H'F6'
BTFSS STATUS,Z
GOTO LoopD1
;CLRF COUNT2
LoopD2 MOVF COUNT2,W
CALL TABLE
MOVWF PORTB
BSF PORTA,2
CALL DELAY
INCF COUNT2
MOVF COUNT2
GOTO LOOPD1
;CLRF PORTA
ADDLW H'F6'
BTFSS STATUS,Z
GOTO LoopD2
CLRF COUNT3
LoopD3 MOVF COUNT3,W
CALL TABLE
MOVWF PORTB
BSF PORTA,1
CALL DELAY
INCF COUNT3
MOVF COUNT3
CLRF PORTA
ADDLW H'F6'
BTFSS STATUS,Z
GOTO LoopD3
CLRF COUNT4
LoopD4 MOVF COUNT4,W
CALL TABLE
MOVWF PORTB
BSF PORTA,0
CALL DELAY
INCF COUNT4
MOVF COUNT4
CLRF PORTA
ADDLW H'F6'
BTFSS STATUS,Z
GOTO LoopD4
GOTO MAIN
;==========================================================================================
;TABLE ROUTINE GOES HERE
TABLE ADDWF PCL,F
RETLW B'11000000' ;0
RETLW B'11111001' ;1
RETLW B'10100100' ;2
RETLW B'10110000' ;3
RETLW B'10011001' ;4
RETLW B'10010010' ;5
RETLW B'10000010' ;6
RETLW B'11111000' ;7
RETLW B'10000000' ;8
RETLW B'10010000' ;9
; common anode codes
;==========================================================================================
;FUCTION:'Dummy' Delay
;==========================================================================================
DELAY NOP
NOP
NOP
NOP
NOP
NOP
NOP
RETURN
; final statement
END