Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC24HJ UART TX communication problem

Status
Not open for further replies.

chandra

Newbie level 6
Joined
Feb 15, 2005
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,401
PIC24HJ UART TX problem

I am using 24hj128gp306 and want to establish connection with PC terminal programm at 115200bps.PIC24HJ I am using UART2.
But i am not getting any characters at pc.Anybody can check the code and help me.

#include <p24Hxxxx.h>
#include<libpic30.h>
#include<uart.h>
#define FCY 7372800 //FCY=FOSC/2
#define BAUDRATE 115200
#define BRGVAL ((FCY/BAUDRATE)/16)-1

/// Macros Configuration

_FOSCSEL(FNOSC_PRI);
_FOSC(FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMD_HS);
_FWDT(FWDTEN_OFF);
_FPOR(FPWRT_PWR1);

_FGS(GCP_OFF);


int main()
{
unsigned int i;
char Txdata[] = {'M','i','c','r','o','c','h','i','p',' ','I','C','D','2','\0'}; /// Chars to transmit
_ODCF5 =0; // openr Drain Configuration

_TRISF5 = 0; // Tx pin is output pin

_LATF5 = 1; // output Latch

U1MODEbits.STSEL = 0; // 1-stop bit
U1MODEbits.PDSEL = 0; // No Parity, 8-data bits
U1MODEbits.ABAUD = 0; // Autobaud Disabled
U1BRG = BRGVAL; // BAUD Rate Generator Prescalar Refer Table 3-10 9600

U1STAbits.UTXISEL0 = 0;
U1STAbits.UTXISEL1 = 0;
IEC0bits.U1TXIE = 0;

U1MODEbits.UARTEN = 1; // Enable UART

U1STAbits.UTXEN = 1; // Enable UART Tx
//for(i=0;1<4160;i++);
putsUART1 ((unsigned int *)Txdata);
//while(1){}
return 0;
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top