Searching \ for '[PIC] How do I get some code listed on the Piclist' 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: 'How do I get some code listed on the Piclist'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] How do I get some code listed on the Piclist'
2008\08\12@174135 by Picbits Sales

flavicon
face
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

2008\08\12@175610 by olin piclist

face picon face
Picbits Sales wrote:
> Not sure how to do it so if anyone can do the honours it would be
> most appreciated.

Considering there is not a single comment in sight, I personally don't think
this code should be posted anywhere.  Undocumented code is worse than no
code in that it gives the impression not writing meaningful comments is
somehow acceptable.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2008\08\12@182645 by Picbits Sales

flavicon
face
Unfortunately I didn't write the code, I grabbed it from somewhere else then
spent a while trying to work out why it wouldn't work on the 18F under
simulation while it worked fine on a 16F under simulation.

Just thought I'd save the next person who needs to do this conversion a bit
of messing about.

I based the code on the code from here:

http://www.dattalo.com/technical/software/pic/bcd.txt

This was referenced from a piclist.com page.

It doesn't really bother me if it makes it onto piclist.com or not - just
thought it would be nice to share. :-P

Dom
{Original Message removed}

2008\08\12@184629 by olin piclist

face picon face
Picbits Sales wrote:
> Unfortunately I didn't write the code, I grabbed it from somewhere
> else then spent a while trying to work out why it wouldn't work on
> the 18F under simulation while it worked fine on a 16F under
> simulation.

And you didn't document it in the process?  Seems like you'd want to just to
keep track of what you figured out for your own purposes.

> Just thought I'd save the next person who needs to do this conversion
> a bit of messing about.

It probably wouldn't save much of anything since they'd have to reverse
engineer your version just like you had to the original version.  And do you
really want your name out there admitting you're the one that wrote a bunch
of uncommented code?


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2008\08\13@005032 by M. Adam Davis

face picon face
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_OUTsalesTakeThisOuTspampicbits.co.uk> wrote:
{Quote hidden}

> -

2008\08\13@185854 by Scott Dattalo

face
flavicon
face
Picbits Sales wrote:
> I based the code on the code from here:
>
> http://www.dattalo.com/technical/software/pic/bcd.txt


John Payson wrote the code, and I documented how it worked at the bottom
of the web page cited above. You might can appease Olin by including my
documentation.

Scott


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