ON 20050923@8:44:29 AM at page: http://www.piclist.com/techref/microchip/math/radix/b2bu-24b9d-xx.htm#38542.4881712963 Dominic Dumont[DD-BVL-AA8a] Replied to post 38542.4881712963 by Guorui.Xu-1 |Insert 'I tried it to, doesnt work for me either. Tried 3 Versions, none of them works...' at: '' Guorui.Xu-1@ou.edu asks:
I modify the code of Peter Hemsley 15July01 for pic18f452. replace 'skpnc' with 'btfsc STATUS ,C'; fsr with fsr0L; indf with indf0; and other miodifications. It works only for 'digital1'( digital1 is correct). I don't know what is the problem. Could anybody can help me out?
Following is my modified codes:

;----------------------------------------------------------------------
;====================================================================
;==== 24 bit to 8 digits BCD BY Peter Hemsley ====================
;====================================================================
;---------------- initialize ------------------


; movlw 0xFF
; movwf count2
; movlw 0xFF
; movwf count1
; movlw 0xFF
; movwf count0

Peter_24bit_BCD
movlw .9
movwf count2
movlw .6
movwf count1
movlw .5
movwf count0

; call bin2dec
;;brk1 return
clrf digit1
clrf digit2
clrf digit3
clrf digit4
clrf digit5
clrf digit6
clrf digit7
clrf digit8

;bin2dec call clrdig
movlw .24 ;24 bits to do
movwf bitcnt
clrf FSR0H
;bitlp rlf count0 ;Shift msb into carry
; rlf count1
; rlf count2
bitlp rlcf count0 ;Shift msb into carry
rlcf count1
rlcf count2

movlw digit1
; movwf fsr ;Pointer to digits
movwf FSR0L ;Pointer to digits
movlw .8 ;8 digits to do
movwf digcnt
;adjlp rlf indf ;Shift digit 1 bit left
adjlp rlcf INDF0 ;Shift digit 1 bit left
;movlw -10
; addwf indf,w ;Check and adjust for decimal overflow
; skpnc
; movwf indf

movlw -d'10'
addwf INDF0,w ;Check and adjust for decimal overflow
btfsc STATUS,C,0
movwf INDF0


; incf fsr ;Next digit
; decfsz digcnt
; goto adjlp
; decfsz bitcnt ;Next bit
; goto bitlp
; return

incf FSR0L ;Next digit
decfsz digcnt
; goto adjlp
bra adjlp
decfsz bitcnt ;Next bit
; goto bitlp
bra bitlp
; return
ON 20050923 at page: http://www.massmind.org/techref/microchip/math/radix/b2bu-24b9d-xx.htm someone[--] edited the page. Difference: "R:\bak\H\techref\microchip\math\radix\b2bu-24b9d-xx.htm.20050923.dif" ON 20050928@10:31:56 AM at page: http://www.piclist.com/microchip/math/radix/b2bu-16b5d-jm.htm#38623.3422337963 James Newton[JMN-EFP-786] published post 38623.3422337963 Yes its works fine not like others, thanks Juan...

the possible problems are ram blocks this is important note!!!
all PIC Ram loction are diffent!

Aydede/ from Turkey |Delete 'P-' before: '' but after: '