Sorry, I didn't mean to mislead about the 'leading zeros. I was just referring to the fact that for the sake of brevity I didn't list the first 20 or so previous additions of 0+0+carry of zero. Mike Jones. ----- Original Message ----- From: "Ray Gallant" To: Sent: Sunday, February 02, 2003 7:49 PM Subject: Re: [PIC]: Binary to Packed BCD Conversion Problem > ----- Original Message ----- > From: "Jon M (Mike) Jones" > To: > Sent: Monday, February 03, 2003 11:41 PM > Subject: Re: [PIC]: Binary to Packed BCD Conversion Problem > > > > A little more information; > > > > The following are examples of two binary to BCD conversions with the left > > column > > showing what the intermediate results should be and the right column > showing > > what the observed intermediate results were. (Leading additions of zeros > > ignored.) > > I haven't thought of a way to dig any deeper with my very limited debug > > tools but my > > first impression is that DAW isn't always generating a carry when I think > it > > should. > > > > for 0x2FF > > 1 1 > > 2 2 > > 5 5 > > 11 11 > > 23 23 > > 47 47 > > 95 95 > > 191 91 > > 383 83 > > 767 67 > > Fails to add and/or convert (daw) 95+95+1 correctly > > > > for 0x8FF > > 1 1 > > 2 2 > > 4 4 > > 8 8 > > 17 17 > > 35 35 > > 71 71 > > 143 143 > > 287 287 > > 575 475 > > 1151 951 > > 2303 1903 > > Fails to add and/or convert (daw) 287+287+1 correctly > > > > Mike Jones > > > > ----- Original Message ----- > > From: "Bob Ammerman" > > To: > > Sent: Monday, February 03, 2003 4:35 AM > > Subject: Re: [PIC]: Binary to Packed BCD Conversion Problem > > > > > > > Jon, > > > > > > Very interesting. I'll take a look at this when I get a chance. > Hopefully > > in > > > the next day or so. > > > > > > Bob Ammmerman > > > RAm Systems > > > > I have some code in assembler released for a 16C74 as part of a glass LCD > project which is a conversion to 5 digit BCD. I believe the leading zeros > where taken care of in different routing (printing to LCD) Good Luck. > {slewrate} > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.