www.piclist.com/techref/microchip/devices.htm?key=16F

> ...I have an 8bit number, only ranging 99 >= N >= 0 so it will only

> be 2 digits. I need to find a way to output it to my LCD...

Not sure this will help, but just in case...

pseudo-code for what you want to do:

lcd_digit1 = a2d_result / 10

lcd_digit2 = a2d_result - (lcd_digit1 * 10)

in you're working in C, this is trivial.

in asm, multiply by 10 is simple (x*8) + (x*2), but divide by 10 is not so

simple.

There is a lot of stuff in the source code section of piclist.com for

basic multiplying and dividing, and (under conversions) all kinds of clever

stuff for converting binary to decimal, which is really what you want to

do. If you're not familiar with this type of stuff, 'BCD' means binary

coded decimal, and just means each byte of the result contains a digit of

the input number.

For example, if the input is one byte, say B9h (185 decimal), the output

bytes will be 01, 08, 05. 'BCD packed' just means each digit is stored

in a nibble, so there are two digits per byte (because the range for the

digits is 0-9, and a nibble - 4 bits - can hold 0-15). You can grab the

digit in the upper nibble via 'swapf' or dividing by 16.

--

http://www.piclist.com hint: PICList Posts must start with ONE topic:

[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

See also: www.piclist.com/techref/microchip/devices.htm?key=16F