Date sent: Thu, 11 Jan 2001 09:22:13 -0500 Send reply to: pic microcontroller discussion list From: Drew Vassallo Subject: [PIC]: hex2dec revisited To: PICLIST@MITVMA.MIT.EDU > I posted this a while ago - with no response. I feel that it's worth > looking into, though, especially for Scott. I don't think I made any errors > in my translation. > > >Scott (and anyone else), > > > >The hex2dec ascii routine at > >http://204.210.50.240/techref/microchip/math/radix/b2a-16b5a-rl.htm > > > >Seems to be tough to get working. I changed instances of the "skp" command > >to "goto $+2" and have a known zero value. > > > >I resolved the "movlw 10000 & 255" to "movlw 0x10" and the "sublw > >(10000>>8)+1" to "movlw 0x28". Also, changed the "movlw 1000 & 255" to > >"movlw 0xE8" and the "addlw 1000>>8" to "addlw 0x03". I believe these are > >correct. > > > >However, when I get to the "add1K" section, it runs through quicker than it > >should and gives me useless values for the hundreds, tens, and ones. > > > >Has anyone noticed this? Yes. and i'm nowhere near skilled enough to fix it, so i used instead: http://204.210.50.240/techref/microchip/math/radix/b2bu-16b5d.htm and had it up and running in minutes. alice -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu