PIC24FJ128GA006 serial transmission not working

Status
Not open for further replies.

Shafaq Gul

Junior Member level 1
Joined
Dec 24, 2013
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
122
Salam every one

I am using mplab C30 and am trying to send data serially but its not working.(p24FJ128GA006):-(...I have tried alot looking for help.

Code:
#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;
}

- - - Updated - - -

Waiting for reply sir...:!:
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…