To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 1850
1849  |  1851
Subject: 
Re: BCD
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Thu, 3 Apr 1997 02:53:32 GMT
Original-From: 
MAR ERICSON <mar@cooper.edu%SayNoToSpam%>
Viewed: 
1475 times
  
Yeah, it helps alot. Thanks.
I guess the half-cary is for adding to the next significant 4 bit word.
And the current word, including overflow, is then subtracted by ten
(1010), if the half-carry is flaged, to yield the proper BCD word.
Is this what happens? If so, does this create an extra cycle of execution?

-----------
ericson mar
Master of Engineering Candidate
Project: Mobile Robotics
mar@cooper.edu
(212)353-4356

Department of Mechanical Engineering
The Cooper Union for the Advancement of Science and Art
-------------------------------------------------------

On Wed, 2 Apr 1997, Rajesh Gottlieb wrote:


Does anyone know the details of how a BCD number is stored?
I'm unsure as to what a "half-carry" is in HC11 CCR.
It would be great if someone can provide a little example.  :)

As far as BSD goes; every decimal digit is represented by four binary
digits:

decimal   BCD
  0       0000
  1       0001
  2       0010
  3       0011
  4       0100
  5       0101
  6       0110
  7       0111
  8       1000
  9       1001

so that a number like 3725 would be represented by
0011 0111 0010 0101

I've never heard the term "half-carry" before, but it might be related to
the fact that you can't add two BCD's as if they were ordinary binary
numbers. For example if you were to perform to operation 3725 + 6 you
would get

  0011 0111 0010 0101
+ 0000 0000 0000 0110
_____________________
  0011 0111 0011 0001

Hope this helps

Rajesh






Message has 2 Replies:
  Re: BCD
 
Mar, The half carry (H) bit in the CCR sets if there is a carry from bit 3 to bit 4: in other words when there is a carry from the low hex digit to the high hex digit. Only the DAA instruction is affected by the state of H. For example: LDAA #$5A (...) (27 years ago, 3-Apr-97, to lugnet.robotics.handyboard)
  hbsonar
 
I am trying to run 4 sonar sensors from the HB, and I'm not sure how to go about doing this. I have a copy of the code from the ftp://cherupakha.med...ntrib/kent directory, but I'm pretty bad with assemby language and I'm not sure what I would need (...) (27 years ago, 19-Apr-97, to lugnet.robotics.handyboard)

Message is in Reply To:
  Re: BCD  [DAT]
 
(...) As far as BSD goes; every decimal digit is represented by four binary digits: decimal BCD 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 so that a number like 3725 would be represented by 0011 0111 0010 0101 I've never (...) (27 years ago, 2-Apr-97, to lugnet.robotics.handyboard)

6 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR