Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat


General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion?

Reply
 
LinkBack Thread Tools Display Modes
Old 8th May 2006, 01:06 AM   (permalink)
Default carry and digit carry definition

hello
i am very new to electronics and learning , so excuse my stupid questions from now and then.
can anyone please explain what is carry and what is digit carry (not the flags the math itself)

thanks
max_imum2000 is offline  
Old 8th May 2006, 01:16 AM   (permalink)
Default

I'm sorry. Im not quite sure what you are asking. Do you mean:

the carry is the bit gets set (=1) whenever two single-digits add up to be too large?

ie. in the decimal system (with digits 0,1,2,3,4,5,6,7,8,9). if you add 9+2 by hand, 9+2 > 9(the largest digit) and so a carry would occur producing a 2-digit number 11 (where the leftmost 1 is the result of the carry, since the adding the numbers in the "ones" position caused it too be too big it had to "carry" over to a "tens" digit.

or in binary (with digits 0,1): a 1+1 operation is bigger than the largest digit available (a 1) and a carry would occur producing an answer of 10

Last edited by dknguyen; 8th May 2006 at 01:19 AM.
dknguyen is offline  
Old 8th May 2006, 03:00 AM   (permalink)
Default

The digit carry is a bit that can be used when the two low order nibbles of a byte add up to more than 15 which is the largest value that can fit in four bits. The uses for this bit are probably as rare as hen's teeth.
Papabravo is offline  
Old 8th May 2006, 08:08 AM   (permalink)
Default

So a carry bit represents when there is an overflow for a digit into the next order of magnitude....and a digital carry represents an overflow nibbles?
dknguyen is offline  
Old 8th May 2006, 09:55 AM   (permalink)
Default

C -> 8th bit Overflow
DC -> 4th bit Overflow
__________________
Gods own Country
Incredible !ndia

www.flickr.com/photos/_akg/

"Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime."
akg is offline  
Old 8th May 2006, 10:00 AM   (permalink)
Default

Quote:
Originally Posted by Papabravo
The digit carry is a bit that can be used when the two low order nibbles of a byte add up to more than 15 which is the largest value that can fit in four bits. The uses for this bit are probably as rare as hen's teeth.
Hi Papa Bravo,

I can think of a couple 'common' uses for the DC bit...

Regards, Mike

Code:
;
;  increment packed-bcd CLK data in CLKSEC, CLKMIN, and CLKHRS
;  once per second
;
ISR_CLK	
	incf	CLKSEC,f	; increment seconds [00..59]	  |B0
	movf	CLKSEC,W	;				  |B0
	addlw	h'06'		; lo nybble < 10 ?		  |B0
	bndc	ISR_ALM		; yes, branch			  |B0
	movwf	CLKSEC		; else update			  |B0
	xorlw	h'60'		; is it < 60?			  |B0
	bnz	ISR_ALM		; yes, branch			  |B0
	movwf	CLKSEC		; else, reset sec to '00' and	  |B0
	incf	CLKMIN,f	; increment minutes [00..59]	  |B0
	movf	CLKMIN,W	;				  |B0
	addlw	h'06'		; lo nybble < 10?		  |B0
	bndc	ISR_ALM		; yes, branch			  |B0
	movwf	CLKMIN		; else update			  |B0
	xorlw	h'60'		; is it < 60?			  |B0
	bnz	ISR_ALM		; yes, branch			  |B0
	movwf	CLKMIN		; else, reset min to '00' and	  |B0
	incf	CLKHRS,f	; increment hours [00..23]	  |B0
	movf	CLKHRS,W	;				  |B0
	addlw	h'06'		; lo nybble < 10?		  |B0
	skpndc			; yes, skip			  |B0
	movwf	CLKHRS		; else update			  |B0
	xorlw	h'24'+6		; not '24'?			  |B0
	bnz	ISR_ALM		; yes, branch			  |B0
	movwf	CLKHRS		; else, reset hrs to '00' and	  |B0
Code:
;
;  Print byte in W as two ASCII nybbles
;
PutByte movwf   TEMP            ; save byte                       |B0
        swapf	TEMP,W		; swap nibbles in W		  |B0
	call	Hex2Asc		; process left nibble		  |B0
	movf	TEMP,W		; process right nibble		  |B0
Hex2Asc	andlw	b'00001111'	; mask off left nibble		  |B0
	addlw	h'36'		;				  |B0
	btfsc	STATUS,DC	;				  |B0
	addlw	h'07'		;				  |B0
	addlw	0-6		; ($FA)				  |B0
	goto	Put232		; print ASCII nibble		  |B0
Mike, K8LH is offline  
Old 8th May 2006, 05:40 PM   (permalink)
Default

I had a feeling that if I offered a personal observation on the subject of Digit Carry that applications would show up as if by magic. Thanks for a most ejoyable code read. It's just like a jigsaw puzzle.

ROFL
Papabravo is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 09:49 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

eXTReMe Tracker