help with debuging the ADC reading

hi guys…

i have written a code to enable the adc10 and trying to debug its reading.

how to see what are the actual readings…

i am trying to sprintf them to temp_rd buffer and trying to send them over the UART… but this is not working… if i just use

sprintf (temp_rd,“A%d %d %d %d\r\n”,1,2,3,4 );

i can see this on the uart but if i try to put the adc readings in it i cant see anything … can one pls help me…

thanks

-----------------------------code-----------------------------------------

void main( void )

{

unsigned int wait;

// Initalization

WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

// ???

InitOsc();

// ???

// configure the UART

P3SEL = 0x30; // P3.3,4 = USART0 TXD/RXD

ME2 |= UTXE0 + URXE0; // Enabled USART0 TXD/RXD

UCTL0 |= CHAR; // 8-bit character, SWRST=1

UTCTL0 |= SSEL0; // UCLK = ACLK

UBR00 = 0x03; // 9600 from 1Mhz

UBR10 = 0x00; //

UMCTL0 = 0x4A; // Modulation

UCTL0 &= ~SWRST; // Initialize USART state machine

IE2 |= URXIE0 + UTXIE0; // Enable USART0 RX/TX interrupt

IFG2 &= ~UTXIFG0; // Clear inital flag on POR

P1SEL = 0; //BIT4;

P2SEL = 0; //BIT0;

// Configure the LED Output (1 = output, 0 = input)

PDIR_LED |= LED; // Set port 2.0 to output

//POUT_LED &= ~LED;

// Configure Unconnected pins as Outputs

P1DIR = BIT4 ;

P2DIR = BIT0 ;

ADC10AE |= BIT7; // ADC option select A7

_BIS_SR( GIE);

while(1)

{

MeasureTemp(0);

if(tx_flg == 1)

{

tx_flg = 0;

//sprintf(temp_rd,“A%d %d %d %d\r\n”,1,2,3,4 );

i =0;

TXBUF0 = temp_rd[i++];

}

}

}

// UART0 TX ISR

#pragma vector=USART0TX_VECTOR

__interrupt void usart0_tx (void)

{

POUT_LED ^= LED;

if (temp_rd*)*
//TXBUF0 = string1[i++];
TXBUF0 = temp_rd[i++];
else
tx_flg =1;
}
// UART0 RX ISR
#pragma vector=USART0RX_VECTOR
__interrupt void usart0_rx (void)
{
POUT_LED ^= LED;
if (RXBUF0 == ‘u’) // ‘u’ received?
{
//i = 0;
//TXBUF0 = string1[i++];
//TXBUF0 = temp_rd[i++];
}
}
void MeasureTemp( unsigned char synch )
{
unsigned char i;
union UN_BYTE_WORD ByteWord;

ADC10CTL0 = SREF_1 | ADC10SR | REFOUT | ADC10SHT_2 | MSC | REF2_5V | REFON | ADC10ON | ADC10IE;
VoltageFlag = 1;

ADC10CTL1 = INCH3 | INCH1 | INCH0;
ADC10DTC1 = 0; // Disable Multiple Transfers
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & BUSY); // Wait if ADC10 core is active
ADC10CTL0 = SREF_1 | ADC10SR | REFOUT | ADC10SHT_2 | MSC | REFON | ADC10ON | ADC10IE;
ADC10CTL1 = INCH2 | INCH1 | INCH0 | CONSEQ_2;
ADC10DTC1 = 32; // 64 conversions
ADC10SA = (unsigned short)&DataBuffer; // Data buffer start
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
ADC10CTL0 &= ~ENC;
ADC10CTL0 = 0; // Power down the ADC

ByteWord.wv = 0;
for ( i = 0; i < 32; i++ )
{
ByteWord.wv += DataBuffer;
}
ByteWord.wv = ByteWord.wv >> 5;
temperature = ByteWord.wv;
sprintf(temp_rd," %d \r\n",DataBuffer[31]);

}[/code]