コード例 #1
0
ファイル: main.c プロジェクト: fariddd/TM4C123GXL
int main(void)
{
	//char myString[6];
  PLL_Init_50MHz();
  UART5_Init(); // initialize UART
	PortF_Init();
	GPIO_PORTF_DATA_R = 0x00;
	UART5_WriteString("r - turn Red LED on");
	OutCRLF();
	UART5_WriteString("b - turn Blue LED on");
	OutCRLF();
	UART5_WriteString("g - turn Green LED on");
	OutCRLF();
	UART5_WriteString("Please input a character: ");
	OutCRLF();
	for(;;)
	{
		// UART_WrtieString 
		/*
		UART_WriteString("Please input a string (max length 5): ");
		UART_ReadString(myString, 5);
		UART_WriteString(" OutString= ");
		UART_WriteString(myString);
		OutCRLF();
		*/
		if (UART5_Available())
		{
			unsigned char recvChar = UART5_ReadChar();
			UART5_WriteString("Received Char: ");
			UART5_WriteChar(recvChar);
			OutCRLF();
			switch (recvChar)
			{
				case 'r':
					// red
					GPIO_PORTF_DATA_R = 0x02;
					break;
				case 'b':
					// blue
					GPIO_PORTF_DATA_R = 0x04;
					break;
				case 'g':
					// green
					GPIO_PORTF_DATA_R = 0x08;
					break;
				default:
					GPIO_PORTF_DATA_R = 0x00;
					break;
			}
		}
	}
}
コード例 #2
0
ファイル: Lab2g.c プロジェクト: NickCarneiro/EE445L-Labs
void main(void){ 
unsigned short First;
unsigned short Delay = 0;	 
EnableInterrupts;
  PLL_Init();       // running at 24MHz
  DDRT = 0xff;      // debugging outputs
  PTT = 0x00;
  SCI0_Init(115200);	// fastest standard baud rate on run mode 9S12DP512
  
  SCI0_OutString("EE445L Lab2g -JWV"); OutCRLF();
  TSCR1 = 0x80;     // Enable TCNT, 24MHz assuming PLL is active
  TSCR2 = 0;
// calibration offset  
  First = TCNT;
  //nothing here
  Delay = TCNT - First - 9;
  SCI0_OutString("Time to execute nothing "); 
  SCI0_OutUDec(Delay);
  SCI0_OutString(" cycles"); OutCRLF();

// measurement version 1, no debugging instruments 
  Fifo_Init();    // Initialize fifo
  Fifo_Put(1);    // make sure there is something in the fifo
  First = TCNT;
  Fifo_Get(&ForeData);
  Delay = TCNT-First-9;
  SCI0_OutString("Time to execute Fifo_Get with no debugging instruments is "); 
  SCI0_OutUDec(Delay);
  SCI0_OutString(" cycles"); OutCRLF();

// measurement version 2, print debugging instruments 
/*  Fifo_Init();    // Initialize fifo
  Fifo_Put(1);    // make sure there is something in the fifo
  First = TCNT;
  Fifo_Get2(&ForeData);
  Delay = TCNT-First-9;
  SCI0_OutString("Time to execute Fifo_Get2 with print debugging instruments is "); 
  SCI0_OutUDec(Delay);
  SCI0_OutString(" cycles"); OutCRLF();
  
// measurement version 3, dump debugging instruments 
  Fifo_Init();    // Initialize fifo
  Fifo_Put(1);    // make sure there is something in the fifo
  First = TCNT;
  Fifo_Get3(&ForeData);
  Delay = TCNT-First-9;
  SCI0_OutString("Time to execute Fifo_Get3 with dump debugging instruments is "); 
  SCI0_OutUDec(Delay);
  SCI0_OutString(" cycles"); OutCRLF();*/  
  for(;;){}
}
コード例 #3
0
ファイル: main.c プロジェクト: shaunhaskey/hma_micro_program
//----------------------------------------------------------
//Check to see if the LCD is working - output LCD Error if it isn't
//Should change this so that it doesn't go on forever.
void check(short status){	 // 0 if LCD is broken
  if(status ==0){		   
    for(;;) {
      SCI_OutString("LCDError");   OutCRLF();
      Timer_mwait(250);    // 0.25 sec wait
    }
  }
}
コード例 #4
0
ファイル: main.c プロジェクト: NickCarneiro/EE445L-Labs
void main(void) {		
  DDRP |= 0x80;       // PortP bit 7 is output to LED
  PLL_Init();         // running at 24 MHz
  SCI0_Init(115200);	// fastest standard baud rate on run mode 9S12DP512
  asm cli
  SCI0_OutString("TechArts DP512, SCI interrupt demo 9/2/09 -JWV"); OutCRLF();
  for(;;) {
    SCI0_OutString("InString: "); 
    SCI0_InString(string,19);   
    SCI0_OutString(" OutString="); SCI0_OutString(string); OutCRLF();
    
    SCI0_OutString("InUDec: ");  n=SCI0_InUDec(); 
    SCI0_OutString(" OutUDec="); SCI0_OutUDec(n); OutCRLF();
     
    SCI0_OutString("InUHex: ");  n=SCI0_InUHex(); 
    SCI0_OutString(" OutUHex="); SCI0_OutUHex(n); OutCRLF();
  }

}
コード例 #5
0
//debug code
int main(void){
  char ch;
  char string[20];  // global to assist in debugging
  uint32_t n;

  PLL_Init(Bus50MHz);       // 50  MHz
  UART_Init();              // initialize UART
  
  OutCRLF();
  for(ch='A'; ch<='Z'; ch=ch+1){// print the uppercase alphabet
    UART_OutChar(ch);
  }
  OutCRLF();
  UART_OutChar(' ');
  for(ch='a'; ch<='z'; ch=ch+1){// print the lowercase alphabet
    UART_OutChar(ch);
  }
  OutCRLF();
  UART_OutChar('-');
  UART_OutChar('-');
  UART_OutChar('>');
  while(1){
    UART_OutString("InString: ");
    UART_InString(string,19);
    UART_OutString(" OutString="); UART_OutString(string); OutCRLF();

    UART_OutString("InUDec: ");  n=UART_InUDec();
    UART_OutString(" OutUDec="); UART_OutUDec(n); OutCRLF();

    UART_OutString("InUHex: ");  n=UART_InUHex();
    UART_OutString(" OutUHex="); UART_OutUHex(n); OutCRLF();

  }
}
コード例 #6
0
ファイル: main.c プロジェクト: NickCarneiro/EE445L-Labs
void main(void){
  unsigned short phrase = 0;
  unsigned char data[50];
  unsigned short check = 0;
  unsigned short length  = 0;
  int i = 0;
  
  SCIb_Init(9600);
  DDRP |= 0x80;       //Port P bit 7 is output to LED
  PLL_Init();         //Running at 24 MHz
  SCI1_Init(115200);    // fastest standard baud rate on run mode 9S12DP512 
  XBee_Init();
  asm cli
  
  SCI1_OutString("XBee Test"); OutCRLF();
  
  for(;;){
      SCI1_OutString("XBee Output: ");
      XBee_ReceiveRxFrame(data);
      SCI1_OutString(data);OutCRLF();   
  }
} 
コード例 #7
0
interrupt VectorNumber_Vtimch0 void ISR_Vtimch0(void){
  //int i;
  if (!(PTIT & (0x01))){            
    for(;;) {
        PTJ ^= 0x01;          // toggle LED     
        val1 = ATDDR0;       // read analog input from channel 11
        SCI_OutUDec(val1);    // output analog reading via serial
        OutCRLF();
        delayby1ms(3); 
    }    
    temp=TC0;   //refer back to TFFCA, we enabled FastFlagClear, thus by reading Timer Capture 
                //input we automatically clear the flag, allowing another TIC interrupt
  }
}
コード例 #8
0
ファイル: main.c プロジェクト: shaunhaskey/hma_micro_program
unsigned short SCI_InUDec2(void){	
unsigned short number1=0, number2=0, number3=0, number4=0,number5=0, contnum=1, length=0;
char character;
  character = SCI_InChar2();	
  while(character != CR){ // accepts until <enter> is typed

// The next line checks that the input is a digit, 0-9.
// If the character is not 0-9, it is ignored and not echoed
    if((character>='0') && (character<='9') && (contnum==1)) {
      number1 = 10*number1+(character-'0');   // this line overflows if above 65535
      length++;
      SCI_OutChar(character);OutCRLF();
    } 
 
     character = SCI_InChar();	
  }
  
  return number1;
  
}
コード例 #9
0
void Interpreter(void)    // just a prototype, link to your interpreter
{
	uint32_t stringSize;
	uint32_t adcVoltage;
	uint8_t deviceChosen;
	uint8_t taskAddedBefore = 0;
	uint8_t commandChosen = -1;
	char message[MESSAGELENGTH] = "";
	OutCRLF();
	UART_OutString("Input Command: ");
	while(1){
		OutCRLF();
		//UART_OutString("Commands: 0 - ADC, 1 - LCD, 2 - Time");
		OutCRLF();
		commandChosen = UART_InChar();
		switch(commandChosen)
		{
			case '0':
				OutCRLF();
				UART_OutString("ADC Voltage = ");
				//ADC_Open(4);
				adcVoltage = (ADC_In() *3300) / 4095; //convert to mV
				UART_OutUDec(adcVoltage);
				OutCRLF();
				break;
			case '1':
				OutCRLF();
				UART_OutString("Enter LCD device 0 or 1: ");
				deviceChosen = UART_InUDec();
				OutCRLF();
				UART_OutString("Enter message: ");
				UART_InString(message, MESSAGELENGTH);
				OutCRLF();
				stringSize = strlen(message);
				if(stringSize > 20)
				{
					OutCRLF();
					UART_OutString("String too long...");
					OutCRLF();
				}
				LCD_test(deviceChosen, message); //prints to lcd
				OutCRLF();
				break;
			case '2':
				if(!taskAddedBefore){
					OS_AddPeriodicThread(dummy, 5, 1);
					taskAddedBefore = 1;
				}
				OutCRLF();
				UART_OutUDec(OS_ReadPeriodicTime());
				OutCRLF();
				break;
			case '3':
				UART_OutString("NumSamples: ");
				UART_OutUDec(NumSamples);
				OutCRLF();
				break;
			case '4':
				UART_OutString("Jitter: ");
				UART_OutUDec(MaxJitter);
				OutCRLF();
				break;
			case '5':
				UART_OutString("DataLost: ");
				UART_OutUDec(DataLost);
				OutCRLF();
				break;
			case '6':
				UART_OutString("FilterWork: ");
				UART_OutUDec(FilterWork);
				OutCRLF();
				break;
			case '7':
				UART_OutString("NumCreated: ");
				UART_OutUDec(NumCreated);
				OutCRLF();
				break;
			case '8':
				for(int i = 0; i<64; i++)
				{
					UART_OutUDec(x[i]);
					OutCRLF();
				}
				break;
			default:
				UART_OutString("Incorrect command!");
				break;
		}

		//adcSample = ADC_In();
		//ST7735_SetCursor(0,0);
		//ST7735_OutUDec(adcSample);
	
	}
}