#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */


void Init(){
	//configurare procesor
    SOPT  = 0x00;	 /* Disable COP	*/
    ICGC2  = 0X00;       // Set up ICG control register 2
    ICGC1  = 0X78;       // Set up ICG for FEE, 4MHz external crystal, busclk = 8MHz
    	//asteptare pornire FLL (LOCK = 1)
	while(!(ICGS1 & 0x08));

	// configurare PORT F
    PTFDD = 0xFF;	 
        

    //configurare seriala 1
    SCI1BD = 8000000/16/19200;
    SCI1C1 = 0;
    SCI1C2 = 0x08; 
 }


void main(void) {
  int i;
  Init();
  EnableInterrupts; /* enable interrupts */
  /* include your code here */

  PTFD  = 0x00;

  for(;;) {
    for(i=0; i<24; i++) {
        while(!(SCI1S1 & 0x80)); //asteptam terminate transmisie
        SCI1D = i + 'A';
    }  

  } /* loop forever */
  /* please make sure that you never leave main */
}
