4bit-ASCIIHex: ;***** UNTESTED!!! mov temp, w ;save the value mov w, #-09 add w, temp ;compare temp with 9 mov w, #'A' ;assume it will be more (no change to compare flags) snc ;if it was less mov w, #'0' ;correct the offset add w, temp ;add the offset to the value retSee: Compareing values in the "X < Y" section "fr < n" subsection for an explination of how the comparison works. For 8 bits you have to call that twice:
8bit-ASCIIHex: ;***** UNTESTED!!! mov w, <>byte ;w is byte with upper and lower nibbles reversed and w, #15 ;mask off the upper (was lower) 4 bits call 4bit-ASCIIHex ;convert that nibble to ASCII Hex call Output ;and send it off to where ever mov w, byte ;now get the actual value and w, #15 ;mask off the upper (really) 4 bits call 4bit-ASCIIHex ;convert this nibble to ASCII Hex call Output ;and send it off.
file: /Techref/scenix/lib/math/radix/b2a-4b1ah-jn.htm, 1KB, , updated: 2004/6/10 14:40, local time: 2024/9/1 00:39,
18.188.172.203: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://piclist.com/techref/scenix/lib/math/radix/b2a-4b1ah-jn.htm"> SX Microcontroller Radix Math Method - Binary to BCD half-packed 8 bit to 3 digit</A> |
Did you find what you needed? |
![]() 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. |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.