Exemple #1
0
void main(void) {
   uint8_t ddramAddr = LCD_START_OF_FIRST_LINE;
   int buttonCount = 0, charCount = 0;
   const uint8_t *dr_seuss = (const uint8_t*)DR_SEUSS;

   disableWatchdog();
   configClocks();
   turningOnLCD();

   while (1) {
	  // Check if button pressed
      if (P2IN && buttonCount < 100) {
         printString((const uint8_t*)"Hello, World!", 13, ddramAddr);
      }
      else if (!P2IN && buttonCount < 100){
    	 ++buttonCount;
    	 printString((const uint8_t*)"Goodbye!", 8, ddramAddr);
      }
      else {
    	 printString(dr_seuss + charCount++, 32, LCD_START_OF_FIRST_LINE);
      }

      // Update address
      ddramAddr = ddramAddr == LCD_END_OF_FIRST_LINE ?
       LCD_START_OF_SECOND_LINE : ddramAddr + 0x01;

      // Wrap address back around
      if (ddramAddr > LCD_END_OF_SECOND_LINE)
	     ddramAddr = LCD_START_OF_FIRST_LINE;

      // Stop the text from scrolling too fast
      __delay_cycles(50000);
   }
}
Exemple #2
0
int main(void) {
	WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog time
	configClocks();
	configPins();
	configTimerA0();
	configTimerA1();
	configADC10();
	initSPI();
	initMessage();

	_enable_interrupts();		// enable global interrupts

	while (1) {
		//pack our new message
		GPIOUpdate();
		currentUpdate();
		messagePackServoValues(servoValue);
	}
}
Exemple #3
0
void main(void) {
    WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer

   configClocks();
   startTimer();
   spi_init();
   square_wave_init();
   button_init();
   __enable_interrupt();

   while (1) {
      if(wave == SQUARE)
         draw_square();
      else if(wave == SINE)
         draw_sine();
      else if(wave == SAW)
         draw_saw();
      else
         draw_triangle();
   }
}
void main(void)
{
	configClocks();
	setupOutputs();
	//setupInterrupts();
	//turnTXD(ON);
	setupUART();

	_EINT();

	while(1){
		//if (port) {

		//turnTXD(ON);

		//P1IFG &= ~ADR_BUS0;
		//port = 0;
		//blinkLEDGreen(1);
		//blinkLEDRed(1);

		//int i = 0, timeOut = 10000;

		//while(i < timeOut){

		while (byteRX == 'D') {
			turnTXD(ON);
			blinkLEDRed(1);
			UART_putChar('O');
			blinkLEDGreen(2);
			turnTXD(OFF);
			//byteRX = '#';  //this is to flush the RX buffer
			//i = timeOut;
		}

		//blinkLEDRed(1);
		//i++;
	}
	//}
}