hi,
By changing the 'bit counter' value to 40 from 32 you are trying process 5 bytes, but you only have 4 bytes to work with, so you are overflowing the conversion and so you are 'losing' the MSD ie: the "1".
hi,
This is a fragment of the code I used to test the Bin2BCD/Disp, it works using the method stated in earlier posts.
Code:
;this is test data to check out the Bin2BCD and DispFreq Subr
;enter with a predivided value 100MHZ by 256 = 390.625
;the 0.625 is 'lost' so the final displayed value is 99,840
start:
movlw 0x86; load the reg with 390.625 == 100,000/256
movwf Result+3
movlw 0x1
movwf Result+2
movlw 0x0
movwf Result+1
movlw 0x0
movwf Result
;reposition the reg values == 390 * 256
movf Result+2,w
movwf Result+1 ;
movf Result+3,w
movwf Result+2
movlw 0x0
movwf Result+3
call Bin2BCD
call DispFreq; displayed value 99,840
lp1: goto lp1
goto start
hi,
By changing the 'bit counter' value to 40 from 32 you are trying process 5 bytes, but you only have 4 bytes to work with, so you are overflowing the conversion and so you are 'losing' the MSD ie: the "1".