i have written this code for UART transmission, but with this code i am not able to transmit so please anyone can help me on this
include "p18F87J11.h"
#include"htc.h"
void main ()
{
TRISD=0;
///////////////////////////////////////////////////////////////////////////////////////////
TRISCbits.RC7=1; //RX1 for EUASRT module 1
TRISCbits.RC6=0; //TX1 for EUASRT module 1
TXSTA1bits.SYNC=0; // asychronous mode
TXSTA1bits.BRGH=1; // high speed baud rate mode
BAUDCON1bits.BRG16=0; // 8-bit baud rate generator
SPBRG1=0x81; // baud rate =9600
RCSTA1bits.SPEN=1; // serial port enable
TXSTA1bits.TXEN=1; //transmitt enable
// SPBRGH1=0x00;
INTCONbits.GIE=1; // enable all high priority interrupt
INTCONbits.PEIE=1; // enable all unmasked pheripheral inputs
//////////////////////////////////////////////////////////////////////////////////////////////////
IPR1bits.TX1IP=1; // highest interrupt priority for transmission
PIE1bits.TX1IE=1; // interrupt enable
//////////////////////////////////////////////////////////////////////////////
// IPR1bits.RC1IP=0; // law priority for reception
// PIE1bits.RC1IE=1; // interrupt enable
// RCSTA1bits.CREN=1; // enable receiver
/////////////////////////////////////////////////////////////////////////////////////
TXREG1= 'a';
while(TXSTA1bits.TRMT==0)
// if(TXSTA1bits.TRMT==1)
//while(PIR1bits.TX1IF==0)
{
PORTD=0x00;
}
PORTD=0xff;
while(1);
//PORTD=0x55;
}