Contador lcd 7-segmentos.

Estoy haciendo un diseño que contador up/down con pic16f84 y controladora de lcd siete segmentos ay0438 no se si alguien ha tocado algo de esto, y necesitaria un poco de ayuda con el codigo, la comunicacion es SPI entre el pic y la lcd. En el ejemplo del datasheet viene un contador de incrementos pero tendria que modificarlo para que tambien la cuenta puera descendente, posteo el codigo.

retlw B'01111101' ;decode for 6
retlw B'00000111' ;decode for 7
retlw B'01111111' ;decode for 8
retlw B'01101111' ;decode for 9
;
;
start
clrf PORTB
bsf STATUS,RP0 ;set portb 0,1&2 as outputs
movlw B'11111000' ; /
movwf PORTB ; /
bcf OPTION,RBPU ;enable pull-up for switch
bcf STATUS,RP0
wait
btfsc UPDATELCD ;see if update switch is low
goto wait ;no then wait
bcf LOAD ;make sure load is disabled
movf LSD,w ;get least significant value
clrf PCLATH ;PCH = 0
call DecodeValue ;decode the value
call Send8 ;serially output the seg values
movf SCNDSD,w ;get 2nd significant digit
call DecodeValue ;decode it
call Send8 ;serially output it
movf THRDSD,w ;get 3rd significant digit
call DecodeValue ;decode it
call Send8
movf MSD,w ;get Most significant value
call DecodeValue ;decode it
call Send8 ;serially send it
bsf LOAD ;toggle the LOAD line
bcf LOAD ;to enable the latches
KeyReleased
btfss UPDATELCD ;wait for key to be released
goto KeyReleased
goto wait ;repeat loop.
;
;Send8, sends the 8 bits in the W register
Send8
movwf temp ;save in temp
movlw .8 ;init count
movwf count ;to 8
sendloop
bcf DATAIN ;make sure DATAIN is low
rrf temp ;rotate value through carry
btfsc STATUS,C ;if bit clear then skip
bsf DATAIN ;else set data bit
bsf CLK ;toggle clock
bcf CLK ; /
decfsz count ;see if 8 done
goto sendloop ;no then do all
return ;else return
end

Gracias.
Luis.
 
Bueno parece que he ido por buen camino en contador steval me ha servido para seguir adelante con mi proyecto y funciona bastante bien. Ahora solo tengo que modificar parte del codigo para que termine de hacer lo que quiero.

Un saludo a todo el foro y gracias.

Hasta siempre.....
 
Atrás
Arriba