; 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 14:40, local time: 2024/9/30 12:39,
18.217.246.148:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©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://piclist.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? |
PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to piclist.com! |
.