Пример #1
0
int main(void){uint32_t i;
  PLL_Init(Bus80MHz);
  PortF_Init();
  ST7735_InitR(INITR_REDTAB);
  while(1){
    ST7735_FillScreen(0);  // set screen to black
    ST7735_SetCursor(0,0);
    printf("Lab 1\rST7735_sDecOut3\r");
    for(i=0; i<13; i++){
      ST7735_sDecOut3(outTests1[i].InNumber);  // your solution
      ST7735_OutString((char*)outTests1[i].OutBuffer); // expected solution
    }
    //Pause();
  
    ST7735_FillScreen(0);  // set screen to black
    ST7735_SetCursor(0,0);
    printf("ST7735_uBinOut8\r");
    for(i=0; i<14; i++){
      ST7735_uBinOut8(outTests2[i].InNumber);  // your solution
      ST7735_OutString((char*)outTests2[i].OutBuffer); // expected solution
    }
    //Pause();
    
    ST7735_XYplotInit("Circle",-2500, 2500, -2500, 2500);
    ST7735_XYplot(180,(int32_t *)CircleXbuf,(int32_t *)CircleYbuf);
    //Pause();
    
    ST7735_XYplotInit("Star- upper right",-450, 150, -400, 200);
    ST7735_XYplot(50,(int32_t *)StarXbuf,(int32_t *)StarYbuf);
    Pause(); 
  } 
} 
Пример #2
0
void ST_drawData(volatile uint32_t data[], uint16_t length) {
	histogram adc_hist;
	histogramify(data, length, &adc_hist);
	
	// Initialize histogram plot with 10 pixel margins
	ST7735_XYplotInit("", adc_hist.min-PLOT_MARGIN, adc_hist.max+PLOT_MARGIN, 0, MAX_RECORDS);
	
	for (int i = adc_hist.min; i <= adc_hist.max; ++i) {
		ST7735_PlotBar_Lab2(i, numOcurrences[i]);
	}
}
Пример #3
0
int main(void){
	PLL_Init(Bus80MHz);                   // 80 MHz
  SYSCTL_RCGCGPIO_R |= 0x20;            // activate port F
  ADC0_InitSWTriggerSeq3_Ch9();         // allow time to finish activating
  Timer0A_Init100HzInt();               // set up Timer0A for 100 Hz interrupts
  Timer1_Init();
	//Timer2_Init();											//Enable this for part D.
	GPIO_PORTF_DIR_R |= 0x06;             // make PF2, PF1 out (built-in LED)
  GPIO_PORTF_AFSEL_R &= ~0x06;          // disable alt funct on PF2, PF1
  GPIO_PORTF_DEN_R |= 0x06;             // enable digital I/O on PF2, PF1
                                        // configure PF2 as GPIO
  GPIO_PORTF_PCTL_R = (GPIO_PORTF_PCTL_R&0xFFFFF00F)+0x00000000;
  GPIO_PORTF_AMSEL_R = 0;               // disable analog functionality on PF
  PF2 = 0;                      // turn off LED
	EnableInterrupts();
  while(1){
    PF1 ^= 0x02;  // toggles when running in main
		//GPIO_PORTF_DATA_R ^= 0x02;  // Uncomment this for part C. and comment the line above.
		//PF1 = (PF1*12345678)/1234567+0x02;  // Uncomment this for part D.
		if(i==1000){
			int largest = 0;
			for(int j; j < 1000; j++){
				if(largest < array2[i]){
					largest = array2[i];
					i++;
				}
			}
			Output_Init();              // initialize output device
			Errors = 0;
			int x;
			int y;
			DisableInterrupts();
			storeFrequency();
			makePMF(array3, pmf);
			ST7735_XYplotInit("Lab 2 PMF", 0, 4095, 0, 1000);
			for(int j = 0; j < 1000; j += 10){
			 	ST7735_PlotBar(pmf[j] * 9);
				ST7735_PlotNext();
			}
			break;
		}
  }
	while(1);
}
Пример #4
0
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();
}