[PIC] XC8 XLCD with PIC18 error

Status
Not open for further replies.

RUKAEF

Newbie level 2
Joined
Nov 15, 2019
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
I try to use XLCD library with default pin setup,
It compiled successfuly.
But when I simulate it gives this error.

[HD44780] Attempted to read after writing a single nibble [LCD1]

When I only use OpenXLCD command, It again gives same arror.
Code:
OpenXLCD(FOUR_BIT & LINES_5X7);


Here is my code,
Code:
#define _XTAL_FREQ 8000000

#include "confighed.h"
#include "xc.h"
#include "plib/xlcd.h"
#include "plib/delays.h"


void DelayFor18TCY(void)
{
Nop(); Nop(); Nop(); Nop(); // 18 cycle delay
Nop(); Nop(); Nop(); Nop();
Nop(); Nop(); Nop(); Nop();
Nop(); Nop();
return;
}

void Delay_Seconds(unsigned char s)
{
    unsigned char i,j;
    for(j = 0; j < s; j++)
    {
        for(i = 0; i < 100; i++)__delay_ms(10);
    }
}

void DelayPORXLCD(void) 
{
   Delay1KTCYx(30);
}

void DelayXLCD(void)
{
   Delay1KTCYx(10);
}

void initXLCD(void){
    OpenXLCD(FOUR_BIT & LINES_5X7);
    while(BusyXLCD());
    WriteCmdXLCD(0x06);
    WriteCmdXLCD(0x0C);
   
}



void main(void) {
    TRISB = 0;
    PORTB = 0;
 
initXLCD();
putrsXLCD("RUK");

while(1){
}
    
}
 

I presume it's a Proteus simulator error message?

Check if xlcd.h is configured for 4-bit mode (the default). If this is the case, there may a problem that the simulator sees an apparent write access due to initial pin states. Or the LCD component isn't connected according to the expected pin usage.
 

It is worthy to try adding an while(BusyXLCD()) command after each XLCD access just to check if you are having timing issues.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…