//**********************************************************************
//* Serial Communication program        															 *
//* This program uses the getkey asm to get keys off a keypad se those *
//* to display	text pieces and scroll through them. Also to see the   *
//* voltage of 2 channels                                           	 *
//* Anthony Varner, (859) 240-6527, Rose-Hulman Institute of Technology*
//* 10/4/2005																											     *
//* Input: PTT0-7,AD6,4, SCI Rx                                        *
//* Ouput: SCI Tx				  																						 *
//* No registers are safe                                              *
//**********************************************************************
#include "main.h"

/* Local Variable Declarations */
//uchar temp_string[20];					// Defines a Temporary Array to Store ASCII Characters

/* Main Routine */
void main ()
{
	  SEI();								// Disable Interrupts
	  oscclk = 24000;						// Set Oscillator Freq. = 24 MHz
    busclk = oscclk/2;					// Set Bus Freq. = (1/2) * Oscillator Freq.
    (void) InitSCI(57600);				// Initialize SCI module @ 19200 Baud Rate
    CLI();								// Enable Interrupts
    
    Crg.clksel.byte &=~PLLSEL; // disconnect PLL 
    Crg.pllctl.byte |=PLLON; // turn on PLL 
    Crg.synr.byte |=SYN1; // set PLL multiplier 
    Crg.refdv.byte |=REFDV0; 
    while(!(Crg.crgflg.byte & LOCK)){ }; // wait for PLL to lock in 
    Crg.clksel.byte |=PLLSEL; // connect PLL.
    
		(void) printf(CLEAR); // Clears Screen
				
		for(;;){							//loop for button pressing
		  ballpositionUpdate();		
		}
}