??? 07/02/09 17:58 Read: times |
#166671 - School work? Responding to: ???'s previous message |
1) This forum is named www.8052.com. Would you then say that "8051" is a descriptive subject for your post? Any reason why you did not think of "lookup table", "hex number conversion" or similar when writing the subject?
2) You say that A stores a hex number. A can only store values between 0 and 255 inclusive, when expressed in decimal. But it doesn't matter if you express the values in binary or hexadecimal or octal or any other number base. A still only stores a number, and "hexadecimal" is still just a way of presenting that number. So is your "hex number" just 0x00 .. 0xff, or did you mean an hex digit in ASCII, i.e. '0'..'9', 'A'..'F' (and possibly 'a'..'f')? If the last, then you don't need two registers for the output, since the largest BCD-encoded output would be 0x15. 3) If A takes any value 0..255, are you really in need of a lookup table to convert to BCD? A lookup table can be fast, but in this case, hardly any 8-bit C runtime library implementation would bother with a lookup table - most would use a loop, which would allow much larger numbers to be converted without the lookup table exploding in size. A binary loop would require one iteration for each bit of the input number. Does you have a school exercise specifically requiring a lookup table? |
Topic | Author | Date |
8051 | 01/01/70 00:00 | |
School work? | 01/01/70 00:00 | |
I know you mean well Per | 01/01/70 00:00 | |
Okay, ... | 01/01/70 00:00 | |
Read, read, read... | 01/01/70 00:00 | |
cross-posting | 01/01/70 00:00 | |
Why wait for last day? | 01/01/70 00:00 | |
Obvious homework... | 01/01/70 00:00 |