Now I get 0.8E in place of 0.DB some improvement required though is 0.85
R Thread Starter RG23 Joined Dec 6, 2010 304 Jul 1, 2011 #41 Now I get 0.8E in place of 0.DB some improvement required though is 0.85
MrChips Joined Oct 2, 2009 30,824 Jul 1, 2011 #42 Ok, this time multiply by 10 twice (ie. to multiply by 100) and display only the hi-byte as result. Tell me what you get!
Ok, this time multiply by 10 twice (ie. to multiply by 100) and display only the hi-byte as result. Tell me what you get!
R Thread Starter RG23 Joined Dec 6, 2010 304 Jul 1, 2011 #43 I did multiply by 100 too I get 0.8C now
MrChips Joined Oct 2, 2009 30,824 Jul 1, 2011 #44 Ok, let's back up for a minute so I can understand your system. Your hardware consists of two digits displaying hex after the decimal point? When you call bcd how can you get 8E or 8C displayed? If you pass 99d to call bcd what is displayed? If you pass 130d to call bcd what is displayed?
Ok, let's back up for a minute so I can understand your system. Your hardware consists of two digits displaying hex after the decimal point? When you call bcd how can you get 8E or 8C displayed? If you pass 99d to call bcd what is displayed? If you pass 130d to call bcd what is displayed?
R Thread Starter RG23 Joined Dec 6, 2010 304 Jul 1, 2011 #45 bcd subroutine only converts to ASCII format
MrChips Joined Oct 2, 2009 30,824 Jul 1, 2011 #46 Please answer the questions. Does your hardware consist of two digits displaying hex after the decimal point? If you pass 99d to call bcd what is displayed? If you pass 130d to call bcd what is displayed? (If you no longer need help please tell me. I can always call it quits.)
Please answer the questions. Does your hardware consist of two digits displaying hex after the decimal point? If you pass 99d to call bcd what is displayed? If you pass 130d to call bcd what is displayed? (If you no longer need help please tell me. I can always call it quits.)
R Thread Starter RG23 Joined Dec 6, 2010 304 Jul 1, 2011 #47 yes I display two digits displaying hex after the decimal point for d'99' I get 63 for d'130' I get 82
yes I display two digits displaying hex after the decimal point for d'99' I get 63 for d'130' I get 82
MrChips Joined Oct 2, 2009 30,824 Jul 1, 2011 #48 Now I get the picture. Here is the algorithm: Step 1 Multiply X_FracH by 10 (using 8 x 8 -> 16-bit result) Save the hi-byte only as say D1 (make sure you are saving the hi-byte only) Step2 Multiply X_FracH by 100 Save the hi-byte only as say D2 Step 3 Take D1 and multiply by 10 (only 8 x 8 -> 8-bit result required) Save single lo-byte only as say D10 Step 4 Subtract D10 from D2 and save this byte as D0. Step 5 Multiply D1 by 16 (simply shift left 4 bits - use single byte only) Step 6 Add D0 Step 7 call bcd over and out!
Now I get the picture. Here is the algorithm: Step 1 Multiply X_FracH by 10 (using 8 x 8 -> 16-bit result) Save the hi-byte only as say D1 (make sure you are saving the hi-byte only) Step2 Multiply X_FracH by 100 Save the hi-byte only as say D2 Step 3 Take D1 and multiply by 10 (only 8 x 8 -> 8-bit result required) Save single lo-byte only as say D10 Step 4 Subtract D10 from D2 and save this byte as D0. Step 5 Multiply D1 by 16 (simply shift left 4 bits - use single byte only) Step 6 Add D0 Step 7 call bcd over and out!
R Thread Starter RG23 Joined Dec 6, 2010 304 Jul 1, 2011 #49 i will try this approach and let you know Thanks for your opinion
MrChips Joined Oct 2, 2009 30,824 Jul 1, 2011 #50 Geez... This is not an opinion. This is the answer. You take a few months to get nowhere and I give you the answer in 15 mins... such gratitude! Last edited: Jul 1, 2011
Geez... This is not an opinion. This is the answer. You take a few months to get nowhere and I give you the answer in 15 mins... such gratitude!
R Thread Starter RG23 Joined Dec 6, 2010 304 Jul 5, 2011 #51 I tried by your method It gives the answer 21.B5 and not 21.85