Hi,
I am developing one of the UART program using MPLAB Xpress PIC18F46K42 evaluation board on MPLAB CLOUD IDE.
In this program, FT232R USB UART IC and termite app are used to estabish the communication.
In this case, the LED is 'ON' and 'OFF', but the UART function is not established on termite window.
my code is as follows:
////////////////main function/////////////
void main(void)
{
PORTAbits.RA0 = 1; //led "ON"
delay_ms(100) ; //wait for delay
UART1_Write(a); ////char (or) uint8_t a = 77;
UART1_Write(b); ////char (or) uint8_t b = 78;
UART1_Write(c); ////char (or) uint8_t c = 79;
UART1_Write(d); ////char (or) uint8_t d = 80;
PORTAbits.RA0 = 0; //led "OFF"
delay_ms(100) ; //wait for delay
}
////////UART Transmit function///////////
void UART1_Write(uint8_t txData)
{
while(0 == uart1TxBufferRemaining)
{
}
if(0 == PIE3bits.U1TXIE)
{
U1TXB = txData;
}
else
{
PIE3bits.U1TXIE = 0;
uart1TxBuffer[uart1TxHead++] = txData;
if(sizeof(uart1TxBuffer) <= uart1TxHead)
{
uart1TxHead = 0;
}
uart1TxBufferRemaining--;
}
PIE3bits.U1TXIE = 1;
}
////////////////////////////////////
Please let me know, what is going wrong...