예제 #1
0
int main(void) 
{ 
	TERMIO_Init(); 
	printf("\n\r In test harness of passwords\r\n");
	/* Intializes random number generator */
  srand(rand());
	randomizePasswords();
	printPassword(getPassword(1));
	printPassword(getPassword(2));
	printPassword(getPassword(3));
	printPassword(getPassword(4));
	printf("\r\nThe correct password is %d\r\n\r\n", correctPassword);
	if (checkPassword(getPassword(1)))
		printf("Password1 is correct\r\n");
	else
		printf("Password1 is incorrect\r\n");
	if (checkPassword(getPassword(2)))
		printf("Password2 is correct\r\n");
	else
		printf("Password2 is incorrect\r\n");
	if (checkPassword(getPassword(3)))
		printf("Password3 is correct\r\n");
	else
		printf("Password3 is incorrect\r\n");
	if (checkPassword(getPassword(4)))
		printf("Password4 is correct\r\n");
	else
		printf("Password4 is incorrect\r\n");
		
	// Int to Character Stuff
	char c[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
	for (int i = 0; i < 5; i++) {
		printf("%c\r\n", c[getPassword(1)[i]]);
	}
}
예제 #2
0
int main(void)
{  
	// Set the clock to run at 40MhZ using the PLL and 16MHz external crystal
	SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN
			| SYSCTL_XTAL_16MHZ);
	TERMIO_Init();
	clrScrn();

	ES_Return_t ErrorType;


	// When doing testing, it is useful to announce just which program
	// is running.
	puts("\rStarting Test Harness for \r");
	printf("the 2nd Generation Events & Services Framework V2.2\r\n");
	printf("%s %s\n",__TIME__, __DATE__);
	printf("\n\r\n");
	printf("Press any key to post key-stroke events to Service 0\n\r");
	printf("Press 'd' to test event deferral \n\r");
	printf("Press 'r' to test event recall \n\r");

	// Your hardware initialization function calls go here
	InitUart1();
	
	
	// now initialize the Events and Services Framework and start it running
	ErrorType = ES_Initialize(ES_Timer_RATE_1mS);
	if ( ErrorType == Success ) {

	  ErrorType = ES_Run();

	}
	//if we got to here, there was an error
	switch (ErrorType){
	  case FailedPost:
	    printf("Failed on attempt to Post\n");
	    break;
	  case FailedPointer:
	    printf("Failed on NULL pointer\n");
	    break;
	  case FailedInit:
	    printf("Failed Initialization\n");
	    break;
	 default:
	    printf("Other Failure\n");
	    break;
	}
	for(;;)
	  ;

}
예제 #3
0
파일: main.c 프로젝트: mishra14/Lab1_ESE519
void main(void) {
   TERMIO_Init();
   DDRB|=0x40;
   PORTB|=0x40;
   DDRT&=~(0x04);
   TCTL4|=0x30;
   TIE|=0x04;
   TSCR1|=0x80;
   TSCR2|=0x80;
   overflow=0;
   EnableInterrupts;
  while(1) {
    
  }
}
예제 #4
0
int main(void) {
	PortFunctionInit();
	TERMIO_Init();
	clrScrn();
	
	// When doing testing, it is useful to announce just which program
	// is running.
	puts("\rStarting Test Harness for \r");
	printf("the 2nd Generation Events & Services Framework V2.2\r\n");
	printf("%s %s\n",__TIME__, __DATE__);
	printf("\n\r\n");
	printf("Press any key to post key-stroke events to Service 0\n\r");
	printf("Press 'd' to test event deferral \n\r");
	printf("Press 'r' to test event recall \n\n\r");
	

}
예제 #5
0
int main(void)
{
	PortFunctionInit();
	TERMIO_Init();
	puts("\r\n In test harness for LEDControl: All LEDs should be flashing, except for pin 31 which is flashing and pin 30 which is on (0)\r\n");
	InitLEDControl(1);

	// setLED(LED_ALL, OFF);

	/*char input = getchar();
	
	while (input != '0') {
		
		//setLED(LED_ALL,ON);
		//setLED(LED_SD_BLUE,OFF);
		setLED(LED_ALL, ON);

		setLED(LED_SACRAMENTO_RED, ON);
		setLED(LED_SACRAMENTO_BLUE, OFF);

		//setLED(LED_LA_RED, ON);
		printf("Blue Off\r\n");
		input = getchar();
		setLED(LED_SACRAMENTO_RED,OFF);
		setLED(LED_SACRAMENTO_BLUE, ON);
		//setLED(LED_LA_RED, OFF);
		printf("Blue On\r\n");
		*/
		/*
		if (input >= 'a' && input <='z') {
			setLED(LED_ALL_INDIV, OFF);
			setLED(LED_ALL_CITIES, CITY_OFF);
			setLED(BIT0HI << (input - 'a'), ON);
			printf("Shift Register value: %u\r\n",LED_SR_GetCurrentRegister());
		}
		input = getchar();
		}
		*/
		setLED(LED_ALL_INDIV, OFF);
		setLED(LED_ALL_CITIES_RED, CITY_OFF);
		setLED(LED_ALL_CITIES_BLUE, CITY_ON);
	
	
	return 0;
}
예제 #6
0
void main(void) {

    TERMIO_Init();
    EnableInterrupts;

    PWMCTL = 0x10; //concatenate PWM0-1
    PWMPOL = 0x03; //channel output start off high for PWM0

    PWMPER01 = 40000; //set to 50Hz (20ms period) for DC motor

    PWMDTY01 = dc_dty;//16 bit unsigned int
    PWME |= 2;//enable

//output on PP1 pin 11

    while(1) {}

}
예제 #7
0
int main (void)
{
  ES_Return_t ErrorType;
    
// Your hardware initialization function calls go here
// Set the clock to run at 40MhZ using the PLL and 16MHz external crystal
  SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN
			| SYSCTL_XTAL_16MHZ);

  // Initialize the terminal for puts/printf debugging
  TERMIO_Init();
	clrScrn();
   
// When doing testing, it is useful to announce just which program
// is running.
	puts("\rStarting Test Harness for \r");
	printf("the 2nd Generation Events & Services Framework V2.2\r\n");
	printf("Template for HSM implementation\r\n");
	printf("%s %s\n",__TIME__, __DATE__);
	printf("\n\r\n");

// now initialize the Events and Services Framework and start it running
  ErrorType = ES_Initialize(ES_Timer_RATE_10mS);
  if ( ErrorType == Success ) {
    ErrorType = ES_Run();
  }
//if we got to here, there was an error
  switch (ErrorType){
    case FailedPointer:
      puts("Failed on NULL pointer");
      break;
    case FailedInit:
      puts("Failed Initialization");
      break;
    default:
      puts("Other Failure");
      break;
  }
  for(;;)   // hang after reporting error
    ;
}
예제 #8
0
파일: main.c 프로젝트: ccbeyer/DTMF_Lab
void main(void) {



  TERMIO_Init(); 
  
  printf("REACHED First\n");
  
  /*
  TERM_ReadString(input, 20);
  
  
  
  sscanf(input,"%d %d",&frequency, &duration);
  printf("Frequency %d, Duration %d\n", frequency, duration);
  half_period = 1000000/frequency;
   */
   
   printf("REACHED\n");
  
  EnableInterrupts;
  
  DDRB = 0x0F;
  PORTB = 0x0F;
  TFLG1 = 0x04;
  TSCR1 = 0x80;
  TIOS=0x04;
  TC2+= half_period;
  PTT=0x04;
  TCTL2 = 0x10;
  TIE=0x04;
  CRGINT |= 0x80;
  RTICTL = 0x40;
  
  
  

    
  while(1) {
  
    // printf("REACHED1\n");
     
    if(PORTB == 0xEE) {
      putchar('1');
    }
    if(PORTB == 0xDE) {
      putchar('2');
    }
    if(PORTB == 0xBE) {
      putchar('3');
    }
    if(PORTB == 0x7E) {
      putchar('A');
    }
    if(PORTB == 0xED) {
      putchar('4');
    }
    if(PORTB == 0xDD) {
      putchar('5');
    }
    if(PORTB == 0xBD) {
      putchar('6');
    }
    if(PORTB == 0x7D) {
      putchar('B');
    }
    if(PORTB == 0xEB) {
      putchar('7');
    }
    if(PORTB == 0xDB) {
      putchar('8');
    }
    if(PORTB == 0xBB) {
      putchar('9');
    }
    if(PORTB == 0x7B) {
      putchar('C');
    }
    if(PORTB == 0xE7) {
      putchar('*');
    }
    if(PORTB == 0xD7) {
      putchar('0');
    }
    if(PORTB == 0xB7) {
      putchar('#');
    }
    if(PORTB == 0x77) {
      putchar('D');
    }
    
      
   
     /* TERM_ReadString(input, 20);
    
      sscanf(input,"%d %d",&frequency, &duration);
      printf("Frequency %d, Duration %d\n", frequency, duration);
      half_period = 1000000/frequency;
      
      
      duration1 = (duration/100);
      frequency1 = frequency/10;
      durFreq = (duration1 * frequency1);
      countTemp = (durFreq*2);
      count = countTemp;
      TCTL2 = 0x10;  */
      
      
  
  //printf("REACHED\n");   
  }
      

}