Hey Bob, How about: addlw 0x0C0 ; Set Carry if 0x041-0x046 ("A" to "F") btfss STATUS, C addlw 7 ; If Carry Not Set, 0x030-0x039 ("0" to "9") ; To Offset from A-F to 0-9 addlw 9 ; Value is now 0-F This, of course, assumes that the input value (in "w") is "0" to "9" or "A" to "F". I'll add this to my "PICMicro" Snippets page. myke -----Original Message----- From: Bob Blick To: PICLIST@MITVMA.MIT.EDU Date: Friday, May 28, 1999 5:48 PM Subject: ascii hex to binary >Does anyone have a nice code snippet that takes a byte containing a hex >character (0x30 through 0x39 and 0x41 through 0x46) and converting it to a >plain numeric byte, 0x00 through 0x0F? Everything that comes to mind seems >wasteful and clunky. > >The character coming in may also contain junk that must be filtered out. > >Thanks! > >Happy long weekend if you get one. Cheers, >Bob >