Well... yes, I'm doing the way as you suggest, but.... perhaps I'm not clever enough. I'll keep on trying. Paul Tsai / Taipei ----- Original Message ----- From: "Mauricio Jancic" To: Sent: Sunday, June 01, 2003 9:43 PM Subject: Re: [PIC]: Binary to BCD conversion > Why don't you try writing down the secuence and try it with an example. > Translate the mnemonics into math and you'll see appear the > explanation.. > > Mauricio Jancic > Janso Desarrollos > (54) 11 4542 3519 > Republica Argentina > Microchip Consultant Program Member > > > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of M. Adam Davis > Sent: Domingo, 01 de Junio de 2003 10:40 > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Binary to BCD conversion > > > Unfortunately I don't have the time to analyse and understand the > algorithm right now, perhaps someone else on this list who has already > done so could chime in here... > > -Adam > > Morgenbrise Ent. Co., Ltd. wrote: > > >Thank you Adam, > > > >Now I fully understand, the program was nothing wrong. Your explain is > >very clear, thanks a lot! > > > >Would you mind help me regarding how the algorithm works? I'm willing > >to understand "why shifting left & add 3, check if bigger than 7, add 3 > > >or skip..." Some books I found from stores list the program & explain > >not more than what was in AN526. > > > >Regards > > > >Paul Tsai / Taipei > >Morgenbrise > > > > > > > >----- Original Message ----- > >From: "M. Adam Davis" > >To: > >Sent: Friday, May 30, 2003 8:58 PM > >Subject: Re: [PIC]: Binary to BCD conversion > > > > > > > > > >>BCD is binary coded decimal. This means that there is one decimal > >>number every four bits. > >> > >>Your 06 is binary 0000 0110, which means that there is a 0 in the top > >>four bits, and a 6 in the bottom four. > >> > >>The 85 is binary 0101 0101, which is 5 and 5 > >>The 53 is binary 0011 0101, which is 3 and 5 > >> > >>If you look at the numbers in hexadecimal they come out to > >>06 55 35 > >> > >>The reason many people use BCD is that it's then easy to look at each > >>four bits and output them to a display or another chip which displays > >>things in BCD. Calculations in BCD are not very difficult either. > >> > >>-Adam > >> > >>Tan Chun Chiek wrote: > >> > >> > >> > >>>Added the PIC tag. > >>> > >>>I remembered running this snippet few days ago and the result wasn't > >>>anything like that. Did you copy the source from the PDF? Have you > >>>tried the source from the > >>> > >>> > >ZIP > > > > > >>>file accompanying the AN? > >>> > >>>Tan CC > >>> > >>>----- Original Message ----- > >>>From: "Morgenbrise Ent. Co., Ltd." > >>>To: > >>>Sent: Friday, May 30, 2003 11:36 AM > >>>Subject: Binary to BCD conversion > >>> > >>> > >>>As a novice, I studied the "AN-526". Tried to run the program > >>>"Appendix > >>> > >>> > >H: > > > > > >>>Binary (16bit) to BCD". > >>> > >>>However, the result in R0, R1, R2 become 06,85,53 in stead of > >>>06,55,35 > >>> > >>> > >when > > > > > >>>converting the number B'11111111' in both H_byte & L_byte. > >>> > >>>I traced every step but can't find where is the problem? > >>> > >>>Not yet understand the algorithm of such a conversion, my first step > >>>is > >>> > >>> > >to > > > > > >>>follow the codes; even so the result is not correct. > >>> > >>>The sample routine was publilshed many years ago, there must be many > >>> > >>> > >people > > > > > >>>ever study it. I would appreciate if someone hints me the blind > >>>point(s) where I stuck? > >>> > >>>Regards > >>> > >>>Paul Tsai > >>> > >>>-- > >>>http://www.piclist.com hint: The PICList is archived three different > >>>ways. See http://www.piclist.com/#archives for details. > >>> > >>>-- > >>>http://www.piclist.com#nomail Going offline? Don't AutoReply us! > >>>email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>-- > >>http://www.piclist.com#nomail Going offline? Don't AutoReply us! email > > >>listserv@mitvma.mit.edu with SET PICList DIGEST in the body > >> > >> > > > >-- > >http://www.piclist.com#nomail Going offline? Don't AutoReply us! email > >listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > > > > > > > > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads