Hi Guys.
I've been playing around with all the major peripherals on the PIC24FJ128GB210, However I'm having trouble with the USART module. (I think) according to the datasheet I have all the set-up configuration settings see code below.
I have a USB to serial FTDI breakout board see attachment, according the terminal the data isn't formatted correctly, the scope also tells me the data isn't present, (there is sign of communication though ,see attachment but the data isn't correct)
Here is the code.
Summary,
Buad Rate: 9600
Stop bit : Enabled.
No Parity.
I'm NOT using the DTR and CTXS wires. Only TX in this case.
/* Data to be transmitted using UART communication module */
volatile char Txdata[] = {'H', 'E', 'L', 'L', 'O'};
void usart_send()
{
/* Holds the value of baud register */
unsigned int baudvalue;
/* Holds the value of uart config reg */
unsigned int U1MODEvalue;
/* Holds the information regarding uart
TX & RX interrupt modes */
unsigned int U1STAvalue;
/* Turn off UART1module */
CloseUART1();
/* Configure uart1 receive and transmit interrupt */
// ConfigIntUART1(UART_TX_ENABLE & UART_RX_INT_EN & UART_RX_INT_PR6 & UART_TX_INT_DIS & UART_TX_INT_PR2);
/* Configure UART1 module to transmit 8 bit data with one stopbit. Also Enable loopback mode */
baudvalue = 51;
U1MODEvalue = UART_1STOPBIT & UART_NO_PAR_8BIT & UART_BRGH_FOUR & UART_UXRX_IDLE_ZERO & UART_DIS_ABAUD & UART_DIS_LOOPBACK & UART_DIS_WAKE & UART_UEN_00 & UART_MODE_SIMPLEX & UART_IrDA_DISABLE & UART_IDLE_CON & UART_EN;
U1STAvalue = UART_TX_ENABLE & UART_INT_TX_EACH_CHAR & UART_SYNC_BREAK_DISABLED & UART_UXRX_IDLE_ONE & UART_ADR_DETECT_DIS;
OpenUART1(U1MODEvalue, U1STAvalue, baudvalue);
/* Load transmit buffer and transmit the same till null character is encountered */
putsUART1 ((unsigned int *)Txdata);
// WriteUART1(10);
/* Wait for transmission to complete */
while(BusyUART1());
/* Turn off UART1 module */
CloseUART1();
}