Пример #1
0
void main( void ) {
	 SPI1CR1=0x00;
	
	//initialize LCD, RTI,KISR,pac_isr,and ATDo interrupt
	Lcd2PP_Init(); 			
	runKeypad();
	runMotor();
	runTemperature();
	runRTI();
	 
	//activate interrupt 
	INTR_ON(); 

	//infinite loop to run program forever
	for (;;){
	
			}//end for loop

}//end main
Пример #2
0
/** INITIALIZATION  ****************************************************/
void init(void) {
  // Set up the RTI.
  RTICTL = 0x17;// Generate an. intr. every 2ms.
  
  // Set up the buzzer.
  SETMSK(DDRK, BUZZER_MASK);
  
  // Set up the KISR.
  DDRP |= 0x0F; // bitset PP0-3 as outputs (rows)
  DDRH &= 0x0F; // bitclear PH4..7 as inputs (columns)

  PIFH  = 0xFF; // Clear previous interrupt flags
  PPSH  = 0xF0; // Rising Edge
  PERH  = 0x00; // Disable pulldowns
  PIEH |= 0xF0; // Local enable on columns inputs

  SETMSK(PTM, 0x08); /* Pass through the latch to the keypad. */
  PTP   = 0x0F; // Set scan row(s)
  CLRMSK(PTM, 0x08);
  
  // Set up the clock (TC0) ISR.
  TSCR1 = 0x90;        // Enable TCNT and fast-flags clear.
  TSCR2 = 0x05;        // Set a pre-scale factor of 32x, no overflow interrupts.
  TIOS  = 0x01;        // Enable OC0.
  SETMSK(TIE, 0x01);   // Enable interrupts on OC0.
  TC0   = TCNT + TC0_TICK_LENGTH; // Set up the timeout on the output compare.

  //This sets up the temperature sensor thing
  ATD0CTL2 = 0xFA; // Enables ATD
  ATD0CTL3 = 0x00; // Continue conversions
  ATD0CTL4 = 0x60; // Select 10-bit operation
  						  // Set sample time to 16 ATD clock period
						  // Set clock prescale to 0
  ATD0CTL5 = 0x86; // Right justified, Unsigned and single scan
  
  INTR_ON();  
  
  // Set up the LCD.
  clearLEDs();
  LCD2PP_Init();
}