I definitely agree with Russell here. This was one of the first things I did on a Pic and I learned much more than if I had copied a routine from somewhere. A hint is to study the ASCII chart carefully because there are some shortcuts you can take based on how the ASCII codes are arranged. Lindy -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Russell McMahon Sent: Monday, April 11, 2005 16:47 To: Microcontroller discussion list - Public. Subject: Re: [PIC] : hex or binary to decimal > That is I have a value in hex and i want to transmit > it to a console but display it in decimal because > sometimes you get control characters etc and then you > don't see what you have unless you capture the data. > Did that make sense? > > example 0x32 = 50 and transmit a byte as "50", so need > to convert it over and also let it splill into another > byte if necessary. 0xFF = 02 55 so it would be > transmitted as 02 the 55. There are various ways of doing this "properly" or at least efficiently BUT I strongly suggest that you try doing it yourself first by whatever means you can think of as a learning exercise. Consider brute force for a start. __________________ If > 99 Subtract & count 100's until < 100 Report hundreds else 100's = 0 endif If > 9 subtract and counts 10's until < 10 report 10s else 10's = 0 endif Remainder = 1s Report 1's _________________________ There are better ways of doing this, but the day you make the above work by yourself you will feel very pleased AND have learned several useful things. RM -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist