; Input - ASCII number in x ; Output - binary in x mov W, #-'A'+10 sb x.6 mov W, #-'0' add x, W
ASCII numbers '0'-'9' have codes 48-57, and 'A'-'F' have codes 65-70. The second group differs from the first one by a value of bit 6. To map '0'-'9' to 0-9 we need to substract '0' (if bit 6 is clear), and to map 'A'-'F' to 10-15 we substract 'A' and add 10 (if bit 6 is set).
Comments:
file: /Techref/scenix/lib/math/radix/ah2b-1d4b_sx.htm, 0KB, , updated: 2004/6/10 13:40, local time: 2024/11/25 03:52,
18.222.20.250:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/techref/scenix/lib/math/radix/ah2b-1d4b_sx.htm"> PIC Microcontroller Radix Math Methods ASCII Hex to Binary</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.