Searching \ for '[Fwd: PIC Problem URGENT !!!]' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'PIC Problem URGENT !!!]'.

Exact match. Not showing close matches.
PICList Thread
'[Fwd: PIC Problem URGENT !!!]'
1999\04\08@192302 by Regulus Berdin

picon face
part 0 4170 bytes content-type:text/plain; charset=us-ascii (decoded 7bit)

This was sent to me personnaly and answered it.  I find it helpful to
anybody in the list who have similar problem, so I forwarded it here.

regards,
Reggie

--
e-mail: spam_OUTrberdinTakeThisOuTspambigfoot.com
ICQ#:   31651436
URL:    http://www.bigfoot.com/~rberdin
X-Mozilla-Status2: 00000000
Message-ID: <.....370D34C1.8BBF6DCKILLspamspam@spam@bigfoot.com>
Date: Fri, 09 Apr 1999 06:59:13 +0800
From: Regulus Berdin <rberdinspamKILLspambigfoot.com>
Organization: Euro-CB (Philippines), Inc.
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: Marco Heid <.....maheidKILLspamspam.....primus-online.de>
Subject: Re: PIC Problem URGENT !!!
References: <000201be8203$c08afec0$EraseME01fea8c0spam_OUTspamTakeThisOuTmaheid.metronet.de>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi Marco,

> Marco Heid wrote:
>
> Hi, my name is Marco and i have a VERY urgent problem. I have a 32 bit
> binary
> to convert in bcd digits (5 registers). Do u have a routine ready ? I
> tried a routine
> from the pic Archive but i have now packed (?) bcd.

First of all 32 bits binary will not fit in a 5 register unpacked bcd.
You need 10 registers to store the unpacked result.

To convert 32bit binary to packed bcd use this:
;**********************************************************************
; bin2bcd - binary to bcd conversion, using bcd divide by 2 (32 bits)
; input  -> num1:num2:num3:num4 (msb:lsb)
; output -> bcd1,bcd2,bcd3:bcd4:bcd5 (msb:lsb)
;
; uses: tmp
;

bin2bcd:
       movlw   .32             ;process 32 bits
       movwf   tmp             ;
       clrf    bcd1            ;zero bcd digits
       clrf    bcd2            ;
       clrf    bcd3            ;
       clrf    bcd4            ;
       clrf    bcd5            ;
       goto    b2b0            ;

badj:   movlw   0x33
       addwf   bcd1
       addwf   bcd2
       addwf   bcd3
       addwf   bcd4
       addwf   bcd5

       movlw   0x03
       btfss   bcd1,3
        subwf  bcd1
       btfss   bcd2,3
        subwf  bcd2
       btfss   bcd3,3
        subwf  bcd3
       btfss   bcd4,3
        subwf  bcd4
       btfss   bcd5,3
        subwf  bcd5

       movlw   0x30
       btfss   bcd1,7
        subwf  bcd1
       btfss   bcd2,7
        subwf  bcd2
       btfss   bcd3,7
        subwf  bcd3
       btfss   bcd4,7
        subwf  bcd4
       btfss   bcd5,7
        subwf  bcd5

b2b0    rlf     num2
       rlf     num1
       rlf     bcd5
       rlf     bcd4
       rlf     bcd3
       rlf     bcd2
       rlf     bcd1
       decfsz  tmp
        goto   badj
       return

> Instead of 42 94 96 72 95 in my registers i have
> now 99 06 58 04 80 in my regissters. Is this packed bcd, and if so,
> how can i unpack it to regular bcd ?

That is not packed.  For example: the is number 1234567890 (hex
0x499602D2), packed BCD = 0x12 0x34 0x56 0x78 0x90 while unpacked is bcd
= 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00.

To unpack the packed bcd:

; input - bcd1:bcd2:bcd3:bcd4:bcd5 (msb:lsb)
; output - bcd1:....:bcd10 (msb:lsb)

       movf    bcd5,w
       movwf   bcd10
       swapf   bcd5,w
       movwf   bcd9

       movf    bcd4,w
       movwf   bcd8
       swapf   bcd4,w
       movwf   bcd7

       movf    bcd3,w
       movwf   bcd6
       swapf   bcd3,w
       movwf   bcd5

       movf    bcd2,w
       movwf   bcd4
       swapf   bcd2,w
       movwf   bcd3

       movf    bcd1,w
       movwf   bcd2
       swapf   bcd,f

       movlw   0x0f
       andwf   bcd1,f
       andwf   bcd2,f
       andwf   bcd3,f
       andwf   bcd4,f
       andwf   bcd5,f
       andwf   bcd6,f
       andwf   bcd7,f
       andwf   bcd8,f
       andwf   bcd9,f
       andwf   bcd10,f

> Please excuse my bad english, and i need a routine VERY FAST, PLEASE.
>
> P.S. I sent u the same as icq-letter, because it is REALLY urgent.
> my emailadress:  marco.heidspamspam_OUTrhein-main.net
> ICQ#: 21479287

Your english is just fine, I'm also not a native english speaker.

regards,
Reggie

--
e-mail: @spam@rberdinKILLspamspambigfoot.com
ICQ#:   31651436
URL:    http://www.bigfoot.com/~rberdin

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