Searching \ for '[PIC]: Bin To Bcd to PIC18' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Bin To Bcd to PIC18'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Bin To Bcd to PIC18'
2005\09\12@145053 by luis

flavicon
face
Hi all,

I´m looking for a rotine in asm to convert a 16bit number
to BCD using a PIC18Fxxxx.
Any help,

Thanks in advanced

Luis F.

2005\09\12@160644 by Harold Hallikainen

face picon face
See http://www.piclist.org/techref/microchip/math/radix/index.htm . Though
I think most of the stuff there is for PIC16, it should work with minor
modification on PIC18. Watch especially for status bit changes after an
incf or decf. As I recall, the 16 and 18 handle this differently.

Also, I had a look at your company website. My father manufactured a
heart-lung machine about 50 years ago. A brochure is available at
http://kauko.hallikainen.org/hi/brochures/1432.pdf . It looks like the
pumps on your machine are very similar to those used on the old machine!

Harold


{Quote hidden}

-- FCC Rules Updated Daily at http://www.hallikainen.co

2005\09\12@170557 by James Newton, Host

face picon face
Please consider sharing any updated version of those routines. It would be
nice to have versions optimized for the 18.

---
James.
 
> {Original Message removed}

2005\09\12@172500 by Jinx

face picon face

> Please consider sharing any updated version of those routines. It
> would be nice to have versions optimized for the 18

I couldn't say this is optimised for the 18F. It's a routine from

http://www.piclist.com/techref/microchip/math/radix/index.htm

modified to run on the 18F

;================================================
;        Convert 16-bit data to ASCII for LCD
;================================================

;enter with data in hi:lo, exit with ASCII in dg1 array

ascii16 nop

radix   dec                  ;base 10

        clrf    kzero
        clrf    temp
        lfsr    fsr0,dg1

        bra     $+4
sub10k   incf    temp
        movlw   10000 & 255
        subwf   lo

IFNDEF  known_zero

        movlw   10000 >> 8
        skpc
        movlw   (10000>>8)+1
        subwf   hi
ELSE
        rlcf    kzero,w
        sublw   (10000>>8)+1
        subwf   hi
ENDIF
        bc      sub10k
        call    out_temp

        mov     10,temp
add1K    decf    temp
        movlw   1000 & 255
        addwf   lo

IFNDEF  kzero
        movlw   1000 >> 8
        skpnc
        movlw   (1000>>8)+1
        addwf   hi
ELSE
        rlcf    kzero,w
        addlw   1000 >> 8
        addwf   hi
ENDIF
        bnc     add1k
        call    out_temp

        clrf    temp
        movlw   100
        bra     $+4
sub100
        incf    temp
        subwf   lo
        skpnc
        bra     sub100

        decf    hi
        btfss   hi,7
        bra     sub100

        call    out_temp

        mov     10,temp
add10    decf    temp
        addwf   lo
        bnc     add10
        call    out_temp     ;convert and store
        call    out_lo       ;convert and store

radix hex

        return

;convert to ASCII and store

out_temp movfw   temp
        addlw   0x30         ;add 0x30 to convert to ASCII
        movwf   indf0        ;postinc0
        incf    fsr0l
        return

out_lo   movfw   lo
        addlw   0x30
        movwf   indf0
        return


2005\09\13@104631 by Djula Djarmati

flavicon
face
part 1 1711 bytes content-type:text/plain; (decoded quoted-printable)

>Please consider sharing any updated version of those routines. It would
>be nice to have versions optimized for the 18.
>
>---
>James.


   James and Luis,

   I use these, they are as fast as I could do it.

24 bit binary to 8 digits BCD
16 bit binary to 5 digits BCD
(only for PIC18)

   Feel free to post them to piclist site if you want.

Djula


>> {Original Message removed}
part 2 7537 bytes content-type:application/octet-stream; (decode)

part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2005\09\13@141339 by luis

flavicon
face
Thanks Djula,

I did your routine and that´s work fine.

Best Regards

Luis F.





{Quote hidden}

>>> {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...