please dont rip this site

PIC Microcontoller Radix Math Method

10bit to BCD unpacked 4 digit in 38 inst ~88 cycles by E. A. Grens

10 bit Binary to BCD Conversion

Posted on the Chat Zone by Ed Grens on September 22, 2004 at 03 08 38

On 18 September Peter Hemsley posted a 12b binary to BCD conversion subroutine in a response to a post by me. His algorithm is excellent for 12b conversion, but not efficient for the 10b often encountered with A/D inputs. Over the 10b data range, 0x000 to 0x3FF, this routine requires on the average of 131 processor cycles. Actually this is more than it requires on the average over the entire 12b range (118 cycles).

A simple divide by power of ten algorithm, listed below, requires on the average 88 cycles over the 10b range. This is possible because, for 10b, one can use single byte subtractions for divides. At 12b (probably) and certainly at 16b this approach cannot compete with the procedure Peter has presented. But, if 10b is what you need, it can be advantageous.

Ed +

Code:

See also:

Comments:

Michael Lee Van Dyke Says:

On the 10 bit code, the 9th instruction after the Bin2decg label is is "goto B2d2". There is no B2d2 label in the code, it will not work as it is written here.
+

Questions:


file: /Techref/microchip/math/radix/b2bu-10b4d-eag.htm, 7KB, , updated: 2011/2/21 18:04, local time: 2017/11/24 20:17, owner: JMN-EFP-786,
TOP NEW HELP FIND: 
54.161.108.158:LOG IN

 ©2017 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF="http://www.piclist.com/techref/microchip/math/radix/b2bu-10b4d-eag.htm"> 10bit to BCD unpacked 4 digit in 38 inst ~88 cycles by E. A. Grens</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2017 contributors:
o List host: MIT, Site host massmind.org, Top posters @20171124 RussellMc, Van Horn, David, James Cameron, Sean Breheny, alan.b.pearce, IVP, Neil, David C Brown, Bob Blick, Denny Esterline,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .