Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[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){
}
    
}
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
48,300
Helped
14,233
Reputation
28,727
Reaction score
12,925
Trophy points
1,393
Location
Bochum, Germany
Activity points
279,672
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.
 

andre_teprom

Super Moderator
Staff member
Joined
Nov 7, 2006
Messages
9,240
Helped
1,151
Reputation
2,321
Reaction score
1,127
Trophy points
1,403
Location
Brazil
Activity points
53,784
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top