piclist 2001\01\19\172234a >
Thread: Maths Problem
face BY : Kübek Tonyemail (remove spam text)


Philip Martin wrote:

>I have got a routine to convert 16 or 24 bit to BCD and that works
fine. But
>what I need is a routine to convert BCD to 16 bit, does anyone know the
>location of such a routine or, how best to go about this.

Well there is a very easy way ( albeit fairly slow :) ) ( I'm using
it as I get digit by digit entered on keyboard ( and user input
tend to be slow if compared to pic-speed :) ) Anyway here goes:
In the case of a 24 bit variable 'allocate' 3 bytes of data
clear them. Add the left mostdigit, multiply by 10 add the next
digit etc. etc. *very* easy albeit slow as said.
24bit*10 can be generated by the code generator.
There are faster way to do this but sofar I haven't had the need for
such an routine.


Tony Kübek, Flintab AB            
E-mail: spamBeGonetony.kubek.....spamspam_OUTflintab.com

http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

<200101192220.XAA21419@mn10.swip.net> quoted-printable

See also: www.piclist.com/techref/microchip/math/index.htm?key=math
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Maths Problem

month overview.

new search...