please dont rip this site

SX Microcontroller Radix Math Method

Binary to BCD packed 8 bit to 2 digit

From: Ken Mathis

;Purpose: Convert an 8 bit number to BCD
;so value can be sent to a 7447 seven segment display driver
;I/O pin hungry, requires 8 bits to send data out.
;temp1 holds binary value
;BCD result in temp1
;$32 (50 decimal) becomes or %01010000
hex_to_bcd
	clr		temp0	;clear register
convert
	inc		temp0	;increment number of 10’s
	mov		w,#$0A	
	sub		temp1,w	;subtract 10 from temp1
	snc			;skip next instruction if underflow occurs
	jmp		convert	;repeat
	mov		w,#$A		
	add		temp1,w	;restore temp1. number of 1’s after restored
	dec		temp0	;correction to the number of 10’s
	swap		temp0	;swap upper and lower nibble of temp0
	add		temp1,temp0	;place number of 10’s in upper nibble of temp1
	ret				;temp1 now hold BCD value of $32

Questions:


file: /Techref/scenix/lib/math/radix/b2b-8b2d_sx.htm, 1KB, , updated: 2006/5/2 08:59, local time: 2024/12/26 16:15,
TOP NEW HELP FIND: 
3.15.223.129:LOG IN

 ©2024 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://massmind.org/Techref/scenix/lib/math/radix/b2b-8b2d_sx.htm"> SX Microcontroller Radix Math Method Binary to BCD packed 8 bit to 2 digit</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 a nice message (short messages are blocked as spam) 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?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .