[/code] I do not know why it does not work by sending this, I have the LCD to it's default setting to 19200 baudrate and that's how i set software too. Please, any help with be greatly appreciated"> [/code] I do not know why it does not work by sending this, I have the LCD to it's default setting to 19200 baudrate and that's how i set software too. Please, any help with be greatly appreciated"> [/code] I do not know why it does not work by sending this, I have the LCD to it's default setting to 19200 baudrate and that's how i set software too. Please, any help with be greatly appreciated">
[code]
#define FCY 25000000
#define BAUDRATE 19200
#define BRGVAL ((FCY/BAUDRATE)/16)-1
void initUART(void)
{
PORTBbits.RB4 = 1;
///***************************
// Assign U1Rx To Pin RP0
//***************************
RPINR18bits.U1RXR = 0;
//***************************
// Assign U1CTS To Pin RP1
//***************************
RPINR18bits.U1CTSR = 1;
//***************************
// Configure Output Functions
// (See Table 9-2)
//***************************
//***************************
// Assign U1Tx To Pin 11
//***************************
RPOR4bits.RP8R = 3;
//***************************
// Assign U1RTS To Pin 12
//***************************
RPOR4bits.RP9R = 4;
//UART Initialization//
PLLFBD=38; // M=40
CLKDIVbits.PLLPOST=0; // N1=2
CLKDIVbits.PLLPRE=0; // N2=2
RCONbits.SWDTEN=0; // Disable Watch Dog Timer
while(OSCCONbits.LOCK!=1) {}; // Wait for PLL to lock
U1MODEbits.STSEL = 0; // 1-stop bit
U1MODEbits.PDSEL = 0; // No Parity, 8-data bits
U1MODEbits.ABAUD = 0; // Autobaud Disabled
U1MODEbits.BRGH = 0; // Low Speed mode
U1BRG = BRGVAL; // BAUD Rate Setting for 19200
U1STAbits.UTXISEL1 = 0;
U1MODEbits.UARTEN = 1; // Enable UART
U1STAbits.UTXEN = 1; // Enable UART Tx
}
///////////////////////////////////////////////////////////////////
int main ()
{
unsigned int place1,place2,place3;
int STX,ETX,sign,unit_num;
int temperature;
initADC(); // initialize the ADC
initUART(); // initalize the UART
LCDinit();
OutStr(">");
The LCDinit(); Is a function from a header. I didn't included it here, but what the LCD requires to perform tasks is to have decimal values sent to it. For instance in order to clear the screen which I've been trying to do, the following must be done (this is excerpt from LCD manual);
Clear Screen
Syntax Hexadecimal 0xFE 0x58
Decimal 254 88
ASCII 254 ?X?
Description This command will immediately clear all of the contents of the display.
so what I've done is make the following commands
WriteUART1(254);
WriteUART1(88);
[/code]
I do not know why it does not work by sending this, I have the LCD to it's default setting to 19200 baudrate and that's how i set software too. Please, any help with be greatly appreciated
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w