please dont rip this site

Atmel AVR Microcontroller Radix Conversions

Packed decimal to 32bit via input routine by http://elm-chan.org

;-----------------------------------------------------------------------------;
; Get value of Packed BCD (32 bit)
;
; Register Variables:
;
;  Call:   X      -> Packed BCD (big endian, right stored)
;          len    =  Number of BCD digits
;          var3:0 =  <Don't care>
;          tmp1:0 =  <Don't care> (high register must be assigned)
;
;  Result: var3:0 = 32 bit result
;
; Size:  28 words
; Clock: 687 * len + 3 cycles (+ret)
; Stack: 0 byte

get_pbcd:
		clr	var0		;var = 0;
		clr	var1		;
		clr	var2		;
		clr	var3		;/
					;--- decimal digit loop
		clr	tmp0		;var1 *= 10;
		ldi	tmp1, 33	;
		brcc	PC+2		;
		subi	tmp0,-10	;
		lsr	tmp0		;
		ror	var3		;
		ror	var2		;
		ror	var1		;
		ror	var0		;
		dec	tmp1		;
		brne	PC-8		;/
		ld	tmp0, X+	;Pick a decimal digit
		sbrc	len, 0		;
		rjmp	PC+3		;
		sbiw	XL, 1		;
		swap	tmp0		;
		andi	tmp0, 0x0f	;/
		add	var0, tmp0	;var += decimal digit;
		adc	var1, tmp1	;
		adc	var2, tmp1	;
		adc	var3, tmp1	;/
		dec	len		;while(--len != 0)
		brne	PC-22		;/
		ret





file: /Techref/atmel/avr/packed2bin32b-ec.htm, 1KB, , updated: 2007/9/14 17:44, local time: 2024/11/30 17:32,
TOP NEW HELP FIND: 
3.16.51.237: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://sxlist.com/TECHREF/atmel/avr/packed2bin32b-ec.htm"> Atmel AVR, atmega, Microcontroller, embedded controller, radix conversion, Packed Decimal to 32bit</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 sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .