+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 1
    Points: 15, Level: 1
    RUKAEF's Avatar
    Join Date
    Nov 2019
    Posts
    1
    Helped
    0 / 0
    Points
    15
    Level
    1

    XC8 XLCD with PIC18 error

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

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 262,005, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,793
    Helped
    13920 / 13920
    Points
    262,005
    Level
    100

    Re: XC8 XLCD with PIC18 error

    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.



    •   AltAdvertisement

        
       

  3. #3
    Super Moderator
    Points: 29,861, Level: 42
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,916
    Helped
    1129 / 1129
    Points
    29,861
    Level
    42
    Blog Entries
    9

    Re: XC8 XLCD with PIC18 error

    It is worthy to try adding an while(BusyXLCD()) command after each XLCD access just to check if you are having timing issues.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



--[[ ]]--