We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear Experts, Need some quick reference code in assembly which are supremely compact in size wise (as size of code is a big constraint now, so assembly is also the last option) used to convert an incoming serial ASCII line of digits to hex codes for computation. Roughly 4 ASCII digits, e.g. in ASCII: (31h 32h 33h 34h) to be read as 1234dec OR 4D2hex. Appreciate some really good helping hands! Cheers, James
What's wrong with:
U16 total = 0; while (chars_to_process) { total = total * 10 + (getchar() & 0x0f); }
Thanks Drew! forgot that just by multiplying it by 10s and add them respectively will place the digits nicely by it's placement to create a hex digit. cheers, James