Hi, i'm trying to do rs485 communication between 2 PIC18f6585 using the USART. I've made simple communication - PIC1 sends message, PIC2 reads the message and send it back to PIC1. This thing works well. I'm trying to connect an LCD to visualize the message from PIC2 but when i put the lcd inicialization function in the main program the comunication doesn't work. I'm posting 2 images to show how this all is connected and sample of the functions. I'm trying to simulate this in Proteus.
The first image is with lcd_init() in main program and puts text on the LCD , and the second without the lcd_init().
Here is my LCD initialization function:
Here is the USART inicialization:
When i put the lcd_init() in the main function where the USART initialization and the send/recieve routines are the communication doesn't work. But if i send something to the LCD it's OK.
Thanks!
The first image is with lcd_init() in main program and puts text on the LCD , and the second without the lcd_init().
Here is my LCD initialization function:
Code:
void lcd_init ()
{
Delay10TCYx(110);
TRISD = PORTD = 0xFF; // inicializirane kato vhodove
wrcmd(LCD_SETFUNCTION); // 4-bit mode - 2 line - 5x7 font.
wrcmd(LCD_SETVISIBLE+0x04); // Display on, no cursor - no blink.
wrcmd(LCD_SETMODE+0x03); // Automatic Increment - No Display shift.
wrcmd(LCD_SETDDADDR+0x0F); // Address DDRAM with 0 offset 80h.
}
Here is the USART inicialization:
Code:
OpenUSART(USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
103);
When i put the lcd_init() in the main function where the USART initialization and the send/recieve routines are the communication doesn't work. But if i send something to the LCD it's OK.
Thanks!