Picdem™ 17 demonstration board user’s guide – Arizona Picdem 17 User Manual

Page 70

Advertising
background image

PICDEM™ 17 Demonstration Board User’s Guide

DS39024B-page 64

2001 Microchip Technology Inc.

OpenUSART2(USART_TX_INT_OFF&USART_RX_INT_OFF&USART_ASYNCH_MODE&

USART_EIGHT_BIT&USART_CONT_RX,25);

// Initialize the A/D

OpenADC(ADC_INT_OFF&ADC_FOSC_32&ADC_RIGHT_JUST&ADC_VREF_INT&

ADC_4ANA_8DIG,ADC_CH0);

// Print a carriage return and linefeed

PutsUSART2(crlf);

while(1)

{

ConvertADC();

// Start a conversion

while(BusyADC());

// Wait to complete

result = ReadADC();

// Read result

uitoa(result,str);

// Convert to ASCII

PutsUSART2(str);

// Print string to

USART

PutsUSART2(crlf);

// Print crlf to

USART

Delay10KTCYx(250);

// Wait a while

Delay10KTCYx(250);

}

}

Advertising