Kod: Markera allt
rrf voltslo, f
rrf voltslo, f
movf voltslo,w
call prthex
Kod: Markera allt
rrf voltslo, f
rrf voltslo, f
movf voltslo,w
call prthex
Du har vänt på siffrorna, B6h - 57h = 5Fh = 95decPHermansson skrev:6Bh - 57h = 14h = 20dec? Men då har jag inte roterat?
Kod: Markera allt
banksel adresl
movf adresl,w
banksel voltslo
movwf voltslo
movlw b'00000001' ; Clear display
fcall lcd_send_cmd
movlw H'57'
subwf voltslo, F
bcf status, C
rrf voltslo, f
bcf status, C
rrf voltslo, f
movf voltslo,w
call prthex
Kod: Markera allt
bcf status, C
rrf voltslo, f
clrf decimals
btfsc status,c
bsf decimals, 1
bcf status, C
rrf voltslo, f
btfsc status,c
bsf decimals, 0
Kod: Markera allt
; decimals = 0-3
movf decimals, W
;addlw H'30'
;call lcd_send_data
btfsc decimals, 1
goto twth ; 2 or 3, bit 1 set
;btfsc decimals, 0
goto zeon ; 0 or 1, bit 0 set but not bit 1
zeon
btfsc decimals, 0
goto zero ; Zero
goto one
zero
movlw 0
movwf tens_and_ones
goto prtdec
one
movlw 25
movwf tens_and_ones
goto prtdec
twth
btfsc decimals, 0
goto three ; bit 0 and bit 1 set = 3
; bit 1 set but not bit 0 = 2
goto two
two
movlw 50
movwf tens_and_ones
goto prtdec
three
movlw 75
movwf tens_and_ones
goto prtdec
prtdec
; Send ten's
swapf tens_and_ones, W
andlw H'F'
addlw H'30'
call lcd_send_data
; Send one's
movf tens_and_ones, W
andlw H'F'
addlw H'30'
call lcd_send_data