int main(void){ PLL_Init(); // 25 MHz SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOF; // activate port F ADC0_InitSWTriggerSeq3(0); // allow time to finish activating // ADC0_InitAllTriggerSeq3(0); // allow time to finish activating Timer0A_Init10HzInt(); // set up Timer0A for 10 Hz interrupts Timer1_Init(); // Intitalize timer1 count down GPIO_PORTF_DIR_R |= 0x04; // make PF2 out (built-in LED) GPIO_PORTF_AFSEL_R &= ~0x04; // disable alt funct on PF2 GPIO_PORTF_DEN_R |= 0x04; // enable digital I/O on PF2 // configure PF2 as GPIO GPIO_PORTF_PCTL_R = (GPIO_PORTF_PCTL_R&0xFFFFF0FF)+0x00000000; GPIO_PORTF_AMSEL_R = 0; // disable analog functionality on PF GPIO_PORTF2 = 0; // turn off LED EnableInterrupts(); ST7735_InitR(INITR_REDTAB); ST7735_FillScreen(0); // set screen to black ST7735_SetCursor(0,0); ST7735_XYplotInit("Lab 2 PMF Averaging \n", 0, 4096, 0, 50); ST7735_OutString("1 point \n"); while(1){ WaitForInterrupt(); // GPIO_PORTF2 = 0x04; // profile // ADCvalue = ADC0_InSeq3(); // GPIO_PORTF2 = 0x00; if(Buffer_Counter == 1000){ break; } } uint32_t Jitter; // DisableInterrupts(); // TIMER1_CTL_R = 0x00000000; // 10) enable TIMER1A GPIO_PORTF2 = 0x04; // profile Jitter = Calc_Jitter(); uint32_t n = ADCvalue; // ST7735_OutUDec(n); Calc_PMF(); // will populate the frequency table ADC_Data = x-axis ADC_Freq = y-axis // Next line is call to the plot point function we created in lab1 // ST7735_XYplotInit("PMF", 0, 4096, 0, 50); // ST7735_XYplot(1000, ADC_Data, ADC_Freq); int j = 0; uint32_t x = 0; uint32_t y = 0; int i = 0; //ST7735_PlotClear(32, 159); // for(j = 0; j < 1000; j+=1){ ST7735_XYplotInit("Lab 2 PMF", 0, 4095, 0, 1000); ST7735_XYplot(1000, ADC_Data, ADC_Freq); // ST7735_PlotBar(ADC_Freq[j]); // ST7735_PlotBar(ADC_Freq[j]); //ST7735_PlotBar(30); //ST7735_PlotNext(); // y = 32+(127*(400-ADC_Freq[j]))/400; // x = 127-(127*(4095 - ADC_Data[j])/4095); // if(x<0)x = 0; // if(x>127)x=127; // if(y<32) y = 32; // ST7735_PlotBar(y); // if(y>159) y = 159; // if(x > i){ // ST7735_PlotNext(); // i += 1; // } /* if(j < 14){ ST7735_OutUDec(ADC_Data[j]); ST7735_OutString(" "); ST7735_OutUDec(ADC_Freq[j]); ST7735_OutString("\n"); } */ // } GPIO_PORTF2 = 0x00; // EnableInterrupts(); }
void ADC_Init(void){ ADC_InitSWTriggerSeq3(0); // allow time to finish activating Timer0A_Init10HzInt(); // set up Timer0A for 10 Hz interrupts }