ON 20061114@1:09:44 PM at page: http://piclist.org/techref/microchip/math/radix/ah2b-1d4b.htm#39035.5484259259 Peter Heinrich[pCH-saphum-R93] Says
;;  Converts an ASCII character code (in W) into the integer value
;;  corresponding to the hexadecimal digit it represents.  '0'-'9'
;;  become 0x0-0x9; 'A'-'F' and 'a'-'f' become 0xa-0xf.  (This routine
;;  expects W to contain only valid hexadecimal digits.)  The result
;;  is returned in place in W.
;;
char2int:
   ; Shift the character.
   addlw    0x9f
   bnn      adjust               ; if positive, character was 'a' to 'f'
   addlw    0x20                 ; otherwise, shift to next range of digits
   bnn      adjust               ; if now positive, character was 'A' to 'F'
   addlw    0x7                  ; otherwise, character must have been '0' to '9'

adjust:
   addlw    0xa                  ; shift the result to account for the alpha offset
   andlw    0xf                  ; clamp the value to one nybble
   return




ON 20061120@7:59:15 PM at page:
http://www.piclist.com/microchip/math/radix/b2a-16b3a-ng.htm#39041.3919907407
James Newton[JMN-EFP-786] published post 39041.3919907407


 
I tested the code on my 16F84 and it wasn´t working... I checked it and the problem was that my default RADIX was HEX.
So I specified the radix for all the literals in the code, then it worked.
change from --> change to
addlw 241 --> addlw d'241'
addlw 253 --> addlw d'253'
sublw 251 --> sublw d'251'
movlw 10 --> movlw d'10'





|Delete 'P-' before: '' but after: '