#include<p24FJ128GA006.h>
_CONFIG2(FNOSC_PRI & POSCMOD_HS )
_CONFIG1(FWDTEN_OFF & JTAGEN_OFF )
//////////////////
int main(void)
{
U1MODEbits.UARTEN=1;//uart enable
//U1MODEbits.STSEL=0;// One Stop bit
U1MODEbits.BRGH=1; //high baud rate
U1MODEbits.ABAUD=0;//Baud rate measurement disabled or completed
U1BRG=51;// as internal oscillator frequency 8Mhz
U1MODEbits.PDSEL0=0;//8-bit data, no parity
U1MODEbits.PDSEL1=0;
U1STAbits.UTXISEL0=0;//Interrupt when a character is transferred to the Transmit Shift Register (this implies there is at least one character open in the transmit buffer)
U1STAbits.UTXISEL1=1;
U1MODEbits.UEN0=0;// UxTX and UxRX pins are enabled and used; UxCTS and UxRTS/BCLKx pins controlled by PORT latches
U1MODEbits.UEN1=0;
TRISF=0;
TRISD=0xFF;
LATD=0;
LATF=0;
//U1MODE = 0x8000;
//U1STA = 0x8400;
carriage_return();
while(1); //end
return 0;
//aes256_done(&ctx);
}
/////////////////////////////////////////////////////////////////
void carriage_return(void)
{
U1STAbits.UTXEN=1;
U1TXREG=0x0D;
while(U1STAbits.UTXBF == 1);//wait until all transmitted.
U1STAbits.UTXBF = 1;
}