Good morning.

I have recently resurrected an old project as a means of introducing myself to PBP3 and the PIC16F88. It is a scrolling marquee on a single 5x7 matrix LED; the characters are 5x5 and with some missteps, I am now able to display a static message quite satisfactorily. Yaye me!

To extend my knowledge, I determined to interface an LM34 temperature sensor as demonstrated here: http://www.rentron.com/PicBasic/LM34.htm. The project calls for a PIC16F677--the ADC setup is different, but therein lays the learning. Armed with the datasheet, I went to work… a reasonable period later, I felt I had adequate understanding to program some code.

While I may (or may not) have gotten the ADC configured properly, the real frustration is displaying the result! I had intended to use the [DEC] statement, [DIG], and some division to insert each digit into the string array for display, but [DEC RawT (the word variable holding the ADC result)] results in a “Bad expression” error. I had thought perhaps that my ADC result was indecipherable, but even setting RawT to a likely value does not change the result.

TL;DR:
Can someone with a better understanding demonstrate how a multi-digit word variable be converted to a single digit string format; i.e. RawT=754 --> MSG[x]= “7”, MSG[x+1]= “5”, MSG[x+2]= “4”? Also, seeing that I’ve impinged on your good nature already, can you verify my ADC configuration to read from AN0 on pin17, using a +Vref on AN3 (pin 2)?

Many thanks...

CONFIG:
#CONFIG
__config _CONFIG1, _INTRC_IO & _WDT_OFF & _PWRTE_OFF & _MCLR_ON & _BODEN_OFF & _LVP_OFF & _CPD_OFF & _WRT_PROTECT_OFF & _DEBUG_OFF
__config _CONFIG2, _FCMEN_OFF & _IESO_OFF
#ENDCONFIG

DEFINE OSC 8
OSCCON = %01110000
ANSEL = %00001001 'ANALOG OFF, EXCEPT +Vref AND AN3
TRISA = %0001001 'PORTS TO MATCH ANSEL
ADCON1.7 = 0 : ADCON1.6 = 0 : ADCON1.5 = 1 : ADCON1.4 = 0 'LEFT JUSTIFIED : ADCS2 DISABLED : VCFG Vref+ AVSS
ADCON0 = %01011001 'Fosc/8 : AN3 ACTIVE : ADON (BIT0) ADC ON
TRISB=0 'PORTB DIGITAL