ON 20040416@10:31:15 AM at page: http://www.massmind.org/techref/scenix/lib/math/radix/b2b-8b3d_sx.htm# James Newton[JMN-EFP-786] edited the page. Difference: http://www.massmind.org/techref/diff.asp?url=H:\techref\scenix\lib\math\radix\b2b-8b3d_sx.htm&version=0 ON 20040416@10:31:43 AM at page: http://www.massmind.org/techref/scenix/lib/math/radix/index_sx.htm#37833.5322569444 James Newton[JMN-EFP-786] published post 37833.5322569444
;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
|Delete 'P-' before: '' but after: 'wunnerful1@cox.net asks:
hehe, I see my code was posted (8bit to BCD unpacked 3 digits)
and it's nice for the ego trip, but I converted from an old
listing I found for the 8031 (I thought I mentioned that in
the posting?). There is nothing new under the sun, and the old
saying that 95% of all code is just borrowed is true.

I had originally registered as I believe,as wunnerful2@qwest.net
but don't quote me. I was in a war with screwest.net before
they sold themselves to msn, and lost (royally trashed with
dsl, and my dedicated modem at the CO being redirected to the
highest paying INC!). Yeah I know, I'm whining and should get to the point- hehee, I don't remember my log in password,
and to boot, which of the last 2 or 3 email addresses I used
to log in with (wunnerful1@cox.net presently).

If you need more info, let me know. Haven't used the SX for
a project for the last few years (the one using the posted
code was for a 16x2 readoutof oil pressure, water temp ect.
for a GL1500). Thinking about doing a fuel injection system
for an old Harley shovelhead, since the SX is fast enough
to do the job...just wondering about external mem addressing,
since internal mem can't hold the type of map required for
such.

Eric Swendson
ON 20040416@10:36:55 AM at page: http://www.massmind.org/techref/scenix/lib/math/radix/b2b-8b3d_sx.htm# James Newton[JMN-EFP-786] edited the page. Difference: http://www.massmind.org/techref/diff.asp?url=H:\techref\scenix\lib\math\radix\b2b-8b3d_sx.htm&version=4