unsigned long ulData = 0x00;
unsigned long ulTmp;
int i=0;
char s[10];
int
main(void)
{
//
// Set the clocking to run directly from the crystal.
//
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_8MHZ);
//
// Initialize the OLED display.
//
RIT128x96x4Init(1000000);
//
// Enable the ADC.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC);
//
// Set 125KSPS sampling frequency.
//
SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS);
//
// Initialize ADC3 Sequenc.
//
ADCSequenceDisable(ADC_BASE, 3);
ADCSequenceConfigure(ADC_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
//
// Configure ADC3, Use Internal Temperature Sensor.
//
ADCSequenceStepConfigure(ADC_BASE, 3, 0, ADC_CTL_TS | ADC_CTL_END);
ADCSequenceEnable(ADC_BASE, 3);
//
// Display on OLED
//
RIT128x96x4StringDraw("ADC3=", 0, 15, 15);
RIT128x96x4StringDraw("(C)", 68, 15, 15);
while(1)
{ //
// Processor ADC3 Sequenc
//
ADCProcessorTrigger(ADC_BASE, 3);
while (
(HWREG(ADC_BASE + ADC_O_X_SSFSTAT) & 0x00000100)
);
ADCSequenceDataGet(ADC_BASE, 3, &ulData);
ulTmp = 151040 - 225 * ulData;
sprintf(s, "%d", ulTmp / 1024);
RIT128x96x4StringDraw(s, 30, 15, 15);
SysCtlDelay(SysCtlClockGet() / 12);
RIT128x96x4StringDraw(" ", 30, 15, 0);
}
}