This code will break down a decimal value to individual digits by getting its base, e.g. 125 (decimal value) to 1, 2, and 5.
valin equ 0x1C hundreds equ 0x1D hpasses equ 0x1E tpasses equ 0x1F tens equ 0x0C ones equ 0x20 start movlw 0x1F ;example value coming from lm35 to movwf valin ;adc0804 and finally to 16f84 movf valin,w movwf hundreds mainhundreds movlw 0x64 subwf hundreds btfsc STATUS, C goto counthundred movlw 0x64 addwf hundreds starttens movf hundreds,w movwf tens tenspoint movlw 0x0A subwf tens btfsc STATUS, C goto counttens movlw 0x0A addwf tens movf tens,w movwf ones return counthundred movlw 0x01 addwf hpasses goto mainhundreds counttens movlw 0x01 addwf tpasses goto tenspoint
end
No comments:
Post a Comment