You can edit the page yourself. You'll have to sign in (or create a
sign-in if you don't have one) and then put it right in there.
-Adam
On Tue, Aug 12, 2008 at 5:41 PM, Picbits Sales <spam_OUTsalesTakeThisOuT
picbits.co.uk> wrote:
{Quote hidden}> I've adapted some code from the 16 Bit to BCD to work on the 18F series and would like to see it posted on the source code pages at piclist.com
>
> Not sure how to do it so if anyone can do the honours it would be most appreciated.
>
> Thanks
> Dom
>
> 16 bit binary to BCD for 18F series based on code already on Piclist.com
>
>
> Convert:
>
> SWAPF NumH,W
> IORLW B'11110000'
> MOVWF Thou
> ADDWF Thou,F
> ADDLW 0xE2
> MOVWF Hund
> ADDLW 0x32
> MOVWF Ones
>
> MOVF NumH,W
> ANDLW 0x0F
> ADDWF Hund,F
> ADDWF Hund,F
> ADDWF Ones,F
> ADDLW 0xE9
> MOVWF Tens
> ADDWF Tens,F
> ADDWF Tens,F
>
> SWAPF NumL,W
> ANDLW 0x0F
> ADDWF Tens,F
> ADDWF Ones,F
>
> RLCF Tens,F
> RLCF Ones,F
> COMF Ones,F
> RLCF Ones,F
>
> MOVF NumL,W
> ANDLW 0x0F
> ADDWF Ones,F
> RLCF Thou,F
>
> MOVLW 0x07
> MOVWF TenK
> MOVLW 0x0A
> Lb1:
> DECF Tens,F
> ADDWF Ones,F
> BTFSS STATUS,0
> GOTO Lb1
> Lb2:
> DECF Hund,F
> ADDWF Tens,F
> BTFSS STATUS,0
> GOTO Lb2
> Lb3:
> DECF Thou,F
> ADDWF Hund,F
> BTFSS STATUS,0
> GOTO Lb3
> Lb4:
> DECF TenK,F
> ADDWF Thou,F
> BTFSS STATUS,0
> GOTO Lb4
> -